skia2/platform_tools/android/bin/android_run_skia
2013-05-16 18:12:34 +00:00

49 lines
1005 B
Bash
Executable File

#!/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 $SERIAL 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 $SERIAL logcat)"
trap - INT
echo "Interrupt. Killing Skia process..."
$SCRIPT_DIR/android_kill_skia $SERIAL
echo "Done."
else
$ADB $SERIAL shell skia_launcher $APP_ARGS
fi