summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Martijn Coenen <maco@google.com> 2019-03-14 07:25:18 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-03-14 07:25:18 +0000
commitb8d244425e1a6ec3ee7d00ef77b4fa15f664d024 (patch)
treef9242abc87aa53dc4f6a8bfdf76c8fee222b2b16
parentd55e1b17887f4b23b48234eaae1a5e879190992d (diff)
parentf04aca4fc44d9a6c7289f108827469e76ea2bd1a (diff)
Merge "Add StorageManager checkpoint APIs."
-rw-r--r--core/java/android/os/storage/IStorageManager.aidl2
-rw-r--r--services/core/java/com/android/server/StorageManagerService.java32
2 files changed, 34 insertions, 0 deletions
diff --git a/core/java/android/os/storage/IStorageManager.aidl b/core/java/android/os/storage/IStorageManager.aidl
index f114b12cc3d1..25f67f81b70a 100644
--- a/core/java/android/os/storage/IStorageManager.aidl
+++ b/core/java/android/os/storage/IStorageManager.aidl
@@ -191,4 +191,6 @@ interface IStorageManager {
String translateAppToSystem(String path, int pid, int uid) = 81;
String translateSystemToApp(String path, int pid, int uid) = 82;
void commitChanges() = 83;
+ boolean supportsCheckpoint() = 84;
+ void startCheckpoint(int numTries) = 85;
}
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
index e28d484eebc7..f4161103b699 100644
--- a/services/core/java/com/android/server/StorageManagerService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -2717,6 +2717,38 @@ class StorageManagerService extends IStorageManager.Stub
}
/**
+ * Check whether the device supports filesystem checkpointing.
+ *
+ * @return true if the device supports filesystem checkpointing, false otherwise.
+ */
+ @Override
+ public boolean supportsCheckpoint() throws RemoteException {
+ // Only the system process is permitted to start checkpoints
+ if (Binder.getCallingUid() != android.os.Process.SYSTEM_UID) {
+ throw new SecurityException("no permission to check filesystem checkpoint support");
+ }
+
+ return mVold.supportsCheckpoint();
+ }
+
+ /**
+ * Signal that checkpointing partitions should start a checkpoint on the next boot.
+ *
+ * @param numTries Number of times to try booting in checkpoint mode, before we will boot
+ * non-checkpoint mode and commit all changes immediately. Callers are
+ * responsible for ensuring that boot is safe (eg, by rolling back updates).
+ */
+ @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) {
+ throw new SecurityException("no permission to start filesystem checkpoint");
+ }
+
+ mVold.startCheckpoint(numTries);
+ }
+
+ /**
* Signal that checkpointing partitions should commit changes
*/
@Override