How to shift device in Doze Mode (Android Preview M / Marshmallow)?

穿精又带淫゛_ 提交于 2019-11-28 16:02:25

问题


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


回答1:


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.




回答2:


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




回答3:


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).




回答4:


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




回答5:


$ 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.



来源:https://stackoverflow.com/questions/31533972/how-to-shift-device-in-doze-mode-android-preview-m-marshmallow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!