Skip to content

Commit 7b9613a

Browse files
committed
wip
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
1 parent 075d843 commit 7b9613a

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

scripts/wait_for_emulator.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,20 @@ until [[ "$bootanim" =~ "stopped" ]]; do
2626
done
2727
echo "($checkcounter) Done"
2828

29+
# The bootanim service can stop before the system is fully booted; wait for it so the
30+
# settings below actually stick.
31+
until [[ "$(adb -e shell getprop sys.boot_completed 2>&1 | tr -d '[:space:]')" == "1" ]]; do
32+
sleep 2
33+
done
34+
2935
# Keep the screen awake and unlocked for the whole run. On a headless emulator the
3036
# screen can sleep or keep the keyguard up, which leaves the app window without focus
3137
# and makes Espresso fail with RootViewWithoutFocusException.
38+
# stayon only prevents future sleep, so we also wake the screen and drop the keyguard.
39+
adb -e shell settings put system screen_off_timeout 2147483647
3240
adb -e shell svc power stayon true
41+
adb -e shell input keyevent 224 # KEYCODE_WAKEUP: turn a sleeping screen back on
42+
adb -e shell locksettings set-disabled true
3343
adb -e shell wm dismiss-keyguard
3444
adb -e shell input keyevent 82
3545

0 commit comments

Comments
 (0)