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
This commit is contained in:
Yo Chiang
2020-08-19 20:04:50 +08:00
parent 0090d82f18
commit 591602bf26

View File

@@ -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);
Toast.makeText(this,
getString(R.string.toast_failed_to_reboot_to_dynsystem),
Toast.LENGTH_LONG).show();
mDynSystem.remove();
return;
}
Log.e(TAG, "Failed to enable DynamicSystem because of native runtime error.");
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() {