Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4d5e82b8 authored by Gabriele M's avatar Gabriele M
Browse files

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
parent 8d0471ef
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -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);
            }
        }
    };