- 
      
- 
        Save skinnydoo/d24f5da25c3ba69442f5920950a596df 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 | |
| # 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