Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor MainService to prevent unnecessary activity starts #243

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Niels-Be
Copy link

@Niels-Be Niels-Be commented Oct 18, 2024

I was about to automate the session startup with my DPC application.
My device is in Lock Task Mode, so starting activities is prohibited.
This cleans up the startup process so that in case all permissions are granted no activities have to be launched.

There should be no logic change. Just moving the code in separate methods
and directly check the permission condition in the service before starting the activity to request it.

Most of the time this will save the overhead of jumping between activities and service
as permissions are only requested the first time.
This helps when automating the start process of a session.

Also send a response to the caller in some failure cases.

Copy link
Owner

@bk138 bk138 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the unrelated whitespace changes, it makes review way harder than need be. Thanks! :-)

Niels Becker added 2 commits October 18, 2024 18:15
There should be no logic change. Just moving the code in separate methods
and directly check the condition instead of checking in the activity.

Most of the time this will safe jumping between activities and service
as permissions are only requested the first time.
This helps when automating the start process of a session.
@Niels-Be
Copy link
Author

Niels-Be commented Oct 18, 2024

@bk138 sorry about that. There is an option to hide those in the UI but I pushed again without whitespace changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants