aboutsummaryrefslogtreecommitdiffhomepage
path: root/platform_tools/android/bin/android_launch_app
blob: c1eb0b4fb021d9e1d55e5edfeeb615d9da8821d2 (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
#!/bin/bash
#
# android_launch_app: Launches the skia sampleApp on the device.

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/android_setup.sh
source $SCRIPT_DIR/utils/setup_adb.sh

# TODO: check to ensure that the app exists on the device and prompt to install

if [[ -n $RESOURCE_PATH ]]; then
  adb_push_if_needed "${SKIA_SRC_DIR}/resources" $RESOURCE_PATH
fi

app=${APP_ARGS[0]}
if [[ ${app} == '-'* ]]; then
    echo "Defaulting to running SampleApp."
    app="SampleApp"
    APP_ARGS=( "SampleApp" ${APP_ARGS[*]} )
fi

if [[ ${app} == 'SampleApp' ]]; then
    activity="com.skia.sample_app/com.skia.SkiaSampleActivity"
elif [[ ${app} == "VisualBench" ]] ; then
    activity="org.skia.viewer/org.skia.viewer.ViewerActivity"
else
    echo "ERROR: supports either 'SampleApp' or 'Viewer' as valid apps"
    exit 1
fi
$ADB ${DEVICE_SERIAL} shell "am start -S -n ${activity} --es cmdLineFlags \"${APP_ARGS[*]:1}\""