9

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
Floern
  • 33,559
  • 24
  • 104
  • 119
Veener
  • 4,771
  • 2
  • 29
  • 37

2 Answers2

11

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
Mattia Maestrini
  • 32,270
  • 15
  • 87
  • 94
8

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.

Oggy
  • 1,516
  • 1
  • 16
  • 22
  • I have the case where this is different for the S6 Neo & S5 Active. On the S6 Neo the device is correctly prevented from going into IDLE modus, but the S5 goes into IDLE and cannot be awoken. Any known workaround? – M3-n50 Mar 24 '17 at 08:54
  • @M3-n50 can you be more specific when you say the S5 cannot be woken? How are you trying to wake it up? What version of Android is it running? – Oggy Mar 24 '17 at 14:33
  • It's currently running 5.0. The situation atm is that the S6 (6.0) is currently prevented from going into IDLE (which is good). On the 5.0 with the same method it's going into IDLE mode and is having a delay of 5 minutes. What currently works on the S5 (5.0) is using setRepeating, which is weird because from what I read I understand this should not be working from 4.0 and up (at least not if it's too frequent). – M3-n50 Mar 27 '17 at 07:53
  • Doze mode was introduced in Android 6 ([Doze mode](https://developer.android.com/training/monitoring-device-state/doze-standby.html)). In previous versions there are no methods like setAndAllowWhileIdle(). Before you add your intent to the alarm manager you should check the version of Android. In other words, if Build.VERSION.SDK_INT is lower than 23 you should add your intent with setExact and RTC_WAKEUP. – Oggy Mar 27 '17 at 14:23
  • Oh, you're right, my bad. BTW I do check the SDK version and setExact with RTC_WAKEUP doesn't work. I have to use the old method setRepeating for that device specifically which is weird. – M3-n50 Mar 28 '17 at 09:22
  • @M3-n50, does your alarm broadcast receiver obtain a wake lock immediately in the onReceive event? – Oggy Mar 28 '17 at 11:51
  • @Orilux Worked for me – Imran Khan Saifi Jun 29 '18 at 07:25