Files
skills-public/scripts/android/launch.sh
T

9 lines
501 B
Bash
Executable File

#!/usr/bin/env bash
# Cold-start an app's launcher activity the way Android 17 accepts from the shell. Usage: launch.sh PKG [WAIT] [SHOT.png]
p=$1 w=${2:-6} shot=${3:-}
act=$(adb shell "cmd package resolve-activity --brief -c android.intent.category.LAUNCHER $p" </dev/null | tr -d '\r' | tail -1)
adb shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n '$act'" </dev/null >/dev/null
sleep "$w"
[ -n "$shot" ] && adb exec-out screencap -p > "$shot" </dev/null
true