Home | History | Annotate | Download | only in bin
      1 #!/bin/bash
      2 #
      3 # android_install_app: installs the Skia development apps on the device.
      4 
      5 function 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 
     13 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
     14 
     15 source $SCRIPT_DIR/utils/android_setup.sh
     16 source $SCRIPT_DIR/utils/setup_adb.sh
     17 
     18 forceRemoval="false"
     19 
     20 for 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
     31 done
     32 
     33 APP_LC=$(echo Viewer | tr "[:upper:]" "[:lower:]")
     34 
     35 if [[ "$forceRemoval" == "true" ]];
     36 then
     37     echo "Forcing removal of previously installed packages"
     38     $ADB ${DEVICE_SERIAL} uninstall org.skia.${APP_LC} > /dev/null
     39 fi
     40 
     41 echo "Installing ${APP_LC} from ${SKIA_OUT}/${APP_LC}.apk"
     42 $ADB ${DEVICE_SERIAL} install -r ${SKIA_OUT}/${APP_LC}.apk
     43 
     44