#!/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