summaryrefslogtreecommitdiffstats
path: root/cmds/am
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2013-07-22 18:21:32 -0700
committerDianne Hackborn <hackbod@google.com>2013-07-23 11:51:22 -0700
commit57a7f5954cf1f9cbe99c70133863049a4be2e983 (patch)
treea657b5ca567729d7d2b94af792c6dc6540e522ed /cmds/am
parent5cf6663c80a9b6039cc70cc9b4041af64f671571 (diff)
downloadframeworks_base-57a7f5954cf1f9cbe99c70133863049a4be2e983.zip
frameworks_base-57a7f5954cf1f9cbe99c70133863049a4be2e983.tar.gz
frameworks_base-57a7f5954cf1f9cbe99c70133863049a4be2e983.tar.bz2
Add "adb shell am restart" command.
So you can restart the system without being root. Change-Id: I89770f497833ecbe2b69e3a0cfafae7ef472a9f5
Diffstat (limited to 'cmds/am')
-rw-r--r--cmds/am/src/com/android/commands/am/Am.java16
1 files changed, 16 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 d945216..d78572b 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -99,6 +99,7 @@ public class Am extends BaseCommand {
" am clear-debug-app\n" +
" am monitor [--gdb <port>]\n" +
" am hang [--allow-restart]\n" +
+ " am restart\n" +
" am screen-compat [on|off] <PACKAGE>\n" +
" am to-uri [INTENT]\n" +
" am to-intent-uri [INTENT]\n" +
@@ -186,6 +187,8 @@ public class Am extends BaseCommand {
"am hang: hang the system.\n" +
" --allow-restart: allow watchdog to perform normal system restart\n" +
"\n" +
+ "am restart: restart the user-space system.\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" +
@@ -290,6 +293,8 @@ public class Am extends BaseCommand {
runMonitor();
} else if (op.equals("hang")) {
runHang();
+ } else if (op.equals("restart")) {
+ runRestart();
} else if (op.equals("screen-compat")) {
runScreenCompat();
} else if (op.equals("to-uri")) {
@@ -1377,6 +1382,17 @@ public class Am extends BaseCommand {
mAm.hang(new Binder(), allowRestart);
}
+ private void runRestart() throws Exception {
+ String opt;
+ while ((opt=nextOption()) != null) {
+ System.err.println("Error: Unknown option: " + opt);
+ return;
+ }
+
+ System.out.println("Restart the system...");
+ mAm.restart();
+ }
+
private void runScreenCompat() throws Exception {
String mode = nextArgRequired();
boolean enabled;