diff options
| author | 2018-12-07 05:52:48 +0000 | |
|---|---|---|
| committer | 2018-12-07 05:52:48 +0000 | |
| commit | 0f2f9d06947c260f080821a185bf49b57946b61b (patch) | |
| tree | 380ce82b8b9d9beb118e19a35ebac1796cfd759c | |
| parent | abe028ab5bb9899be5155326346227b008bbd9b6 (diff) | |
| parent | e129e5ce898bc9f2ee608caf9a4ade36e6cc4c98 (diff) | |
Merge "Add commitChanges for signaling checkpointing end"
3 files changed, 23 insertions, 0 deletions
diff --git a/core/java/android/os/storage/IStorageManager.aidl b/core/java/android/os/storage/IStorageManager.aidl index bf988ae59299..f114b12cc3d1 100644 --- a/core/java/android/os/storage/IStorageManager.aidl +++ b/core/java/android/os/storage/IStorageManager.aidl @@ -190,4 +190,5 @@ interface IStorageManager { void abortIdleMaintenance() = 80; String translateAppToSystem(String path, int pid, int uid) = 81; String translateSystemToApp(String path, int pid, int uid) = 82; + void commitChanges() = 83; } diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java index dbea529b72fe..4b092b299029 100644 --- a/services/core/java/com/android/server/StorageManagerService.java +++ b/services/core/java/com/android/server/StorageManagerService.java @@ -2526,6 +2526,19 @@ class StorageManagerService extends IStorageManager.Stub } } + /** + * Signal that checkpointing partitions should commit changes + */ + @Override + public void commitChanges() throws RemoteException { + // Only the system process is permitted to commit checkpoints + if (Binder.getCallingUid() != android.os.Process.SYSTEM_UID) { + throw new SecurityException("no permission to commit checkpoint changes"); + } + + mVold.commitChanges(); + } + @Override public String getPassword() throws RemoteException { mContext.enforceCallingOrSelfPermission(Manifest.permission.CRYPT_KEEPER, diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java index 271b37ec7568..bcce05289206 100644 --- a/services/core/java/com/android/server/am/UserController.java +++ b/services/core/java/com/android/server/am/UserController.java @@ -67,6 +67,7 @@ import android.os.IRemoteCallback; import android.os.IUserManager; import android.os.Looper; import android.os.Message; +import android.os.PowerManager; import android.os.Process; import android.os.RemoteCallbackList; import android.os.RemoteException; @@ -332,6 +333,14 @@ class UserController implements Handler.Callback { return; } } + // Inform checkpointing systems of success + try { + getStorageManager().commitChanges(); + } catch (Exception e) { + PowerManager pm = (PowerManager) + mInjector.getContext().getSystemService(Context.POWER_SERVICE); + pm.reboot("Checkpoint commit failed"); + } // We always walk through all the user lifecycle states to send // consistent developer events. We step into RUNNING_LOCKED here, |