From efa1a14b1924cf4aed868e1e2d3c4ec4f7d0ce28 Mon Sep 17 00:00:00 2001 From: Gabriele M Date: Mon, 2 Apr 2018 17:14:28 +0200 Subject: [PATCH] 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 --- .../updater/controller/ABUpdateInstaller.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/org/lineageos/updater/controller/ABUpdateInstaller.java b/src/org/lineageos/updater/controller/ABUpdateInstaller.java index 2dc90931..da52a46b 100644 --- a/src/org/lineageos/updater/controller/ABUpdateInstaller.java +++ b/src/org/lineageos/updater/controller/ABUpdateInstaller.java @@ -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); + } } };