summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYo Chiang <yochiang@google.com>2020-10-30 07:44:22 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-10-30 07:44:22 +0000
commitb8f884150dedf4b68a53c9969dad0151ad70be70 (patch)
tree2c0a41846fec4ffb86b47ac3a184019cd886f0d3
parentaf8cf941d6c8a524a315d9fb0ef91be2994ad864 (diff)
parentf785394fb3e33df1ae37d2b670d18077c6ee435e (diff)
Merge "Disable DSU in executeRebootToNormalCommand()" am: 0b6bf88ccd am: f785394fb3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1470783 Change-Id: Ie3cccfbeb1d4d187bcf2282fe0fcdbcbc22ca261
-rw-r--r--packages/DynamicSystemInstallationService/res/values/strings.xml3
-rw-r--r--packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java13
2 files changed, 14 insertions, 2 deletions
diff --git a/packages/DynamicSystemInstallationService/res/values/strings.xml b/packages/DynamicSystemInstallationService/res/values/strings.xml
index 719fc73bd225..bfeef0aa8c7b 100644
--- a/packages/DynamicSystemInstallationService/res/values/strings.xml
+++ b/packages/DynamicSystemInstallationService/res/values/strings.xml
@@ -37,6 +37,9 @@
<string name="toast_dynsystem_discarded">Discarded dynamic system</string>
<!-- Toast when we fail to launch into Dynamic System [CHAR LIMIT=128] -->
<string name="toast_failed_to_reboot_to_dynsystem">Can\u2019t restart or load dynamic system</string>
+ <!-- Toast when we fail to disable Dynamic System [CHAR LIMIT=128] -->
+ <string name="toast_failed_to_disable_dynsystem">Failed to disable dynamic system</string>
+
<!-- URL of Dynamic System Key Revocation List [DO NOT TRANSLATE] -->
<string name="key_revocation_list_url" translatable="false">https://dl.google.com/developers/android/gsi/gsi-keyblacklist.json</string>
diff --git a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java
index 12505bc55b15..ac2758011816 100644
--- a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java
+++ b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java
@@ -375,8 +375,17 @@ public class DynamicSystemInstallationService extends Service
return;
}
- // Per current design, we don't have disable() API. AOT is disabled on next reboot.
- // TODO: Use better status query when b/125079548 is done.
+ if (!mDynSystem.setEnable(/* enable = */ false, /* oneShot = */ false)) {
+ Log.e(TAG, "Failed to disable DynamicSystem.");
+
+ // Dismiss status bar and show a toast.
+ sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
+ Toast.makeText(this,
+ getString(R.string.toast_failed_to_disable_dynsystem),
+ Toast.LENGTH_LONG).show();
+ return;
+ }
+
PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
if (powerManager != null) {