aboutsummaryrefslogtreecommitdiffhomepage
path: root/platform_tools/android/bin/android_run_skia
blob: f958b7684002f3e24077b689c8b881f53f8bbb7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/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