Handle install errors from onPayloadApplicationComplete()

When the installation terminates because of an error, update_engine
sets the status to IDLE and sends a notification. Thus, we might
miss the error report and never update the status of the update.

Change-Id: Ic1536b1c157c4dab0128f039f9512f2fb734287d
This commit is contained in:
Gabriele M
2018-04-02 17:14:28 +02:00
parent 9a5fe30317
commit efa1a14b19

View File

@@ -78,14 +78,6 @@ class ABUpdateInstaller {
}
break;
case UpdateEngine.UpdateStatusConstants.REPORTING_ERROR_EVENT: {
installationDone(false);
update.setInstallProgress(0);
update.setStatus(UpdateStatus.INSTALLATION_FAILED);
mUpdaterController.notifyUpdateChange(mDownloadId);
}
break;
case UpdateEngine.UpdateStatusConstants.UPDATED_NEED_REBOOT: {
installationDone(true);
update.setInstallProgress(0);
@@ -112,6 +104,13 @@ class ABUpdateInstaller {
@Override
public void onPayloadApplicationComplete(int errorCode) {
if (errorCode != UpdateEngine.ErrorCodeConstants.SUCCESS) {
installationDone(false);
Update update = mUpdaterController.getActualUpdate(mDownloadId);
update.setInstallProgress(0);
update.setStatus(UpdateStatus.INSTALLATION_FAILED);
mUpdaterController.notifyUpdateChange(mDownloadId);
}
}
};