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

issue with Android power saving modes #34

Closed
inos-github opened this issue Sep 14, 2019 · 10 comments
Closed

issue with Android power saving modes #34

inos-github opened this issue Sep 14, 2019 · 10 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@inos-github
Copy link

on my Xiaomi Phone, some power saving modes are enabled by default. As a consequence the Hauk-App is terminated after some time if running in background. To solve this, at least a hint to disable power saving mode for the app would be useful...

Additionally restarting the app does not reconnect to the previous session. In other words, the Hauk-App is not aware of another share already running and control over the share is lost.

@bilde2910 bilde2910 added the enhancement New feature or request label Sep 14, 2019
@bilde2910
Copy link
Owner

bilde2910 commented Sep 14, 2019

This seems to vary a lot between different manufacturers, and I don't think there's a standardized way to turn off or even detect whether such power saving features exist. I'd either have to maintain a whitelist of manufacturers that will show such a warning, or show it for every device regardless of manufacturer. If there is a way to easily maintain a whitelist, then I think that may be the best option.

Additionally restarting the app does not reconnect to the previous session. In other words, the Hauk-App is not aware of another share already running and control over the share is lost.

This is implemented in the upcoming v1.1.1 (see #28).

@inos-github
Copy link
Author

This seems to vary a lot between different manufacturers, and I don't think there's a standardized way to turn off or even detect whether such power saving features exist.

That's why some other apps I know are using just a hint at the first start welcome screen to make the user aware of this...

This is implemented in the upcoming v1.1.1 (see #28).

Thank's!

@RuralYak
Copy link
Contributor

In MIUI there is an option not to apply any power saving policies to app. One can change it in app settings.

@bilde2910
Copy link
Owner

I'm looking into enabling a warning message on a per-manufacturer/per-ROM basis. In order to do that for Xiaomi/MIUI, as I don't have such a device myself, can you help me out by pasting or screenshooting your device's build number? This should be in "Settings > About phone" (typically at the bottom of the settings menu) on most Android devices.

Furthermore, I believe I can add a button to the warning notification that opens the settings menu for the user directly. That way, they don't have to go look for it in settings. I have implemented this for OnePlus (as I have a OnePlus device and can verify that it works). I don't know if this is feasible for Xiaomi. To figure that out, I need someone who has both a Xiaomi device and a computer running Linux to run a couple of commands for me. Until then, I can still add a warning that just tells the user how to do it manually instead.

@RuralYak
Copy link
Contributor

Hi there, here is how xaomi abouts look like:

Screenshot_2019-09-17-19-04-59-308_com android settings

@bilde2910
Copy link
Owner

I've put the groundwork in for this feature and it works for OnePlus and Huawei devices now, but I have yet to find someone who has a Xiaomi device that I can get the proper debug data from via adb. If anyone has a Xiaomi device and would like to help me test this, feel free to reach out.

@bilde2910 bilde2910 added the help wanted Extra attention is needed label Oct 16, 2019
@natrius
Copy link
Contributor

natrius commented Oct 21, 2019

Ouh, did not see that one. Xiaomi Mi 9 here with EU-Rom. Running KDE neon as well. What do you need?

@bilde2910
Copy link
Owner

bilde2910 commented Oct 22, 2019

Xiaomi Mi 9 here with EU-Rom

I assume this is stock ROM? Stock ROM (e.g. MIUI) is what I need to fix the issue.

I need to run adb logcat -e "Displayed|START" against the device via adb from a computer (USB debugging). The logcat will produce a lot of unnecessary output when you run it. After the output stream dies down, you'll have to open the system settings menu and find where the per-app battery savings are located. I don't have a Xiaomi device, so I don't know exactly what it's called - but it's where you'd go to exclude an app from the list. As mentioned by @RuralYak:

In MIUI there is an option not to apply any power saving policies to app. One can change it in app settings.

This is the setting that you'll need to find and open, while logcat is running. On my OnePlus device, the output looks like this:

~$ adb logcat -e "Displayed|START"
[... a flood of old/unnecessary output here ...]
10-22 15:01:57.880  1150  6824 I ActivityManager: START u0 {act=android.settings.SETTINGS flg=0x14000000 cmp=com.android.settings/.Settings} from uid 10019 pid 3140
10-22 15:01:58.026  1150  1252 I ActivityManager: Displayed com.android.settings/.Settings: +97ms
10-22 15:02:00.796  1150  6824 I ActivityManager: START u0 {flg=0x8000 cmp=com.android.settings/.Settings$PowerUsageSummaryActivity (has extras)} from uid 1000 pid 23142
10-22 15:02:00.916  1150  1252 I ActivityManager: Displayed com.android.settings/.Settings$PowerUsageSummaryActivity: +83ms
10-22 15:02:05.219  1150  4702 I ActivityManager: START u0 {act=com.android.settings.action.BACKGROUND_OPTIMIZE cmp=com.android.settings/.Settings$BgOptimizeAppListActivity (has extras)} from uid 1000 pid 23142
10-22 15:02:05.339  1150  1252 I ActivityManager: Displayed com.android.settings/.Settings$BgOptimizeAppListActivity: +75ms

I need the output from logcat to find out how to launch that screen programmatically from the app. If you can send me the output, I'll give you another command you can run via adb to verify if my proposed fix would work.

@bilde2910
Copy link
Owner

I have finally found someone with a Xiaomi device to help me out. I was unable to test the solution due to needing a Xiaomi account to install apps via adb, but I see no reason it shouldn't work.

This will be live in v1.3.1.

@bilde2910
Copy link
Owner

I've tagged the v1.3.1 release. It should appear in F-Droid within a few days to a week.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants