Files

25 lines
600 B
Bash

#!/usr/bin/env bash
# android_app_kill — Force-stop a running Android app via am force-stop.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=adb_wsl.sh
source "$SCRIPT_DIR/adb_wsl.sh"
android_app_kill() {
local serial pkg
adb_pick_serial "$@" || exit 3
local serial="$ADB_PICK_SERIAL"
set -- "${ADB_PICK_REST[@]}"
pkg="${1:?android_app_kill: package name required}"
adb_s "$serial" shell am force-stop "$pkg"
echo "killed $pkg on $serial"
}
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
android_app_kill "$@"
fi