From 57a7f5954cf1f9cbe99c70133863049a4be2e983 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Mon, 22 Jul 2013 18:21:32 -0700 Subject: Add "adb shell am restart" command. So you can restart the system without being root. Change-Id: I89770f497833ecbe2b69e3a0cfafae7ef472a9f5 --- cmds/am/src/com/android/commands/am/Am.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'cmds/am') 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 ]\n" + " am hang [--allow-restart]\n" + + " am restart\n" + " am screen-compat [on|off] \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 .\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; -- cgit v1.1