diff options
Diffstat (limited to 'platform_tools/android/bin')
-rwxr-xr-x | platform_tools/android/bin/android_gdb_apk (renamed from platform_tools/android/bin/android_gdb) | 13 | ||||
-rwxr-xr-x | platform_tools/android/bin/android_gdbserver | 60 | ||||
-rwxr-xr-x | platform_tools/android/bin/android_install_apk | 55 | ||||
-rwxr-xr-x | platform_tools/android/bin/android_install_skia | 76 | ||||
-rwxr-xr-x | platform_tools/android/bin/android_make | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | platform_tools/android/bin/android_perf | 107 | ||||
-rwxr-xr-x | platform_tools/android/bin/android_run_skia | 51 | ||||
-rwxr-xr-x | platform_tools/android/bin/android_setup.sh | 57 | ||||
-rwxr-xr-x[-rw-r--r--] | platform_tools/android/bin/linux/perfhost | bin | 2219858 -> 2219858 bytes |
9 files changed, 216 insertions, 205 deletions
diff --git a/platform_tools/android/bin/android_gdb b/platform_tools/android/bin/android_gdb_apk index 9087084912..a87b948b96 100755 --- a/platform_tools/android/bin/android_gdb +++ b/platform_tools/android/bin/android_gdb_apk @@ -12,7 +12,7 @@ PORT=5039 source $SCRIPT_DIR/utils/setup_adb.sh echo "Installing Skia Android app" -$SCRIPT_DIR/android_install_skia -f +$SCRIPT_DIR/android_install_skia_apk -f # Forward local to remote socket connection. $ADB forward "tcp:$PORT" "tcp:$PORT" @@ -24,17 +24,18 @@ $ADB shell ps | grep gdbserver | awk '{print $2}' | xargs -r $ADB shell kill GDB_TMP_DIR=$(pwd)/android_gdb_tmp mkdir -p $GDB_TMP_DIR echo "Copying symbol files" -$ADB pull /system/bin/app_process $GDB_TMP_DIR -$ADB pull /system/lib/libc.so $GDB_TMP_DIR -$ADB pull /data/data/com.skia/lib/lib$APP_NAME.so $GDB_TMP_DIR +adb_pull_if_needed /system/bin/app_process $GDB_TMP_DIR +adb_pull_if_needed /system/lib/libc.so $GDB_TMP_DIR +adb_pull_if_needed /data/data/com.skia/lib/libskia_android.so $GDB_TMP_DIR +adb_pull_if_needed /data/data/com.skia/lib/libSampleApp.so $GDB_TMP_DIR # Launch the app SK_COMMAND="$APP_ARGS" echo "Running command $SK_COMMAND" -$ADB shell am broadcast -a com.skia.intent.action.LAUNCH_SKIA -n com.skia/.SkiaReceiver -e args "$SK_COMMAND" +adb shell am start -n com.skia/com.skia.SkiaSampleActivity # Attach gdbserver to the app process -PID=$($ADB shell ps | grep skia_native | awk '{print $2}') +PID=$($ADB shell ps | grep com.skia | awk '{print $2}') echo "Attaching to pid: $PID" $ADB shell /data/data/com.skia/lib/gdbserver :$PORT --attach $PID & diff --git a/platform_tools/android/bin/android_gdbserver b/platform_tools/android/bin/android_gdbserver index 5c45b56acd..04c46f37c8 100755 --- a/platform_tools/android/bin/android_gdbserver +++ b/platform_tools/android/bin/android_gdbserver @@ -4,49 +4,57 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source $SCRIPT_DIR/android_setup.sh +source $SCRIPT_DIR/utils/setup_adb.sh + +configuration="Debug" + +for arg in ${APP_ARGS[@]} +do + if [[ "${arg}" == "--release" ]]; + then + configuration="Release" + else + gdbVars=("${gdbVars[@]}" "${arg}") + fi + +shift +done -APP_NAME=${APP_ARGS[0]} +APP_NAME=${gdbVars[0]} PORT=5039 -source $SCRIPT_DIR/utils/setup_adb.sh +if [ ! -f "${SKIA_OUT}/${configuration}/lib.target/lib${gdbVars[0]}.so" ]; +then + echo "Unable to find the ${gdbVars[0]} library" + exit 1 +fi # We need the debug symbols from these files GDB_TMP_DIR=$(pwd)/android_gdb_tmp mkdir $GDB_TMP_DIR + echo "Copying symbol files" -adb_pull_if_needed /system/bin/skia_launcher $GDB_TMP_DIR adb_pull_if_needed /system/lib/libc.so $GDB_TMP_DIR -adb_pull_if_needed /data/data/com.skia/lib/libskia_android.so $GDB_TMP_DIR -adb_pull_if_needed /data/data/com.skia/lib/lib$APP_NAME.so $GDB_TMP_DIR - -echo "Checking for skia_launcher app..." -if [ ! -f $GDB_TMP_DIR/skia_launcher ] -then - echo "Unable for find the skia_launcher on the device" - rm -rf $GDB_TMP_DIR - exit 1; -fi +cp "${SKIA_OUT}/${configuration}/skia_launcher" $GDB_TMP_DIR +cp "${SKIA_OUT}/${configuration}/lib.target/libskia_android.so" $GDB_TMP_DIR +cp "${SKIA_OUT}/${configuration}/lib.target/lib${APP_NAME}.so" $GDB_TMP_DIR -echo "Checking for $APP_NAME library..." -if [ ! -f $GDB_TMP_DIR/lib$APP_NAME.so ] -then - echo "Unable for find the app's shared library on the device" - rm -rf $GDB_TMP_DIR - exit 1; -fi +echo "Pushing app..." +adb_push_if_needed "${SKIA_OUT}/${configuration}/skia_launcher" /data/local/tmp +adb_push_if_needed "${SKIA_OUT}/${configuration}/lib.target/libskia_android.so" /data/local/tmp +adb_push_if_needed "${SKIA_OUT}/${configuration}/lib.target/lib${APP_NAME}.so" /data/local/tmp echo "Pushing gdbserver..." -$ADB remount -$ADB push $ANDROID_TOOLCHAIN/../gdbserver /system/bin/gdbserver +adb_push_if_needed $ANDROID_TOOLCHAIN/../gdbserver data/local/tmp echo "Setting up port forward" $ADB forward "tcp:5039" "tcp:5039" -# Kill all previous instances of gdbserver and skia_launcher to rid all port overriding errors. +# Kill all previous instances of gdbserver and the app to rid all port overriding errors. echo "Killing any running Skia processes." $ADB shell ps | grep gdbserver | awk '{print $2}' | xargs $ADB shell kill -$ADB shell ps | grep skia_launcher | awk '{print $2}' | xargs $ADB shell kill +$ADB shell ps | grep ${APP_NAME} | awk '{print $2}' | xargs $ADB shell kill # Starting up gdbserver in android shell -echo "Starting gdbserver with command: skia_launcher $APP_ARGS" -$ADB shell gdbserver :5039 /system/bin/skia_launcher $APP_ARGS &
\ No newline at end of file +echo "Starting gdbserver with command: ${gdbVars[@]}" +$ADB shell /data/local/tmp/gdbserver :5039 /data/local/tmp/skia_launcher ${gdbVars[@]} &
\ No newline at end of file diff --git a/platform_tools/android/bin/android_install_apk b/platform_tools/android/bin/android_install_apk new file mode 100755 index 0000000000..ac162a1ed2 --- /dev/null +++ b/platform_tools/android/bin/android_install_apk @@ -0,0 +1,55 @@ +#!/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 " --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" + +while (( "$#" )); do + + if [[ "$1" == "-f" ]]; + then + forceRemoval="true" + elif [[ "$1" == "-h" ]]; + then + print_usage + exit + elif [[ "$1" == "-r" ]]; + then + echo "DEPRECATED: -r is now a no-op" + elif [[ "$1" == "--release" ]]; + then + configuration="Release" + 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 ${DEVICE_SERIAL} uninstall com.skia > /dev/null +fi + +echo "Installing Skia App from ${SKIA_OUT}/${configuration}" +$ADB ${DEVICE_SERIAL} install ${installOptions} ${SKIA_OUT}/${configuration}/android/bin/SkiaAndroid.apk diff --git a/platform_tools/android/bin/android_install_skia b/platform_tools/android/bin/android_install_skia index da16b1ab7a..21dec5b8c3 100755 --- a/platform_tools/android/bin/android_install_skia +++ b/platform_tools/android/bin/android_install_skia @@ -2,77 +2,5 @@ # # 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 +echo "The install step is now a no-op" +exit;
\ No newline at end of file diff --git a/platform_tools/android/bin/android_make b/platform_tools/android/bin/android_make index e5952e25be..ad52d67bca 100755 --- a/platform_tools/android/bin/android_make +++ b/platform_tools/android/bin/android_make @@ -3,7 +3,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source $SCRIPT_DIR/android_setup.sh -for arg in ${APP_ARGS} +for arg in ${APP_ARGS[@]} do if [[ "${arg}" == "--use-ccache" ]]; then diff --git a/platform_tools/android/bin/android_perf b/platform_tools/android/bin/android_perf index 5e4b7c8b7a..58e43202a4 100644..100755 --- a/platform_tools/android/bin/android_perf +++ b/platform_tools/android/bin/android_perf @@ -9,8 +9,7 @@ # SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -PERF_CMD=$1 - +source $SCRIPT_DIR/android_setup.sh source $SCRIPT_DIR/utils/setup_adb.sh if [ $(uname) == "Linux" ]; then @@ -22,77 +21,70 @@ else exit 1; fi +# grab and remove the perf command from the input args +PERF_CMD=${APP_ARGS[0]} +unset APP_ARGS[0] + +configuration="Debug" + +for arg in ${APP_ARGS[@]} +do + if [[ "${arg}" == "--release" ]]; + then + configuration="Release" + else + echo "${arg}" + runVars=("${runVars[@]}" "${arg}") + fi + +shift +done + # We need the debug symbols from these files PERF_TMP_DIR=$(pwd)/android_perf_tmp TMP_SYS_BIN=$PERF_TMP_DIR/system/bin TMP_SYS_LIB=$PERF_TMP_DIR/system/lib -TMP_APP_LIB=$PERF_TMP_DIR/data/data/com.skia/lib +TMP_APP_LOC=$PERF_TMP_DIR/data/local/tmp perf_setup() { mkdir -p $TMP_SYS_BIN mkdir -p $TMP_SYS_LIB - mkdir -p $TMP_APP_LIB + mkdir -p $TMP_APP_LOC - # setup symlinks to account for perf potentially looking elsewhere - mkdir -p $PERF_TMP_DIR/data/app-lib - $( cd $PERF_TMP_DIR/data/app-lib && ln -s ../data/com.skia/lib com.skia-1) - $( cd $PERF_TMP_DIR/data/app-lib && ln -s ../data/com.skia/lib com.skia-2) - echo "Copying symbol files" - $ADB pull /system/bin/skia_launcher $TMP_SYS_BIN - $ADB pull /system/lib/libc.so $TMP_SYS_LIB - $ADB pull /system/lib/libstlport.so $TMP_SYS_LIB - $ADB pull /system/lib/libcutils.so $TMP_SYS_LIB - $ADB pull /system/lib/libGLESv2.so $TMP_SYS_LIB - $ADB pull /system/lib/libandroid.so $TMP_SYS_LIB - $ADB pull /system/lib/libm.so $TMP_SYS_LIB - $ADB pull /system/lib/libz.so $TMP_SYS_LIB - - if [ $# -ge 2 ] + adb_pull_if_needed /system/lib/libc.so $TMP_SYS_LIB + adb_pull_if_needed /system/lib/libstlport.so $TMP_SYS_LIB + adb_pull_if_needed /system/lib/libcutils.so $TMP_SYS_LIB + adb_pull_if_needed /system/lib/libGLESv2.so $TMP_SYS_LIB + adb_pull_if_needed /system/lib/libandroid.so $TMP_SYS_LIB + adb_pull_if_needed /system/lib/libm.so $TMP_SYS_LIB + adb_pull_if_needed /system/lib/libz.so $TMP_SYS_LIB + + if [ ! -f "${SKIA_OUT}/${configuration}/lib.target/lib${runVars[0]}.so" ]; then - APP_NAME=$(basename $2) - $ADB pull /data/data/com.skia/lib/lib${APP_NAME}.so $TMP_APP_LIB - else - $ADB pull /data/data/com.skia/lib/ $TMP_APP_LIB + echo "Unable to find the ${runVars[0]} library" + exit 1 fi - + echo "Pushing app..." + adb_push_if_needed "${SKIA_OUT}/${configuration}/skia_launcher" /data/local/tmp + adb_push_if_needed "${SKIA_OUT}/${configuration}/lib.target/libskia_android.so" /data/local/tmp + adb_push_if_needed "${SKIA_OUT}/${configuration}/lib.target/lib${runVars[0]}.so" /data/local/tmp + + cp "${SKIA_OUT}/${configuration}/skia_launcher" $TMP_APP_LOC + cp "${SKIA_OUT}/${configuration}/lib.target/libskia_android.so" $TMP_APP_LOC + cp "${SKIA_OUT}/${configuration}/lib.target/lib${runVars[0]}.so" $TMP_APP_LOC } perf_record() { - APP_NAME=$(basename $2) - # Collect extra arguments to be passed to the skia_launcher binary - shift # perf_cmd - shift # app_name - while (( "$#" )); do - APP_ARGS="$APP_ARGS $1" - shift - done - - echo "Checking for skia_launcher app..." - if [ ! -f $TMP_SYS_BIN/skia_launcher ] - then - echo "Unable to find the skia_launcher on the device" - rm -rf $PERF_TMP_DIR - exit 1; - fi - - echo "Checking for $APP_NAME library..." - if [ ! -f $TMP_APP_LIB/lib$APP_NAME.so ] - then - echo "Unable to find the app's shared library on the device" - rm -rf $PERF_TMP_DIR - exit 1; - fi - echo "Killing any running Skia processes." $ADB shell ps | grep skia_launcher | awk '{print $2}' | xargs $ADB shell kill echo "Starting application" - $ADB shell skia_launcher $APP_NAME $APP_ARGS & + $ADB shell /data/local/tmp/skia_launcher ${runVars[@]} & # WE REALLY REALLY WANT TO BE ABLE TO PASS THE SKIA_LAUNCHER APP DIRECTLY TO # PERF, BUT AT THIS POINT THE DATA FILE WE GET WHEN GOING THAT ROUTE IS UNABLE @@ -107,13 +99,8 @@ perf_record() { } perf_report() { - # Collect extra arguments to be passed to the perfhost binary - while (( "$#" )); do - APP_ARGS="$APP_ARGS $1" - shift - done - - $PERFHOST report -i $PERF_TMP_DIR/perf.data --symfs=$PERF_TMP_DIR $APP_ARGS + adb_pull_if_needed /data/perf.data $PERF_TMP_DIR/perf.data + $PERFHOST report -i $PERF_TMP_DIR/perf.data --symfs=$PERF_TMP_DIR ${runVars[@]} } # Clean up @@ -123,11 +110,11 @@ perf_clean() { case $PERF_CMD in setup) - perf_setup $@ + perf_setup ${runVars[@]} ;; record) - perf_setup $@ - perf_record $@ + perf_setup ${runVars[@]} + perf_record ${runVars[@]} ;; report) perf_report diff --git a/platform_tools/android/bin/android_run_skia b/platform_tools/android/bin/android_run_skia index 00fe37f65d..133be35709 100755 --- a/platform_tools/android/bin/android_run_skia +++ b/platform_tools/android/bin/android_run_skia @@ -4,45 +4,32 @@ # output, and kills the app if interrupted. SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - +source $SCRIPT_DIR/android_setup.sh source $SCRIPT_DIR/utils/setup_adb.sh -APP_ARGS="" -USE_INTENT="false" -SERIAL="" - -while (( "$#" )); do - - if [[ "$1" == "--intent" ]]; - then - USE_INTENT="true" - elif [[ "$1" == "-s" ]]; - then - if [[ $# -lt 2 ]]; - then - echo "ERROR: missing serial number" - exit 1; - fi - SERIAL="-s $2" - shift +configuration="Debug" + +for arg in ${APP_ARGS[@]} +do + if [[ "${arg}" == "--release" ]]; + then + configuration="Release" else - APP_ARGS="$APP_ARGS $1" + runVars=("${runVars[@]}" "${arg}") fi shift done - -if [[ "$USE_INTENT" == "true" ]]; +if [ ! -f "${SKIA_OUT}/${configuration}/lib.target/lib${runVars[0]}.so" ]; then - $ADB $SERIAL logcat -c - $ADB $SERIAL shell am broadcast -a com.skia.intent.action.LAUNCH_SKIA -n com.skia/.SkiaReceiver -e args "$APP_ARGS" - trap "echo \"Interrupt.\"" INT - eval "($ADB $SERIAL logcat)" - trap - INT - echo "Interrupt. Killing Skia process..." - $SCRIPT_DIR/android_kill_skia $SERIAL - echo "Done." -else - $ADB $SERIAL shell skia_launcher $APP_ARGS + echo "Unable to find the ${runVars[0]} library" + exit 1 fi + +adb_push_if_needed "${SKIA_OUT}/${configuration}/skia_launcher" /data/local/tmp +adb_push_if_needed "${SKIA_OUT}/${configuration}/lib.target/libskia_android.so" /data/local/tmp +adb_push_if_needed "${SKIA_OUT}/${configuration}/lib.target/lib${runVars[0]}.so" /data/local/tmp + + +$ADB ${DEVICE_SERIAL} shell /data/local/tmp/skia_launcher ${runVars[@]} diff --git a/platform_tools/android/bin/android_setup.sh b/platform_tools/android/bin/android_setup.sh index db1145f5d1..2525dbbdee 100755 --- a/platform_tools/android/bin/android_setup.sh +++ b/platform_tools/android/bin/android_setup.sh @@ -4,20 +4,28 @@ # Parse the arguments for a DEVICE_ID. DEVICE_ID="" +DEVICE_SERIAL="" while (( "$#" )); do if [[ $(echo "$1" | grep "^-d$") != "" ]]; then DEVICE_ID=$2 shift + elif [[ "$1" == "-s" ]]; + then + if [[ $# -lt 2 ]]; + then + echo "ERROR: missing serial number" + exit 1; + fi + DEVICE_SERIAL="-s $2" + shift else - APP_ARGS="$APP_ARGS $1" + APP_ARGS=("${APP_ARGS[@]}" "${1}") fi shift done -APP_ARGS=$(echo ${APP_ARGS} | sed 's/^ *//g') - function exportVar { NAME=$1 VALUE=$2 @@ -210,6 +218,7 @@ setup_device() { esac echo "The build is targeting the device: $TARGET_DEVICE" + export DEVICE_ID="$TARGET_DEVICE" # Set up the toolchain. setup_toolchain @@ -244,17 +253,53 @@ adb_pull_if_needed() { if [ -f $HOST_DST ]; then #get the MD5 for dst and src - ANDROID_MD5=`$ADB shell md5 $ANDROID_SRC` + ANDROID_MD5=`$ADB $DEVICE_SERIAL shell md5 $ANDROID_SRC` HOST_MD5=`md5sum $HOST_DST` if [ "${ANDROID_MD5:0:32}" != "${HOST_MD5:0:32}" ]; then - $ADB pull $ANDROID_SRC $HOST_DST + $ADB $DEVICE_SERIAL pull $ANDROID_SRC $HOST_DST # else # echo "md5 match of android [$ANDROID_SRC] and host [$HOST_DST]" fi else - $ADB pull $ANDROID_SRC $HOST_DST + $ADB $DEVICE_SERIAL pull $ANDROID_SRC $HOST_DST + fi +} + +# adb_push_if_needed(host_src, android_dst) +adb_push_if_needed() { + + # get adb location + source $SCRIPT_DIR/utils/setup_adb.sh + + # read input params + HOST_SRC="$1" + ANDROID_DST="$2" + + ANDROID_LS=`$ADB $DEVICE_SERIAL shell ls -ld $ANDROID_DST` + if [ "${ANDROID_LS:0:1}" == "d" ]; + then + ANDROID_DST="${ANDROID_DST}/$(basename ${HOST_SRC})" + fi + + echo "ANDROID: $ANDROID_DST" + + ANDROID_LS=`$ADB $DEVICE_SERIAL shell ls -ld $ANDROID_DST` + if [ "${ANDROID_LS:0:1}" == "-" ]; + then + #get the MD5 for dst and src + ANDROID_MD5=`$ADB $DEVICE_SERIAL shell md5 $ANDROID_DST` + HOST_MD5=`md5sum $HOST_SRC` + + if [ "${ANDROID_MD5:0:32}" != "${HOST_MD5:0:32}" ]; + then + $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST +# else +# echo "md5 match of android [${ANDROID_DST}] and host [${HOST_SRC}]" + fi + else + $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST fi } diff --git a/platform_tools/android/bin/linux/perfhost b/platform_tools/android/bin/linux/perfhost Binary files differindex 926a639813..926a639813 100644..100755 --- a/platform_tools/android/bin/linux/perfhost +++ b/platform_tools/android/bin/linux/perfhost |