Loading cmds/sm/src/com/android/commands/sm/Sm.java +29 −0 Original line number Diff line number Diff line Loading @@ -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(); } Loading Loading @@ -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; Loading Loading @@ -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; } } services/core/java/com/android/server/StorageManagerService.java +4 −2 Original line number Diff line number Diff line Loading @@ -2855,8 +2855,10 @@ class StorageManagerService extends IStorageManager.Stub */ @Override public void startCheckpoint(int numTries) throws RemoteException { // Only the system process is permitted to start checkpoints if (Binder.getCallingUid() != android.os.Process.SYSTEM_UID) { // Only the root, system_server and shell processes are permitted to start checkpoints final int callingUid = Binder.getCallingUid(); if (callingUid != Process.SYSTEM_UID && callingUid != Process.ROOT_UID && callingUid != Process.SHELL_UID) { throw new SecurityException("no permission to start filesystem checkpoint"); } Loading Loading
cmds/sm/src/com/android/commands/sm/Sm.java +29 −0 Original line number Diff line number Diff line Loading @@ -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(); } Loading Loading @@ -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; Loading Loading @@ -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; } }
services/core/java/com/android/server/StorageManagerService.java +4 −2 Original line number Diff line number Diff line Loading @@ -2855,8 +2855,10 @@ class StorageManagerService extends IStorageManager.Stub */ @Override public void startCheckpoint(int numTries) throws RemoteException { // Only the system process is permitted to start checkpoints if (Binder.getCallingUid() != android.os.Process.SYSTEM_UID) { // Only the root, system_server and shell processes are permitted to start checkpoints final int callingUid = Binder.getCallingUid(); if (callingUid != Process.SYSTEM_UID && callingUid != Process.ROOT_UID && callingUid != Process.SHELL_UID) { throw new SecurityException("no permission to start filesystem checkpoint"); } Loading