Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: completely disabling deviceidle ("Doze") in Android M?

In a rooted Android M device, I want to completely disable deviceidle mode ("Doze"), all the time. Yes, I know this affects my battery life, and that's fine with me.

I know that I can invoke the following:

dumpsys deviceidle disable

However, I haven't been able to find detailed docs for that subcommand. Does it actually disable "Doze" completely and permanently on my device (or at least until the next boot), or does it perform some other related function?

If that "dumpsys deviceidle disable" command isn't the way to permanently disable "Doze", is there some other way, perhaps via the Android Java API? Actually, a Java-API solution would be ideal, if one exists.

like image 746
HippoMan Avatar asked Oct 23 '16 15:10

HippoMan


People also ask

How do I turn off doze mode on my Samsung?

Tap the Options menu button (the three dots in the upper right), then tap Battery optimization. Tap the downward-pointing arrow, then tap All apps from the menu that appears. Next, tap the PsyMate app for which you want to switch off Doze mode, and in the box that appears, tap Don't optimize.

Does Internet work in doze mode?

Network access is disabled in doze mode, regardless if your application is ignoring battery optimizations. The only way to wake-up your device from doze mode and to get network access is by sending a high priority Google Cloud Message to your application.


2 Answers

If anyone likes to know, to change something in the whitelist:

adb shell dumpsys deviceidle whitelist +com.app.package

(I assume '-com.app.package' will remove one)

Currently on Huawei P Smart 2019 with android 10, that change sticks after reboot.

also: https://dontkillmyapp.com/ for more app-killers

like image 140
SomeOne_1 Avatar answered Sep 20 '22 06:09

SomeOne_1


That command disables Doze mode even without root, but then you will have to execute the commands again after reboot. Some people also use another command to enable the doze whitelist, as it seems that Marshmallow has it disabled by default and it does nothing.

adb shell dumpsys deviceidle disable
adb shell dumpsys deviceidle whitelist

If you have root, you can download an app to execute this script every time on system boot, effectively disabling Doze mode forever.

like image 26
Carlos Hoyos Avatar answered Sep 20 '22 06:09

Carlos Hoyos