Nexus 5 won't go into doze mode using ADB - android

I have a Nexus 5 that won't go into Doze/IDLE mode using ADB commands from Windows. It's adb connected using USB cable and it is working for all other ADB commands. The screen is off.
C:\>adb shell dumpsys deviceidle force-idle
Unable to go idle; stopped at ACTIVE
C:\>adb shell dumpsys deviceidle enable
C:\>adb shell dumpsys battery unplug
C:\>adb shell dumpsys deviceidle step
Stepped to: ACTIVE
C:\>adb shell dumpsys deviceidle step
Stepped to: ACTIVE
C:\>adb shell dumpsys deviceidle step
Stepped to: ACTIVE
C:\>adb shell dumpsys deviceidle enable
C:\>adb shell dumpsys deviceidle force-idle
Unable to go idle; stopped at ACTIVE

First you need run this command:
> adb shell dumpsys battery unplug
Then turn off the screen (this step is crucial), otherwise the device remains in ACTIVE state.
After that run this command until the device state changes to IDLE:
> adb shell dumpsys deviceidle step
Stepped to: IDLE_PENDING
> adb shell dumpsys deviceidle step
Stepped to: SENSING
> adb shell dumpsys deviceidle step
Stepped to: LOCATING
> adb shell dumpsys deviceidle step
Stepped to: IDLE

There may be a condition which prevents the phone from going into IDLE, such as a scheduled alarm clock. Make sure there are no alarm clock apps set to go off in less than an hour of you trying to force the phone into IDLE.

Related

Android device not entering deep doze

I am trying to force my device (Redmi S2) running MIUI into deep doze using ADB commands but it doesn't seem to work.
After running
adb shell dumpsys battery unplug
I can go into light doze by using:
adb shell dumpsys deviceidle step light
Stepped to light: IDLE
adb shell dumpsys deviceidle force-idle light
Now forced in to light idle mode
But if I try to enter deep doze, it doesn't work:
adb shell dumpsys deviceidle step deep
Stepped to deep: INACTIVE
adb shell dumpsys deviceidle force-idle deep
Unable to go deep idle; stopped at INACTIVE
Using only
adb shell dumpsys deviceidle step
returns the same output
Stepped to deep: INACTIVE
Any suggestions how to overcome this?

When turn on doze mode on an emulator it doesn't work

When I turn on doze mode on an android emulator using adb shell it just freeze. I cannot reboot it and emulator restarting doesn't help.
I use the following commands for turn doze mode on:
adb shell dumpsys battery unplug
adb shell dumpsys deviceidle step deep
And the following to turn it off:
adb shell input keyevent KEYCODE_WAKEUP
adb shell dumpsys battery reset

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?
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
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!

android adb - how to set emulator to ac power

In an effort to test doze and standby mode im trying to change the battery level and also the set to ac etc using adb and a api 23 emulator.
But when i run the following bash command:
adb shell dumpsys battery set level [95]
i get the following error:
Bad value: [95]
also when i run :
adb shell dumpsys battery set [ac]
i get the following error:
Dump current battery state, or:
set [ac|usb|wireless|status|level|invalid] <value>
unplug
reset
i am assuming meaning it could not find the ac command. How can i change the emulator to ac and also update the battery level ?
update: there is a command adb shell dumpsys battery unplug
to unplug the emulator so should there not be a command to plug it in for AC power ?
there is a command adb shell dumpsys battery unplug to unplug the
emulator so should there not be a command to plug it in for AC power ?
Yes, the command is:
adb shell dumpsys battery set ac 1
To change the level of the battery you can use this command:
adb shell dumpsys battery set level 42
If you'd like to test Doze, I recommend trying the commands directly from the Developer Site here.
The commands to cycle through Doze modes are as follows:
$ adb shell dumpsys battery unplug
$ adb shell dumpsys deviceidle step
$ adb shell dumpsys deviceidle -h
And for testing App Standby:
To force your app into App Standby mode:
$ adb shell dumpsys battery unplug
$ adb shell am set-inactive <packageName> true
To simulate waking your app:
$ adb shell am set-inactive <packageName> false
$ adb shell am get-inactive <packageName>

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

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

Categories

Resources