-
-
Save reime005/f77dac5c193bd3f91b7c5f25b34e4ff7 to your computer and use it in GitHub Desktop.
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 | |
echo "" | |
echo "[Waiting for launcher to start]" | |
LAUNCHER_READY= | |
while [[ -z ${LAUNCHER_READY} ]]; do | |
UI_FOCUS=`adb shell dumpsys window windows 2>/dev/null | grep -i mCurrentFocus` | |
echo "(DEBUG) Current focus: ${UI_FOCUS}" | |
case $UI_FOCUS in | |
*"Launcher"*) | |
LAUNCHER_READY=true | |
;; | |
"") | |
echo "Waiting for window service..." | |
sleep 3 | |
;; | |
*"Not Responding"*) | |
echo "Detected an ANR! Dismissing..." | |
adb shell input keyevent KEYCODE_DPAD_DOWN | |
adb shell input keyevent KEYCODE_DPAD_DOWN | |
adb shell input keyevent KEYCODE_ENTER | |
;; | |
*) | |
echo "Waiting for launcher..." | |
sleep 3 | |
;; | |
esac | |
done | |
echo "Launcher is ready :-)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment