Corey Ogburn
Corey Ogburn

Reputation: 24769

How to force Doze on Marshmallow?

Everything seems to point to these two commands:

adb shell dumpsys battery unplug
adb shell dumpsys deviceidle step

I followed the instructions on my Nexus 6 running the Marshmallow official release. I plug in my phone to my test machine. I set up my app for testing the piece I want to test with doze. I turn off my screen. After running battery unplug above I get no output so I assume it works, but every time I run deviceidle step the output is always Stepped to: ACTIVE.

I'm not sure if it matters, but the particular feature of my app I'm trying to test is an alarm I'm setting that should wake the phone out of Doze. I'm wanting my device to be mid-doze when my PendingIntent scheduled by AlarmManager.setAlarmClock goes off. Could that prevent my device from entering Doze?

Upvotes: 8

Views: 5680

Answers (2)

prGD
prGD

Reputation: 1511

use below commands to force idle you device.

To unplug battery

adb shell dumpsys battery unplug

You can use below commands to Force Idle state

adb shell dumpsys deviceidle force-idle
or
adb shell dumpsys deviceidle enable

Check you are in doze more or not with below command

adb shell dumpsys deviceidle enabled 

disable mode:

adb shell dumpsys deviceidle disable 

Reset device battery status:

adb shell dumpsys battery reset

Upvotes: 19

Kris Sebesta
Kris Sebesta

Reputation: 1

The Greenify app has an experimental feature to instantly turn on Doze mode when the screen turns off. You might need root for this however. Greenify runs in root AND non-root modes. Hope this helps. Good luck!

Upvotes: 0

Related Questions