#!/bin/bash set -xeuo pipefail # keymap: https://stackoverflow.com/questions/7789826/adb-shell-input-events export ADB_SERVER_SOCKET=localfilesystem:/run/adb function keys () { string= for i in $@ do string="$string input keyevent $i ;" done adb shell $string } until ADB_SERVER_SOCKET=localfilesystem:/run/adb adb shell dumpsys notification | grep com.carriez.flutter_hbb | grep NotificationRecord do while adb shell dumpsys window | grep mDreamingLockscreen=true # https://stackoverflow.com/a/60037241/11293716 do keys KEYCODE_POWER KEYCODE_HOME adb shell input text 4444 done adb shell monkey -p com.carriez.flutter_hbb -c android.intent.category.LAUNCHER 1 adb shell input tap 1000 2500 # the tablet must be in portrait mode!!! adb shell input tap 400 400 # adb shell input tap 1300 1400 # the tablet must be in portrait mode!!! keys KEYCODE_ENTER adb shell input tap 1000 2450 # the tablet must be in portrait mode!!! done