Report installation failures

Change-Id: I5e11db1e6e338a510b3c1c7d16f8c085d874a9db
This commit is contained in:
Gabriele M
2017-11-30 23:41:00 +01:00
parent ac36e3b8e6
commit 98773f70df
3 changed files with 12 additions and 2 deletions

View File

@@ -141,6 +141,9 @@ class ABUpdateInstaller {
File file = mUpdaterController.getActualUpdate(mDownloadId).getFile(); File file = mUpdaterController.getActualUpdate(mDownloadId).getFile();
if (!file.exists()) { if (!file.exists()) {
Log.e(TAG, "The given update doesn't exist"); Log.e(TAG, "The given update doesn't exist");
mUpdaterController.getActualUpdate(downloadId)
.setStatus(UpdateStatus.INSTALLATION_FAILED);
mUpdaterController.notifyUpdateChange(downloadId);
return false; return false;
} }
@@ -175,6 +178,9 @@ class ABUpdateInstaller {
mUpdateEngine = new UpdateEngine(); mUpdateEngine = new UpdateEngine();
if (!mUpdateEngine.bind(mUpdateEngineCallback)) { if (!mUpdateEngine.bind(mUpdateEngineCallback)) {
Log.e(TAG, "Could not bind"); Log.e(TAG, "Could not bind");
mUpdaterController.getActualUpdate(downloadId)
.setStatus(UpdateStatus.INSTALLATION_FAILED);
mUpdaterController.notifyUpdateChange(downloadId);
return false; return false;
} }
String zipFileUri = "file://" + file.getAbsolutePath(); String zipFileUri = "file://" + file.getAbsolutePath();

View File

@@ -76,8 +76,10 @@ class UpdateInstaller {
try { try {
android.os.RecoverySystem.installPackage(mContext, update); android.os.RecoverySystem.installPackage(mContext, update);
} catch (IOException e) { } catch (IOException e) {
// TODO: show error message
Log.e(TAG, "Could not install update", e); Log.e(TAG, "Could not install update", e);
mUpdaterController.getActualUpdate(downloadId)
.setStatus(UpdateStatus.INSTALLATION_FAILED);
mUpdaterController.notifyUpdateChange(downloadId);
} }
} }

View File

@@ -187,7 +187,9 @@ public class UpdaterService extends Service {
} }
} catch (IOException e) { } catch (IOException e) {
Log.e(TAG, "Could not install update", e); Log.e(TAG, "Could not install update", e);
// TODO: user facing message mUpdaterController.getActualUpdate(downloadId)
.setStatus(UpdateStatus.INSTALLATION_FAILED);
mUpdaterController.notifyUpdateChange(downloadId);
} }
} else if (ACTION_INSTALL_STOP.equals(intent.getAction())) { } else if (ACTION_INSTALL_STOP.equals(intent.getAction())) {
if (UpdateInstaller.isInstalling()) { if (UpdateInstaller.isInstalling()) {