How to force Doze on Marshmallow?
Asked Answered
A

2

8

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?

Aerometer answered 30/10, 2015 at 15:21 Comment(5)
setAlarmClock() reportedly blocks Doze mode for a window of time before the event goes off.Blythe
I've seen that alarms set using setAlarmClock() are unaffected by Doze, but I haven't read anything about this "pre-awaking" window before the alarm goes off. Is there a link about those specifics?Aerometer
https://mcmap.net/q/353583/-wakelock-and-doze-mode #33110746Blythe
A whole hour. Wow. As much as I believe that (no sarcasm intended, truthfully that seems to agree with my tests), it would be nice if Google had some documentation that says that.Aerometer
Please check this answer.Habit
E
19

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
Encamp answered 6/7, 2016 at 16:34 Comment(0)
B
0

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!

Baldhead answered 24/5, 2016 at 12:49 Comment(1)
I'm testing the doze mode with the ADB commands, now I accidentaly trigger this feature you've mentioned: instantly turn on Doze mode when the screen turns off. I want to remove this, how can I do it?Melioration

© 2022 - 2024 — McMap. All rights reserved.