* Which version of the SDK are you using? M preview 2 * Which Android build are you using? (e.g. MPZ44Q) MPZ79M * What device are you using? Nexus 5
On http://developer.android.com/preview/testing/guide.html#doze-standby it says to test Doze do the following: 1.Configure a hardware device or virtual device with a M Preview system image. 2.Connect the device to your development machine and install your app. 3.Run your app and leave it active. 4. $ adb shell dumpsys battery unplug $ adb shell dumpsys deviceidle step $ adb shell dumpsys deviceidle -h
When doing these, the output states "Stepped to: ACTIVE" and there is no relevant logcat information to inform us that we've entered doze or that anything has changed at all. Also, it'd be nice to know which system properties we should enable to get verbose logging from Doze (I've tried setting properties of log.tag.[DozeLog|DozeParameters|DozeService] and I'm not getting any logs).
What I've discovered is that one needs to actually do the following in order to get the device to enter an idle state (which I'm assuming is what doze eventually does): $ adb shell dumpsys deviceidle disable $ adb shell dumpsys deviceidle enable $ adb shell dumpsys battery unplug turn the screen off $ adb shell dumpsys deviceidle step => output will be Stepped to: IDLE_PENDING $ adb shell dumpsys deviceidle step => output will be Stepped to: SENSING $ adb shell dumpsys deviceidle step => output will be Stepped to: IDLE $ adb shell dumpsys deviceidle step => output will be Stepped to: IDLE_MAINTENANCE
Following steps will alternate between IDLE and IDLE_MAINTENANCE
Please let me know if this is actually mocking the effects of a doze or if I'm off course.
Comment #1
Posted on Aug 13, 2015 by Massive Elephant(No comment was entered for this change.)
Comment #2
Posted on Aug 13, 2015 by Massive ElephantHi, Thank you for reporting this issue. We have passed this on to the development team and will update this issue with more information as it becomes available.
Comment #3
Posted on Oct 5, 2015 by Happy HippoAre there additional instructions needed for the Android M emulator?
It reports deviceidle ENABLED, screen off, not charging, and not moving, but won't enter the IDLE state.
$ adb shell dumpsys deviceidle Settings: inactive_to=+30m0s0ms sensing_to=+5m0s0ms motion_inactive_to=+10m0s0ms idle_after_inactive_to=+30m0s0ms idle_pending_to=+5m0s0ms max_idle_pending_to=+10m0s0ms idle_pending_factor=2.0 idle_to=+60m0s0ms max_idle_to=+6h0m0s0ms idle_factor=2.0 min_time_to_alarm=+60m0s0ms max_temp_app_whitelist_duration=+5m0s0ms mms_temp_app_whitelist_duration=+60s0ms sms_temp_app_whitelist_duration=+20s0ms Whitelist (except idle) system apps: com.android.providers.downloads Whitelist (except idle) all app ids: 10005 mEnabled=true mForceIdle=false mSigMotionSensor=null mCurDisplay=Display id 0: DisplayInfo{"Built-in Screen", uniqueId "local:0", app 1080 x 1776, real 1080 x 1920, largest app 1794 x 1704, smallest app 1080 x 1008, mode 1, defaultMode 1, modes [{id=1, width=1080, height=1920, fps=60.000004}], rotation 0, density 480 (480.0 x 480.0) dpi, layerStack 0, appVsyncOff 0, presDeadline 17666666, type BUILT_IN, state OFF, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS}, DisplayMetrics{density=3.0, width=1080, height=1776, scaledDensity=3.0, xdpi=480.0, ydpi=480.0}, isValid=true mScreenOn=false mCharging=false mSigMotionActive=false mState=ACTIVE mInactiveTimeout=+30m0s0ms
$ adb shell dumpsys deviceidle force-idle Unable to go idle; stopped at ACTIVE $ adb shell dumpsys deviceidle step Stepped to: ACTIVE $ adb shell dumpsys deviceidle step Stepped to: ACTIVE
Comment #4
Posted on Oct 5, 2015 by Happy HippoAha. I was testing to see if an AlarmManager#setAlarmClock() alarm wakes from IDLE mode, but it seems that an alarm-clock within 2 hours keeps the device from entering IDLE mode.
The instructions work after turning off the alarm.
Comment #5
Posted on Oct 15, 2015 by Massive ElephantThere is no need to disable/enable. And correct, you do need to make sure the screen is off before stepping in to idle mode.
Also newer builds have an easier way to do this:
09:53:36-master-base$ adb shell dumpsys deviceidle force-idle Now forced in to idle mode
No need to unplug from power, no need to wait for the screen to turn off
Comment #6
Posted on Oct 15, 2015 by Massive Elephant(No comment was entered for this change.)
Comment #7
Posted on Oct 15, 2015 by Grumpy Lion@amruthav: force-idle works great! Any chance we can get the developer docs updated?
Status: PreviousRelease
Labels:
Type-Defect
Release-M
Defect-23169203