-
-
Save whileloop99/eef126773f8b9ce0029d675d85280549 to your computer and use it in GitHub Desktop.
adb commands to test Doze mode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/zsh | |
# | |
# https://developer.android.com/training/monitoring-device-state/doze-standby | |
# https://stackoverflow.com/questions/31533972/how-to-shift-device-in-doze-mode-android-preview-m-marshmallow | |
# Buttery powered state | |
adb shell dumpsys battery | grep powered | |
# Unplug battery | |
adb shell dumpsys battery unplug | |
# Reset battery | |
adb shell dumpsys battery reset | |
# Dump Doze mode info | |
adb shell dumpsys deviceidle | |
# Enable Doze mode (may be required on Android Emulator) | |
adb shell dumpsys deviceidle enable | |
# Get status of Light Doze mode | |
adb shell dumpsys deviceidle get light | |
# Get status of Deep Doze mode | |
adb shell dumpsys deviceidle get deep | |
# Enter Light Doze mode (should be called several times to pass all phases) | |
adb shell dumpsys deviceidle step light | |
# Enter Light Doze mode (should be called several times to pass all phases) | |
adb shell dumpsys deviceidle step deep | |
# Force the system into idle mode | |
adb shell dumpsys deviceidle force-idle | |
# Exit idle mode | |
adb shell dumpsys deviceidle unforce | |
# | |
# Testing your app with App Standby | |
# To test the App Standby mode with your app: | |
# Configure a hardware device or virtual device with an Android 6.0 (API level 23) or higher system image. | |
# Connect the device to your development machine and install your app. | |
# Run your app and leave it active. | |
# Force the app into App Standby mode by running the following commands: | |
$ adb shell dumpsys battery unplug | |
$ adb shell am set-inactive <packageName> true | |
# Simulate waking your app using the following commands: | |
$ adb shell am set-inactive <packageName> false | |
$ adb shell am get-inactive <packageName> | |
# Observe the behavior of your app after waking it. Make sure the app recovers gracefully from standby mode. | |
# In particular, you should check if your app's Notifications and background jobs continue to function as expected. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment