Update Skia Android tools.
This CL moves the skia_launcher out of the system/bin and into /data/local/tmp; removes the need to package our shared libs in an apk; and updates all the scripts to work in the new environment. R=mtklein@google.com, scroggo@google.com Review URL: https://codereview.chromium.org/22617002 git-svn-id: http://skia.googlecode.com/svn/trunk@10673 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
36bb270c1e
commit
cc95b1aeb8
2
Makefile
2
Makefile
@ -45,8 +45,8 @@ VALID_TARGETS := \
|
||||
pathops_unittest \
|
||||
pdfviewer \
|
||||
SampleApp \
|
||||
SampleApp_APK \
|
||||
skhello \
|
||||
SkiaAndroidApp \
|
||||
skia_lib \
|
||||
tests \
|
||||
tools \
|
||||
|
@ -15,6 +15,7 @@
|
||||
[ 'skia_os == "android"', {
|
||||
'dependencies': [
|
||||
'android_deps.gyp:Android_EntryPoint',
|
||||
'android_system.gyp:skia_launcher',
|
||||
],
|
||||
}],
|
||||
[ 'skia_os == "nacl"', {
|
||||
|
@ -22,7 +22,7 @@
|
||||
],
|
||||
'conditions': [
|
||||
['skia_os == "android"', {
|
||||
'dependencies': [ 'android_system.gyp:SkiaAndroidApp' ],
|
||||
'dependencies': [ 'android_system.gyp:SampleApp_APK' ],
|
||||
}],
|
||||
],
|
||||
},
|
||||
|
@ -9,14 +9,6 @@
|
||||
<!-- Needed to add to the download manager. -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<application android:label="SkiaAndroid">
|
||||
<receiver android:name=".SkiaReceiver" android:enabled="true">
|
||||
<intent-filter>
|
||||
<action android:name="com.skia.intent.action.LAUNCH_SKIA" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<service android:name=".SkiaIntentService"
|
||||
android:process=":skia_native">
|
||||
</service>
|
||||
<activity android:name=".SkiaSampleActivity"
|
||||
android:theme="@android:style/Theme.Holo.Light"
|
||||
android:configChanges="orientation|screenSize"
|
||||
|
@ -1,38 +0,0 @@
|
||||
#include "com_skia_SkiaIntentService.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
extern int main(int argc, char * const argv[]);
|
||||
|
||||
void cleanUp(JNIEnv* env, jobjectArray jstrs, const char** strs, int32_t count) {
|
||||
for (int32_t i = 0; i < count; ++i)
|
||||
env->ReleaseStringUTFChars(
|
||||
(jstring) env->GetObjectArrayElement(jstrs, i), strs[i]);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_skia_SkiaIntentService_run(
|
||||
JNIEnv* env,
|
||||
jobject,
|
||||
jobjectArray args) {
|
||||
|
||||
// Convert command line arguments to C format.
|
||||
int argc = env->GetArrayLength(args);
|
||||
const char** argv = new const char*[argc];
|
||||
for (int32_t i = 0; i < argc; ++i) {
|
||||
jstring str = (jstring) env->GetObjectArrayElement(args, i);
|
||||
argv[i] = env->GetStringUTFChars(str, NULL);
|
||||
if (NULL == argv[i]) {
|
||||
cleanUp(env, args, argv, i - 1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Execute program main()
|
||||
int retval = main(argc, (char* const*) argv);
|
||||
|
||||
// Clean up temporaries and return the exit code.
|
||||
cleanUp(env, args, argv, argc);
|
||||
delete[] argv;
|
||||
return retval;
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class com_skia_SkiaIntentService */
|
||||
|
||||
#ifndef _Included_com_skia_SkiaIntentService
|
||||
#define _Included_com_skia_SkiaIntentService
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: com_skia_SkiaIntentService
|
||||
* Method: run
|
||||
* Signature: ([Ljava/lang/String;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_skia_SkiaIntentService_run
|
||||
(JNIEnv *, jobject, jobjectArray);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
@ -1,94 +0,0 @@
|
||||
// Copyright 2012 Google Inc. All Rights Reserved.
|
||||
|
||||
package com.skia;
|
||||
|
||||
import android.app.IntentService;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* @author borenet@google.com (Eric Boren)
|
||||
*
|
||||
*/
|
||||
public class SkiaIntentService extends IntentService {
|
||||
public SkiaIntentService() {
|
||||
super("SkiaIntentService");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent arg0) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHandleIntent(Intent intent) {
|
||||
|
||||
// Extract command-line arguments
|
||||
Bundle bundle = intent.getExtras();
|
||||
|
||||
// Number of times to repeat the SkiaReturnCode in the log.
|
||||
int returnRepeats = bundle.getInt("returnRepeats", 1);
|
||||
|
||||
// We require at least the program name to be specified.
|
||||
if (!bundle.containsKey("args")) {
|
||||
Log.e("skia",
|
||||
"No command line arguments supplied. Unable to continue.");
|
||||
SkiaReturn(-1, returnRepeats);
|
||||
return;
|
||||
}
|
||||
|
||||
String cmd = bundle.getString("args").trim();
|
||||
String[] args = cmd.split("\\s+");
|
||||
Log.d("skia", "Executing Command: " + cmd);
|
||||
|
||||
// Load the requested library
|
||||
String lib = args[0];
|
||||
try {
|
||||
System.loadLibrary("skia_android");
|
||||
System.loadLibrary(lib);
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
Log.e("skia", "Library " + lib +
|
||||
" could not be linked! Unable to continue.");
|
||||
SkiaReturn(-1, returnRepeats);
|
||||
throw e;
|
||||
}
|
||||
|
||||
// JNI call to run the program
|
||||
int retval = run(args);
|
||||
SkiaReturn(retval, returnRepeats);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print out the exit code of the native program. Skia's buildbots watch the
|
||||
* logcat output for this line. The buildbots occasionally have to restart
|
||||
* a dead adb process, which causes them to miss some log output (Bug:
|
||||
* https://code.google.com/p/skia/issues/detail?id=809). If this
|
||||
* "SKIA_RETURN_CODE" line is missed while adb is being restarted, then the
|
||||
* test may never finish. Therefore, we print the line as many times as the
|
||||
* caller specifies, waiting one second in between.
|
||||
*/
|
||||
private void SkiaReturn(int code, int repeats) {
|
||||
Log.d("skia", "SKIA_RETURN_CODE " + code);
|
||||
for (int i = 1; i < repeats; ++i) {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
return;
|
||||
}
|
||||
Log.d("skia", "SKIA_RETURN_CODE " + code);
|
||||
}
|
||||
}
|
||||
|
||||
native int run(String[] args);
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
// Copyright 2012 Google Inc. All Rights Reserved.
|
||||
|
||||
package com.skia;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import com.skia.SkiaIntentService;
|
||||
|
||||
/**
|
||||
* @author borenet@google.com (Eric Boren)
|
||||
*
|
||||
*/
|
||||
public class SkiaReceiver extends BroadcastReceiver
|
||||
{
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Intent skIntent = new Intent(context, SkiaIntentService.class);
|
||||
|
||||
// Forward any command-line arguments to the background service
|
||||
skIntent.putExtras(intent.getExtras());
|
||||
|
||||
// Launch executable
|
||||
context.startService(skIntent);
|
||||
}
|
||||
}
|
@ -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 &
|
||||
|
@ -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
|
||||
|
||||
APP_NAME=${APP_ARGS[0]}
|
||||
configuration="Debug"
|
||||
|
||||
for arg in ${APP_ARGS[@]}
|
||||
do
|
||||
if [[ "${arg}" == "--release" ]];
|
||||
then
|
||||
configuration="Release"
|
||||
else
|
||||
gdbVars=("${gdbVars[@]}" "${arg}")
|
||||
fi
|
||||
|
||||
shift
|
||||
done
|
||||
|
||||
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
|
||||
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 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
|
||||
|
||||
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 &
|
||||
echo "Starting gdbserver with command: ${gdbVars[@]}"
|
||||
$ADB shell /data/local/tmp/gdbserver :5039 /data/local/tmp/skia_launcher ${gdbVars[@]} &
|
55
platform_tools/android/bin/android_install_apk
Executable file
55
platform_tools/android/bin/android_install_apk
Executable file
@ -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
|
@ -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;
|
@ -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
|
||||
|
103
platform_tools/android/bin/android_perf
Normal file → Executable file
103
platform_tools/android/bin/android_perf
Normal file → Executable file
@ -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
|
||||
|
||||
# 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)
|
||||
mkdir -p $TMP_APP_LOC
|
||||
|
||||
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
|
||||
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 [ $# -ge 2 ]
|
||||
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
|
||||
|
@ -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=""
|
||||
configuration="Debug"
|
||||
|
||||
while (( "$#" )); do
|
||||
|
||||
if [[ "$1" == "--intent" ]];
|
||||
for arg in ${APP_ARGS[@]}
|
||||
do
|
||||
if [[ "${arg}" == "--release" ]];
|
||||
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="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[@]}
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
0
platform_tools/android/bin/linux/perfhost
Normal file → Executable file
0
platform_tools/android/bin/linux/perfhost
Normal file → Executable file
@ -213,9 +213,6 @@
|
||||
}],
|
||||
],
|
||||
},
|
||||
'sources': [
|
||||
'../app/jni/com_skia_SkiaIntentService.cpp',
|
||||
],
|
||||
},
|
||||
{
|
||||
# This target is a dependency for Skia Sample application which runs on
|
||||
|
@ -1,19 +1,11 @@
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'CopySkiaAppDeps',
|
||||
'target_name': 'CopySampleAppDeps',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
'skia_lib.gyp:skia_lib',
|
||||
'SampleApp.gyp:SampleApp',
|
||||
'bench.gyp:bench',
|
||||
'gm.gyp:gm',
|
||||
'tests.gyp:tests',
|
||||
'pathops_unittest.gyp:pathops_unittest',
|
||||
'tools.gyp:bench_pictures',
|
||||
'tools.gyp:render_pictures',
|
||||
'tools.gyp:render_pdfs',
|
||||
'tools.gyp:skimage',
|
||||
],
|
||||
'variables': {
|
||||
'conditions': [
|
||||
@ -47,15 +39,7 @@
|
||||
{
|
||||
'destination': '<(PRODUCT_DIR)/android/libs/<(android_arch)',
|
||||
'files': [
|
||||
'<(PRODUCT_DIR)/lib.target/libbench.so',
|
||||
'<(PRODUCT_DIR)/lib.target/libbench_pictures.so',
|
||||
'<(PRODUCT_DIR)/lib.target/libgm.so',
|
||||
'<(PRODUCT_DIR)/lib.target/librender_pdfs.so',
|
||||
'<(PRODUCT_DIR)/lib.target/librender_pictures.so',
|
||||
'<(PRODUCT_DIR)/lib.target/libSampleApp.so',
|
||||
'<(PRODUCT_DIR)/lib.target/libskimage.so',
|
||||
'<(PRODUCT_DIR)/lib.target/libtests.so',
|
||||
'<(PRODUCT_DIR)/lib.target/libpathops_unittest.so',
|
||||
'<(PRODUCT_DIR)/lib.target/gdbserver',
|
||||
'<(PRODUCT_DIR)/lib.target/libskia_android.so',
|
||||
],
|
||||
@ -70,11 +54,10 @@
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'SkiaAndroidApp',
|
||||
'target_name': 'SampleApp_APK',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
'CopySkiaAppDeps',
|
||||
'skia_launcher',
|
||||
'CopySampleAppDeps',
|
||||
],
|
||||
'variables': {
|
||||
'ANDROID_SDK_ROOT': '<!(echo $ANDROID_SDK_ROOT)'
|
||||
@ -86,12 +69,8 @@
|
||||
'<(android_base)/app/AndroidManifest.xml',
|
||||
'<(android_base)/app/build.xml',
|
||||
'<(android_base)/app/project.properties',
|
||||
'<(android_base)/app/jni/com_skia_SkiaIntentService.h',
|
||||
'<(android_base)/app/jni/com_skia_SkiaIntentService.cpp',
|
||||
'<(android_base)/app/jni/com_skia_SkiaSampleRenderer.h',
|
||||
'<(android_base)/app/jni/com_skia_SkiaSampleRenderer.cpp',
|
||||
'<(android_base)/app/src/com/skia/SkiaReceiver.java',
|
||||
'<(android_base)/app/src/com/skia/SkiaIntentService.java',
|
||||
'<(android_base)/app/src/com/skia/SkiaSampleActivity.java',
|
||||
'<(android_base)/app/src/com/skia/SkiaSampleRenderer.java',
|
||||
'<(android_base)/app/src/com/skia/SkiaSampleView.java',
|
||||
|
@ -32,7 +32,7 @@ void* load_library(const char* appLocation, const char* libraryName)
|
||||
{
|
||||
// attempt to lookup the location of the shared libraries
|
||||
char libraryLocation[100];
|
||||
sprintf(libraryLocation, "%s/lib/lib%s.so", appLocation, libraryName);
|
||||
sprintf(libraryLocation, "%s/lib%s.so", appLocation, libraryName);
|
||||
if (!file_exists(libraryLocation)) {
|
||||
printf("ERROR: Unable to find the '%s' library in the Skia App.\n", libraryName);
|
||||
printf("ERROR: Did you provide the correct program_name?\n");
|
||||
@ -61,9 +61,9 @@ int main(int argc, const char** argv) {
|
||||
}
|
||||
|
||||
// attempt to lookup the location of the skia app
|
||||
const char* appLocation = "/data/data/com.skia";
|
||||
const char* appLocation = "/data/local/tmp";
|
||||
if (!file_exists(appLocation)) {
|
||||
printf("ERROR: Unable to find the com.skia app on the device.\n");
|
||||
printf("ERROR: Unable to find /data/local/tmp on the device.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user