Skip to content

Instantly share code, notes, and snippets.

@skinnydoo
Forked from y-polek/doze_mode_adb_commands.sh
Last active May 12, 2022 16:21
Show Gist options
  • Save skinnydoo/d24f5da25c3ba69442f5920950a596df to your computer and use it in GitHub Desktop.
Save skinnydoo/d24f5da25c3ba69442f5920950a596df to your computer and use it in GitHub Desktop.
adb commands to test Doze mode
#! /bin/zsh
# Buttery powered state
adb shell dumpsys battery | grep powered
# Unplug battery
adb shell dumpsys battery unplug
# Force idle while in Doze
adb shell dumpsys deviceidle force-idle
# Exit idle
adb shell dumpsys deviceidle unforce
# 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
# Disable Doze mode (not boot persistent)
adb shell dumpsys deviceidle disable
# 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: ACTIVE -> IDLE -> IDLE_MAINTENANCE -> OVERRIDE)
adb shell dumpsys deviceidle step light
# Enter Deep Doze mode (should be called several times to pass all phases: ACTIVE -> IDLE_PENDING -> SENSING -> LOCATING -> IDLE -> IDLE_MAINTENANCE)
# Once the DEEP-DOZE mode has reached the IDLE state, LIGHT-DOZE mode will have no effect and hence the state is represented as OVERRIDE.
adb shell dumpsys deviceidle step deep
# Whitelist app / turn off optimization
adb shell dumpsys deviceidle whitelist +com.app.package
# Remove app from whitelist / turn on optimization
adb shell dumpsys deviceidle whitelist -com.app.package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment