summaryrefslogtreecommitdiff
path: root/packages/DynamicSystemInstallationService/src
diff options
context:
space:
mode:
authorPo-Chien Hsueh <pchsueh@google.com>2019-04-01 16:51:47 +0800
committerPo-Chien Hsueh <pchsueh@google.com>2019-04-03 07:54:54 +0000
commit91508ea20db5b1db37c8fed06bcf8075b06906f6 (patch)
tree183b2fb37d908c84a02d3c50a120546ef6b5e3c9 /packages/DynamicSystemInstallationService/src
parent72324e4eb144ff0f88c7abd85b3c16d86a4c889f (diff)
Use setEnable() when there is an installed image
We can now use setEnable() to tell GsiService that we would like run in DynamicSystem on the next restart, if there is a system image installed. Bug: 124613126 Test: Tap the button and setEnabe() is invoked. Change-Id: I74312af0c87548981ecb4e1ac9a1f3814304a4d5
Diffstat (limited to 'packages/DynamicSystemInstallationService/src')
-rw-r--r--packages/DynamicSystemInstallationService/src/com/android/dynandroid/DynamicSystemInstallationService.java28
1 files changed, 16 insertions, 12 deletions
diff --git a/packages/DynamicSystemInstallationService/src/com/android/dynandroid/DynamicSystemInstallationService.java b/packages/DynamicSystemInstallationService/src/com/android/dynandroid/DynamicSystemInstallationService.java
index 2ad72eb725a9..5c6885a801e8 100644
--- a/packages/DynamicSystemInstallationService/src/com/android/dynandroid/DynamicSystemInstallationService.java
+++ b/packages/DynamicSystemInstallationService/src/com/android/dynandroid/DynamicSystemInstallationService.java
@@ -257,7 +257,7 @@ public class DynamicSystemInstallationService extends Service
return;
}
- if (getStatus() != STATUS_READY) {
+ if (!isDynamicSystemInstalled() && (getStatus() != STATUS_READY)) {
Log.e(TAG, "Trying to discard AOT while there is no complete installation");
return;
}
@@ -273,13 +273,25 @@ public class DynamicSystemInstallationService extends Service
}
private void executeRebootToDynSystemCommand() {
- if (mInstallTask == null || mInstallTask.getStatus() != FINISHED) {
+ boolean enabled = false;
+
+ if (mInstallTask != null && mInstallTask.getStatus() == FINISHED) {
+ enabled = mInstallTask.commit();
+ } else if (isDynamicSystemInstalled()) {
+ enabled = mDynSystem.setEnable(true);
+ } else {
Log.e(TAG, "Trying to reboot to AOT while there is no complete installation");
return;
}
- if (!mInstallTask.commit()) {
- Log.e(TAG, "Failed to commit installation because of native runtime error.");
+ if (enabled) {
+ PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
+
+ if (powerManager != null) {
+ powerManager.reboot("dynsystem");
+ }
+ } else {
+ Log.e(TAG, "Failed to enable DynamicSystem because of native runtime error.");
mNM.cancel(NOTIFICATION_ID);
Toast.makeText(this,
@@ -287,14 +299,6 @@ public class DynamicSystemInstallationService extends Service
Toast.LENGTH_LONG).show();
mDynSystem.remove();
-
- return;
- }
-
- PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
-
- if (powerManager != null) {
- powerManager.reboot("dynsystem");
}
}