26

I followed steps described here:

https://developer.android.com/preview/testing/guide.html#doze-standby

Circumstances:

  • Android Debug Bridge version 1.0.32

  • Nexus 9 with Preview M

Shell:

$ adb shell dumpsys battery unplug

=> worked, device unplugged

$ adb shell dumpsys deviceidle step

=> Output: Stepped to: ACTIVE

$ adb shell dumpsys deviceidle -h

=> does not work => Output:

Device idle controller (deviceidle) dump options:

[-h] [CMD]

-h: print this help text.

Commands:

step

disable

enable

whitelist

I tried it with:

adb shell dumpsys deviceidle enable

But it didn't work.

So my question, as mentioned above, how to shift the device in Doze-Mode? What did i make wrong?

EDIT - JUNE, 2016:

New Link: https://developer.android.com/training/monitoring-device-state/doze-standby.html

A.D.
  • 1,412
  • 2
  • 19
  • 37
  • 1
    I would suggest moving your solution out of the question body, and into a new answer. Then accept this new answer as the correct answer. This helps indicate that this question has been solved so that the system and other users can easily see that a solution is available! – Scott W Sep 16 '15 at 14:49
  • Thx, i've done this. – A.D. Sep 17 '15 at 06:34
  • Above Link is broke, new link is added, see edit. – A.D. Jun 18 '16 at 10:45

5 Answers5

42

There is a better way to achieve this in the new releases:

$ adb shell dumpsys deviceidle force-idle

No need to unplug from power, no need to wait for the screen to turn off.

Greg Ennis
  • 14,917
  • 2
  • 69
  • 74
Piyush
  • 1,744
  • 1
  • 15
  • 28
22

Ok, i got it. The trick was to turn the screen off! After that

$ adb shell dumpsys deviceidle step outputs:

IDLE_PENDING

then

SENSING

then

IDLE

then

IDLE_MAINTENANCE

then

IDLE

then

IDLE_MAINTENANCE

and so on...

Many thanks to this site:

https://newcircle.com/s/post/1739/2015/06/12/diving-into-android-m-doze

A.D.
  • 1,412
  • 2
  • 19
  • 37
  • 1
    Also, the command `adb shell dumpsys deviceidle` is useful to see the current state including the prerequisites for IDLE (enabled, not moving, not charging, screen off). E.g. whether you need yet another tap on the emulator's power button to get mScreenOn=false. – Jerry101 Oct 05 '15 at 05:54
  • Does not work without: `adb shell dumpsys battery unplug` – sapeg Jun 09 '22 at 11:07
4

Yes, it appears that Google's developer testing guideline is incorrect. I just recently discovered this as well and posted a bug about it here with the correct steps to get the device to idle (aka doze).

user
  • 23,260
  • 9
  • 113
  • 101
Reuben Tanner
  • 5,229
  • 3
  • 31
  • 46
1
$ adb shell dumpsys deviceidle -h

This command only outputs a help message like common unix program.

IDLE means Doze mode. In the article you linked, you can regard Doze mode as device idle mode.

Amit Joshi
  • 15,448
  • 21
  • 77
  • 141
0

You can find my full answer posted on the similar topic here: How to test Doze Mode on Android?

Idle State - In order to put the device into an Idle state you can use the following adb commands:

>adb shell dumpsys battery unplug
>adb shell dumpsys deviceidle force-idle

Active State - In order to put the device back into the Active state you may simulate the following key event:

> adb shell input keyevent KEYCODE_WAKEUP

I also needed a quick option to toggle between Active and Idle states so I wrote a batch script adbIdleModeSwitch.bat for these purposes, you may download and use it: https://drive.google.com/file/d/0B81qFnPX_eUUYTMxOTd1UG94NVk/view

AivarsDa
  • 326
  • 3
  • 7