diff options
author | Yo Chiang <yochiang@google.com> | 2020-08-19 20:04:50 +0800 |
---|---|---|
committer | Yo Chiang <yochiang@google.com> | 2020-08-19 20:14:04 +0800 |
commit | 591602bf261d2329933ba13e8e603e8f91cd99a6 (patch) | |
tree | a04a2a3ad80e405ee00ebcc9e2c07159d89496a5 /packages/DynamicSystemInstallationService | |
parent | 0090d82f18eeb3a602f763904d995dbb4f18a532 (diff) |
Post a notification if reboot to DSU failed
Also call resetTaskAndStop() so the lingering Installation task is
cleaned up and failed states such as installation progress are cleared.
Bug: 165471299
Test: Install a failing DSU package and observe logcat
Test: Retry install DSU package and observe notification progress
Change-Id: I1ce55ea98256954bb06d46ca948cae6ca48d9679
Diffstat (limited to 'packages/DynamicSystemInstallationService')
-rw-r--r-- | packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java index f80e934cf37c..9ff868467531 100644 --- a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java +++ b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java @@ -352,16 +352,18 @@ public class DynamicSystemInstallationService extends Service if (powerManager != null) { powerManager.reboot("dynsystem"); } - } else { - Log.e(TAG, "Failed to enable DynamicSystem because of native runtime error."); - mNM.cancel(NOTIFICATION_ID); + return; + } - Toast.makeText(this, - getString(R.string.toast_failed_to_reboot_to_dynsystem), - Toast.LENGTH_LONG).show(); + Log.e(TAG, "Failed to enable DynamicSystem because of native runtime error."); - mDynSystem.remove(); - } + Toast.makeText(this, + getString(R.string.toast_failed_to_reboot_to_dynsystem), + Toast.LENGTH_LONG).show(); + + postStatus(STATUS_NOT_STARTED, CAUSE_ERROR_EXCEPTION, null); + resetTaskAndStop(); + mDynSystem.remove(); } private void executeRebootToNormalCommand() { |