Diffy Diffy - 4 months ago 28
Android Question

Testing doze and standby mode

I switched off the screen display of my Nexus 5 device running Android M and then issued the following commands.

im17-x0:~ r.j$ adb shell dumpsys battery unplug
im17-x0:~ r.j$ adb shell dumpsys deviceidle step
Stepped to: IDLE_PENDING
im17-x0:~ r.a$ adb shell dumpsys deviceidle step
Stepped to: SENSING
im17-x0:~ r.a$ adb shell dumpsys deviceidle step
Stepped to: IDLE


Now ideally my device should go to idle mode. But i started a
CountDownTimer
before putting it in idle mode and its still running.
Also the network access is still there in my phone ( checked using this function)

Why is the device not going in doze mode? Following the options from here for standby mode also has the same effect. Why?

Also in that timer,if i check for
isDeviceIdleMode()
, it returns true.

Answer

As of now, the behavior looks like this

  1. isDeviceIdleMode() will return true.
  2. Network availability check in the app always returns true.( Checked using this function)
  3. There is no change in the network (no network broadcast fired ) when a device enters and comes out of doze mode. However, there is a broadcast fired(doze broadcast) when the device goes into and comes out of doze mode.
  4. However we can’t make a network call in doze mode.( Tried using HttpUrlConnection)

For getNetworkInfo() returning true in doze mode, there is a bug reported in Android (Link)