diff options
author | Dianne Hackborn <hackbod@google.com> | 2013-05-06 16:07:26 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2013-05-06 16:07:26 -0700 |
commit | 8bd64df2adb26fe9547ae3961a58631e241b613e (patch) | |
tree | 060a9ddad01b6dfd4f24abdd323a9b0873b32982 /cmds/am | |
parent | 5b88a2fd7b77880f6e09ae4a1de509bebe28bc3a (diff) | |
download | frameworks_base-8bd64df2adb26fe9547ae3961a58631e241b613e.zip frameworks_base-8bd64df2adb26fe9547ae3961a58631e241b613e.tar.gz frameworks_base-8bd64df2adb26fe9547ae3961a58631e241b613e.tar.bz2 |
Help for the debugging help for issue #8734824.
Add a new "hang" am command that lets you hang the system
process. Useful for testing.
Change-Id: Ice0fc52b49d80e5189f016108b03f9fd549b58a7
Diffstat (limited to 'cmds/am')
-rw-r--r-- | cmds/am/src/com/android/commands/am/Am.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java index 93658e1..61fe340 100644 --- a/cmds/am/src/com/android/commands/am/Am.java +++ b/cmds/am/src/com/android/commands/am/Am.java @@ -31,6 +31,7 @@ import android.content.Intent; import android.content.pm.IPackageManager; import android.content.pm.ResolveInfo; import android.net.Uri; +import android.os.Binder; import android.os.Bundle; import android.os.ParcelFileDescriptor; import android.os.RemoteException; @@ -94,6 +95,7 @@ public class Am extends BaseCommand { " am set-debug-app [-w] [--persistent] <PACKAGE>\n" + " am clear-debug-app\n" + " am monitor [--gdb <port>]\n" + + " am hang [--allow-restart]\n" + " am screen-compat [on|off] <PACKAGE>\n" + " am to-uri [INTENT]\n" + " am to-intent-uri [INTENT]\n" + @@ -169,6 +171,9 @@ public class Am extends BaseCommand { "am monitor: start monitoring for crashes or ANRs.\n" + " --gdb: start gdbserv on the given port at crash/ANR\n" + "\n" + + "am hang: hang the system.\n" + + " --allow-restart: allow watchdog to perform normal system restart\n" + + "\n" + "am screen-compat: control screen compatibility mode of <PACKAGE>.\n" + "\n" + "am to-uri: print the given Intent specification as a URI.\n" + @@ -249,6 +254,8 @@ public class Am extends BaseCommand { runBugReport(); } else if (op.equals("monitor")) { runMonitor(); + } else if (op.equals("hang")) { + runHang(); } else if (op.equals("screen-compat")) { runScreenCompat(); } else if (op.equals("to-uri")) { @@ -1304,6 +1311,22 @@ public class Am extends BaseCommand { controller.run(); } + private void runHang() throws Exception { + String opt; + boolean allowRestart = false; + while ((opt=nextOption()) != null) { + if (opt.equals("--allow-restart")) { + allowRestart = true; + } else { + System.err.println("Error: Unknown option: " + opt); + return; + } + } + + System.out.println("Hanging the system..."); + mAm.hang(new Binder(), allowRestart); + } + private void runScreenCompat() throws Exception { String mode = nextArgRequired(); boolean enabled; |