diff options
author | 2023-05-16 04:14:55 +0000 | |
---|---|---|
committer | 2023-05-16 04:14:55 +0000 | |
commit | 1682c22ea9de4a29ea1c1d13dbb23dd124aa7569 (patch) | |
tree | c16b35e07763dd0268120f7d56091670a90a9455 | |
parent | 0c40aaba31e7a8c2c9b395649a7e45b1b4501be8 (diff) | |
parent | 21e9a30219eeff0a58b8f6b0bc5f258b7830410e (diff) |
Merge "Merge "Ignore the reboot to normal intent when DSU is locked" am: 4811f1daee am: 7a99de2a88" into tm-qpr-dev-plus-aosp am: 21e9a30219
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2588547
Change-Id: Icac375159adc67b3faf3293204a6e2dc5438ad18
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
4 files changed, 34 insertions, 4 deletions
diff --git a/core/java/android/os/image/DynamicSystemManager.java b/core/java/android/os/image/DynamicSystemManager.java index 9610b16a312c..536795bafb1c 100644 --- a/core/java/android/os/image/DynamicSystemManager.java +++ b/core/java/android/os/image/DynamicSystemManager.java @@ -285,4 +285,16 @@ public class DynamicSystemManager { throw new RuntimeException(e.toString()); } } + + /** + * Returns the active DSU slot + */ + @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM) + public String getActiveDsuSlot() { + try { + return mService.getActiveDsuSlot(); + } catch (RemoteException e) { + throw new RuntimeException(e.toString()); + } + } } diff --git a/core/java/android/os/image/IDynamicSystemService.aidl b/core/java/android/os/image/IDynamicSystemService.aidl index 755368a85c40..0280ebbd87ab 100644 --- a/core/java/android/os/image/IDynamicSystemService.aidl +++ b/core/java/android/os/image/IDynamicSystemService.aidl @@ -145,4 +145,10 @@ interface IDynamicSystemService */ @EnforcePermission("MANAGE_DYNAMIC_SYSTEM") long suggestScratchSize(); + + /** + * Get the active DSU slot + */ + @EnforcePermission("MANAGE_DYNAMIC_SYSTEM") + String getActiveDsuSlot(); } diff --git a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java index b265a425d2e7..738354f78e30 100644 --- a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java +++ b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java @@ -423,7 +423,10 @@ public class DynamicSystemInstallationService extends Service Log.e(TAG, "It's already running in normal system."); return; } - + if (mDynSystem.getActiveDsuSlot().endsWith(".lock")) { + Log.e(TAG, "Ignore the reboot intent for a locked DSU slot"); + return; + } if (!mDynSystem.setEnable(/* enable = */ false, /* oneShot = */ false)) { Log.e(TAG, "Failed to disable DynamicSystem."); diff --git a/services/core/java/com/android/server/DynamicSystemService.java b/services/core/java/com/android/server/DynamicSystemService.java index b0c1d05b0dd4..cbacee6ba72c 100644 --- a/services/core/java/com/android/server/DynamicSystemService.java +++ b/services/core/java/com/android/server/DynamicSystemService.java @@ -226,9 +226,7 @@ public class DynamicSystemService extends IDynamicSystemService.Stub { IGsiService gsiService = getGsiService(); if (enable) { try { - if (mDsuSlot == null) { - mDsuSlot = gsiService.getActiveDsuSlot(); - } + getActiveDsuSlot(); GsiServiceCallback callback = new GsiServiceCallback(); synchronized (callback) { gsiService.enableGsiAsync(oneShot, mDsuSlot, callback); @@ -287,4 +285,15 @@ public class DynamicSystemService extends IDynamicSystemService.Stub { return getGsiService().suggestScratchSize(); } + + @Override + @EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM) + public String getActiveDsuSlot() throws RemoteException { + super.getActiveDsuSlot_enforcePermission(); + + if (mDsuSlot == null) { + mDsuSlot = getGsiService().getActiveDsuSlot(); + } + return mDsuSlot; + } } |