Skip to content

Instantly share code, notes, and snippets.

@am3n
Forked from y-polek/doze_mode_adb_commands.sh
Last active September 24, 2021 12:46
Show Gist options
  • Save am3n/f70ddc493b73e6fa500cd2e887334df3 to your computer and use it in GitHub Desktop.
Save am3n/f70ddc493b73e6fa500cd2e887334df3 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
# 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 Deep Doze mode (should be called several times to pass all phases)
adb shell dumpsys deviceidle step deep
# Forced enter Deep Doze mode
adb shell dumpsys deviceidle force-idle
# Active & Deactive app
adb shell am set-inactive <PackageName> < true or false >
# Get Active/Deactive status
adb shell am get-inactive <PackageName>
# Check if app running
adb shell pidof <PackageName>
# Monitor the top 10 processes
adb shell top -m 10
# Or record this for one minute and collect the output to a file on your computer
adb shell top -m 10 -s cpu -n 20 | tee top.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment