aboutsummaryrefslogtreecommitdiffhomepage
path: root/platform_tools/android/bin/android_install_skia
blob: da16b1ab7a6015bdee0326cd94958e12c900ca46 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
#
# android_install_skia: installs the skia apk on the device.

function print_usage {
  echo "USAGE: android_install_skia [options]"
  echo " Options:         -f  Forces the package to be installed by removing any"
  echo "                      previously installed packages"
  echo "                  -h  Prints this help message"
  echo "  --install-launcher  Remounts the system partition and installs the"
  echo "                      skia_launcher binary on the device"
  echo "            --release Install the release build of Skia"
  echo "      -s [device_s/n] Serial number of the device to be used"
}

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

source $SCRIPT_DIR/utils/setup_adb.sh
source $SCRIPT_DIR/utils/setup_skia_out.sh

forceRemoval="false"
installLauncher="false"
installOptions="-r"
configuration="Debug"
serialNumber=""

while (( "$#" )); do

  if [[ "$1" == "-f" ]];
  then
    forceRemoval="true"
  elif [[ "$1" == "-h" ]];
  then
    print_usage
    exit
  elif [[ "$1" == "--install-launcher" ]];
  then
    installLauncher="true"
  elif [[ "$1" == "-r" ]];
  then
    echo "DEPRECATED: -r is now a no-op"
  elif [[ "$1" == "--release" ]];
  then 
    configuration="Release"
  elif [[ "$1" == "-s" ]];
  then 
    if [[ $# -lt 2 ]];
    then
      echo "ERROR: missing serial number"
      exit 1;
    fi
    serialNumber="-s $2"
    shift
  else
    echo "ERROR: unrecognized option $1"
    print_usage
    exit 1;
  fi

shift
done

if [[ "$forceRemoval" == "true" ]];
then
    echo "Forcing removal of previously installed packages"
    $ADB ${serialNumber} uninstall com.skia > /dev/null
fi

if [[ "$installLauncher" == "true" ]];
then
    echo "Installing skia_launcher binary"
    $ADB ${serialNumber} root
    $ADB ${serialNumber} remount
    $ADB ${serialNumber} push ${SKIA_OUT}/${configuration}/skia_launcher /system/bin
fi

echo "Installing Skia App from ${SKIA_OUT}/${configuration}"
$ADB ${serialNumber} install ${installOptions} ${SKIA_OUT}/${configuration}/android/bin/SkiaAndroid.apk