diff options
author | Xianzhu Wang <wangxianzhu@google.com> | 2011-05-13 15:46:20 +0800 |
---|---|---|
committer | Xianzhu Wang <wangxianzhu@google.com> | 2011-05-27 10:26:04 +0800 |
commit | 351f32270a489577e040bbeccc423b0bac1637dc (patch) | |
tree | 65ada0e6cbf429e7cb094d536d5c84746c56bc87 /cmds/am/src | |
parent | 8eed7aded77b826738c82cfe3b6a1440ac0786d9 (diff) | |
download | frameworks_base-351f32270a489577e040bbeccc423b0bac1637dc.zip frameworks_base-351f32270a489577e040bbeccc423b0bac1637dc.tar.gz frameworks_base-351f32270a489577e040bbeccc423b0bac1637dc.tar.bz2 |
Add force-stop subcommand for 'am'.
It's useful for some testing and debugging, to ensure all processes
are stopped before testing. 'kill' doesn't always work because sometimes the
system will restart the process immediately (e.g. if an app is running in
background).
Change-Id: I2c0caa38f74ee65ad6c35172fbf505227be7e7c3
Diffstat (limited to 'cmds/am/src')
-rw-r--r-- | cmds/am/src/com/android/commands/am/Am.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java index 38cacdd..424b70a 100644 --- a/cmds/am/src/com/android/commands/am/Am.java +++ b/cmds/am/src/com/android/commands/am/Am.java @@ -98,6 +98,8 @@ public class Am { runStart(); } else if (op.equals("startservice")) { runStartService(); + } else if (op.equals("force-stop")) { + runForceStop(); } else if (op.equals("instrument")) { runInstrument(); } else if (op.equals("broadcast")) { @@ -365,6 +367,10 @@ public class Am { } } + private void runForceStop() throws Exception { + mAm.forceStopPackage(nextArgRequired()); + } + private void sendBroadcast() throws Exception { Intent intent = makeIntent(); IntentReceiver receiver = new IntentReceiver(); @@ -851,7 +857,7 @@ public class Am { wm.clearForcedDisplaySize(); } } catch (RemoteException e) { - } + } } private class IntentReceiver extends IIntentReceiver.Stub { @@ -1013,6 +1019,8 @@ public class Am { "\n" + " start a Service: am startservice <INTENT>\n" + "\n" + + " force stop everything associated with a package: force-stop <package>\n" + + "\n" + " send a broadcast Intent: am broadcast <INTENT>\n" + "\n" + " start an Instrumentation: am instrument [flags] <COMPONENT>\n" + |