blob: f958b7684002f3e24077b689c8b881f53f8bbb7b [file] [log] [blame]
#!/bin/bash
#
# android_run_skia: starts the correct skia program on the device, prints the
# output, and kills the app if interrupted.
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/utils/setup_adb.sh
APP_ARGS=""
USE_INTENT="false"
SERIAL=""
while (( "$#" )); do
if [[ "$1" == "--intent" ]];
then
USE_INTENT="true"
elif [[ "$1" == "-s" ]];
then
if [[ $# -lt 2 ]];
then
echo "ERROR: missing serial number"
exit 1;
fi
SERIAL="-s $2"
shift
else
APP_ARGS="$APP_ARGS $1"
fi
shift
done
if [[ "$USE_INTENT" == "true" ]];
then
$ADB logcat -c
$ADB $SERIAL shell am broadcast -a com.skia.intent.action.LAUNCH_SKIA -n com.skia/.SkiaReceiver -e args "$APP_ARGS"
trap "echo \"Interrupt.\"" INT
eval "($ADB logcat)"
trap - INT
echo "Interrupt. Killing Skia process..."
$SCRIPT_DIR/android_kill_skia
echo "Done."
else
$ADB $SERIAL shell skia_launcher $APP_ARGS
fi