1#!/bin/bash 2# 3# android_install_app: installs the Skia development apps on the device. 4 5function print_usage { 6 echo "USAGE: android_install_app [options]" 7 echo " Options: -f Forces the package to be installed by removing any" 8 echo " previously installed packages" 9 echo " -h Prints this help message" 10 echo " -s [device_s/n] Serial number of the device to be used" 11} 12 13SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 14 15source $SCRIPT_DIR/utils/android_setup.sh 16source $SCRIPT_DIR/utils/setup_adb.sh 17 18forceRemoval="false" 19 20for arg in ${APP_ARGS[@]}; do 21 if [[ "${arg}" == "-f" ]]; then 22 forceRemoval="true" 23 elif [[ "${arg}" == "-h" ]]; then 24 print_usage 25 exit 26 elif [[ ${arg} == '-'* ]]; then 27 echo "ERROR: unrecognized option ${arg}" 28 print_usage 29 exit 1; 30 fi 31done 32 33APP_LC=$(echo Viewer | tr "[:upper:]" "[:lower:]") 34 35if [[ "$forceRemoval" == "true" ]]; 36then 37 echo "Forcing removal of previously installed packages" 38 $ADB ${DEVICE_SERIAL} uninstall org.skia.${APP_LC} > /dev/null 39fi 40 41echo "Installing ${APP_LC} from ${SKIA_OUT}/${APP_LC}.apk" 42$ADB ${DEVICE_SERIAL} install -r ${SKIA_OUT}/${APP_LC}.apk 43 44