Created
November 22, 2016 06:17
-
-
Save brozikcz/754558d08ae2c543c25cf31946711391 to your computer and use it in GitHub Desktop.
bash script for dozing android device
This file contains 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/bash | |
adb shell dumpsys deviceidle |grep "mScreenOn=true" > /dev/null | |
if [ "$?" -eq "0" ]; then | |
adb shell input keyevent POWER | |
sleep 2 | |
fi | |
adb shell dumpsys battery |grep "USB powered: true" > /dev/null | |
if [ "$?" -eq "0" ]; then | |
adb shell dumpsys battery unplug | |
fi | |
stat=$(adb shell dumpsys deviceidle |grep "mState=IDLE") | |
until [[ $stat == *"IDLE"* && $stat != *"IDLE_"* ]]; do | |
stat=$(adb shell dumpsys deviceidle step) | |
echo -e $stat | |
done | |
echo "Welcome to dreamland!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Or use
adb shell dumpsys deviceidle force-idle