summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
Diffstat (limited to 'cmds')
-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 0344d26..ffe7ac9 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -33,6 +33,7 @@ import android.content.pm.IPackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Binder;
+import android.os.Build;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
@@ -43,6 +44,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;
@@ -91,7 +94,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" +
@@ -813,6 +820,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) {
@@ -831,6 +839,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;
@@ -861,7 +871,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());
}