summaryrefslogtreecommitdiffstats
path: root/cmds/am/src
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2014-05-30 11:51:03 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-05-30 11:51:03 +0000
commitdfed4bc99f9f3d48ee7bf9e8ea051a8d5bc4f299 (patch)
tree166fb21faaced287ba8dfb8adc9324a8df436a33 /cmds/am/src
parent8c29df5afcde5e1dd27c3ca21cfdec2af47205d1 (diff)
parentf7871c31469c6245c1b232a15104704f7481103c (diff)
downloadframeworks_base-dfed4bc99f9f3d48ee7bf9e8ea051a8d5bc4f299.zip
frameworks_base-dfed4bc99f9f3d48ee7bf9e8ea051a8d5bc4f299.tar.gz
frameworks_base-dfed4bc99f9f3d48ee7bf9e8ea051a8d5bc4f299.tar.bz2
am f7871c31: am b9b31f4b: am bd4d3203: Merge "Support an ABI flag for instrumentation."
* commit 'f7871c31469c6245c1b232a15104704f7481103c': Support an ABI flag for instrumentation.
Diffstat (limited to 'cmds/am/src')
-rw-r--r--cmds/am/src/com/android/commands/am/Am.java31
1 files changed, 29 insertions, 2 deletions
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index 6b55b7b..8945526 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -35,6 +35,7 @@ import android.content.pm.ResolveInfo;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Binder;
+import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.ParcelFileDescriptor;
@@ -46,6 +47,8 @@ import android.util.AndroidException;
import android.view.IWindowManager;
import com.android.internal.os.BaseCommand;
+import dalvik.system.VMRuntime;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
@@ -94,7 +97,11 @@ public class Am extends BaseCommand {
" am broadcast [--user <USER_ID> | all | current] <INTENT>\n" +
" am instrument [-r] [-e <NAME> <VALUE>] [-p <FILE>] [-w]\n" +
" [--user <USER_ID> | current]\n" +
- " [--no-window-animation] <COMPONENT>\n" +
+ " [--no-window-animation]\n" +
+ " [--abi <ABI>]\n : Launch the instrumented process with the " +
+ " selected ABI. This assumes that the process supports the" +
+ " selected ABI." +
+ " <COMPONENT>\n" +
" am profile start [--user <USER_ID> current] <PROCESS> <FILE>\n" +
" am profile stop [--user <USER_ID> current] [<PROCESS>]\n" +
" am dumpheap [--user <USER_ID> current] [-n] <PROCESS> <FILE>\n" +
@@ -835,6 +842,7 @@ public class Am extends BaseCommand {
Bundle args = new Bundle();
String argKey = null, argValue = null;
IWindowManager wm = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
+ String abi = null;
String opt;
while ((opt=nextOption()) != null) {
@@ -853,6 +861,8 @@ public class Am extends BaseCommand {
no_window_animation = true;
} else if (opt.equals("--user")) {
userId = parseUserArg(nextArgRequired());
+ } else if (opt.equals("--abi")) {
+ abi = nextArgRequired();
} else {
System.err.println("Error: Unknown option: " + opt);
return;
@@ -883,7 +893,24 @@ public class Am extends BaseCommand {
wm.setAnimationScale(1, 0.0f);
}
- if (!mAm.startInstrumentation(cn, profileFile, 0, args, watcher, connection, userId)) {
+ if (abi != null) {
+ final String[] supportedAbis = Build.SUPPORTED_ABIS;
+ boolean matched = false;
+ for (String supportedAbi : supportedAbis) {
+ if (supportedAbi.equals(abi)) {
+ matched = true;
+ break;
+ }
+ }
+
+ if (!matched) {
+ throw new AndroidException(
+ "INSTRUMENTATION_FAILED: Unsupported instruction set " + abi);
+ }
+ }
+
+ if (!mAm.startInstrumentation(cn, profileFile, 0, args, watcher, connection, userId,
+ abi)) {
throw new AndroidException("INSTRUMENTATION_FAILED: " + cn.flattenToString());
}