1

I need to test whether an app behaves correctly after restoring from Doze / App standby. The thing is that when I use commands from the Android Developers site, nothing happens with either the app nor with the device itself. The command prompt seems to respond correctly though.

Commands for Doze:

adb shell dumpsys deviceidle unforce
adb shell dumpsys battery reset

Commands for App Standby:

adb shell dumpsys battery unplug
adb shell am set-inactive <packageName> true

Wake up from App Standby:

adb shell am set-inactive <packageName> false
adb shell am get-inactive <packageName>

https://developer.android.com/training/monitoring-device-state/doze-standby.html#testing_doze_and_app_standby

Do you think that if nothing bad happens to the app, it means that it is behaving correctly? Or have I made some mistakes during the tests? I'm asking because from what I've read on the internet, the Doze should trigger with at least locked screen, so it all looks suspicious to me. I don't have any other ideas how to confirm whether these commands actually work.

Michael Dodd
  • 10,102
  • 12
  • 51
  • 64

1 Answers1

0

With the Doze test, make sure you force the system into idle mode by running the following command first:

adb shell dumpsys deviceidle force-idle

But otherwise the commands you are running look correct.

You primarily want to test that the app returns to a good state after being in Doze or App Standby mode, and that any restrictions in place during that mode are lifted. The restrictions Doze and App Standby may impose on apps include limited or no network access, suspended background tasks, suspended Notifications, ignored wake requests, and alarms.

If your app can send notifications or trigger alarms, you can test that those are blocked during this mode.

According to the Android docs:

Observe the behavior of your app when it is woken. Make sure it recovers gracefully from standby mode. In particular, you should check if your app's Notifications and background jobs continue to function as expected.

Lorn
  • 194
  • 1
  • 5