summaryrefslogtreecommitdiff
path: root/cmds/sm/src
diff options
context:
space:
mode:
authorNikita Ioffe <ioffe@google.com>2020-01-14 22:19:01 +0000
committerNikita Ioffe <ioffe@google.com>2020-01-15 21:18:00 +0000
commitbef21fbd25338e3060dbf4f04eb698295b30cad7 (patch)
tree189291946469d6796c42591dbce525b36d6eab66 /cmds/sm/src
parente88817bd429ae2a8b3006d73ff2090011f14ae89 (diff)
Add shell commands to start checkpoint/check it is supported
Test: adb shell sm supports-checkpoint Test: adb shell sm start-checkpoint 1 && adb reboot Bug: 135984674 Change-Id: I08cd675b147cea88ad5b29ab4b0cd64ac445879d Merged-In: I08cd675b147cea88ad5b29ab4b0cd64ac445879d (cherry picked from commit 6d74942719bfedfe25f8c20af6fdd726ca14e15e)
Diffstat (limited to 'cmds/sm/src')
-rw-r--r--cmds/sm/src/com/android/commands/sm/Sm.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/cmds/sm/src/com/android/commands/sm/Sm.java b/cmds/sm/src/com/android/commands/sm/Sm.java
index 6033655c8513..c2ee6dcd13b2 100644
--- a/cmds/sm/src/com/android/commands/sm/Sm.java
+++ b/cmds/sm/src/com/android/commands/sm/Sm.java
@@ -103,6 +103,10 @@ public final class Sm {
runSetVirtualDisk();
} else if ("set-isolated-storage".equals(op)) {
runIsolatedStorage();
+ } else if ("start-checkpoint".equals(op)) {
+ runStartCheckpoint();
+ } else if ("supports-checkpoint".equals(op)) {
+ runSupportsCheckpoint();
} else {
throw new IllegalArgumentException();
}
@@ -313,6 +317,27 @@ public final class Sm {
}
}
+ private void runStartCheckpoint() throws RemoteException {
+ final String numRetriesString = nextArg();
+ if (numRetriesString == null) {
+ throw new IllegalArgumentException("Expected <num-retries>");
+ }
+ int numRetries;
+ try {
+ numRetries = Integer.parseInt(numRetriesString);
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("<num-retries> must be a positive integer");
+ }
+ if (numRetries <= 0) {
+ throw new IllegalArgumentException("<num-retries> must be a positive integer");
+ }
+ mSm.startCheckpoint(numRetries);
+ }
+
+ private void runSupportsCheckpoint() throws RemoteException {
+ System.out.println(mSm.supportsCheckpoint());
+ }
+
private String nextArg() {
if (mNextArg >= mArgs.length) {
return null;
@@ -344,6 +369,10 @@ public final class Sm {
System.err.println("");
System.err.println(" sm set-isolated-storage [on|off|default]");
System.err.println("");
+ System.err.println(" sm start-checkpoint <num-retries>");
+ System.err.println("");
+ System.err.println(" sm supports-checkpoint");
+ System.err.println("");
return 1;
}
}