blob: fe16cd52853379cd97d348aac16eaba15c24f446 [file] [log] [blame]
#!/bin/bash
#
# android_install_app: installs the Skia development apps on the device.
function print_usage {
echo "USAGE: android_install_app [options]"
echo " Options: -f Forces the package to be installed by removing any"
echo " previously installed packages"
echo " -h Prints this help message"
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/android_setup.sh
source $SCRIPT_DIR/utils/setup_adb.sh
forceRemoval="false"
for arg in ${APP_ARGS[@]}; do
if [[ "${arg}" == "-f" ]]; then
forceRemoval="true"
elif [[ "${arg}" == "-h" ]]; then
print_usage
exit
elif [[ "${arg}" == "-r" ]]; then
echo "DEPRECATED: -r is now a no-op"
elif [[ ${arg} == '-'* ]]; then
echo "ERROR: unrecognized option ${arg}"
print_usage
exit 1;
fi
done
if [[ "$forceRemoval" == "true" ]];
then
echo "Forcing removal of previously installed packages"
$ADB ${DEVICE_SERIAL} uninstall com.skia > /dev/null
fi
if [[ "$BUILDTYPE" == "Release" ]];
then
apk_suffix="release.apk"
else
apk_suffix="debug.apk"
fi
APP_LC=$(echo Viewer | tr "[:upper:]" "[:lower:]")
echo "Installing ${APP_LC} from ${APP_LC}/build/outputs/apk/${APP_LC}-${ANDROID_ARCH}-${apk_suffix}"
$ADB ${DEVICE_SERIAL} install -r ${SCRIPT_DIR}/../apps/${APP_LC}/build/outputs/apk/${APP_LC}-${ANDROID_ARCH}-${apk_suffix}