Keep track of the installation status of AB updates
This allows to show the correct labels. Change-Id: I52f42e042af0df2d091d786c03102cec352b3a5b
This commit is contained in:
@@ -79,7 +79,6 @@
|
||||
<string name="list_build_version_date">LineageOS <xliff:g id="version" example="14.1">%1$s</xliff:g> - <xliff:g id="date" example="July 11, 2017">%2$s</xliff:g></string>
|
||||
<string name="list_download_progress"><xliff:g id="filesize_without_unit" example="12.2">%1$s</xliff:g> of <xliff:g id="filesize_without_unit" example="310 MB">%2$s</xliff:g></string>
|
||||
<string name="list_download_progress_eta"><xliff:g id="filesize_without_unit" example="12.2">%1$s</xliff:g> of <xliff:g id="filesize_without_unit" example="310 MB">%2$s</xliff:g> - <xliff:g id="duration" example="3 minutes">%3$s</xliff:g> left</string>
|
||||
<string name="list_installing_update">Installing update</string>
|
||||
<string name="list_verifying_update">Verifying update</string>
|
||||
<string name="list_no_updates">No new updates found. To manually check for new updates, use the Refresh button.</string>
|
||||
|
||||
|
@@ -160,7 +160,10 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
|
||||
viewHolder.mProgressPercentage.setText(percentage);
|
||||
} else if (mUpdaterController.isInstallingUpdate(downloadId)) {
|
||||
setButtonAction(viewHolder.mAction, Action.CANCEL_INSTALLATION, downloadId, true);
|
||||
viewHolder.mProgressText.setText(R.string.list_installing_update);
|
||||
viewHolder.mProgressText.setText(
|
||||
update.getFinalizing() ?
|
||||
R.string.finalizing_package :
|
||||
R.string.preparing_ota_first_boot);
|
||||
viewHolder.mProgressBar.setProgress(update.getInstallProgress());
|
||||
String percentage = NumberFormat.getPercentInstance().format(
|
||||
update.getInstallProgress() / 100.f);
|
||||
|
@@ -67,6 +67,8 @@ class ABUpdateInstaller {
|
||||
case UpdateEngine.UpdateStatusConstants.FINALIZING: {
|
||||
int progress = Math.round(percent * 100);
|
||||
mUpdaterController.getActualUpdate(mDownloadId).setInstallProgress(progress);
|
||||
boolean finalizing = status == UpdateEngine.UpdateStatusConstants.FINALIZING;
|
||||
mUpdaterController.getActualUpdate(mDownloadId).setFinalizing(finalizing);
|
||||
mUpdaterController.notifyInstallProgress(mDownloadId);
|
||||
}
|
||||
break;
|
||||
|
@@ -414,20 +414,15 @@ public class UpdaterService extends Service {
|
||||
}
|
||||
|
||||
private void handleInstallProgress(UpdateInfo update) {
|
||||
setNotificationTitle(update);
|
||||
int progress = update.getInstallProgress();
|
||||
mNotificationBuilder.setProgress(100, progress, false);
|
||||
|
||||
setNotificationTitle(update);
|
||||
|
||||
if (progress == 0) {
|
||||
mNotificationStyle.bigText(getString(R.string.finalizing_package));
|
||||
mNotificationBuilder.setProgress(0, 0, true);
|
||||
} else {
|
||||
String percent = NumberFormat.getPercentInstance().format(progress / 100.f);
|
||||
mNotificationStyle.setSummaryText(percent);
|
||||
mNotificationStyle.bigText(getString(R.string.preparing_ota_first_boot));
|
||||
}
|
||||
|
||||
String percent = NumberFormat.getPercentInstance().format(progress / 100.f);
|
||||
mNotificationStyle.setSummaryText(percent);
|
||||
mNotificationStyle.bigText(
|
||||
update.getFinalizing() ?
|
||||
getString(R.string.finalizing_package) :
|
||||
getString(R.string.preparing_ota_first_boot));
|
||||
mNotificationManager.notify(NOTIFICATION_ID, mNotificationBuilder.build());
|
||||
}
|
||||
|
||||
|
@@ -28,6 +28,7 @@ public class Update extends UpdateBase implements UpdateInfo {
|
||||
private long mSpeed;
|
||||
private int mInstallProgress;
|
||||
private boolean mAvailableOnline;
|
||||
private boolean mIsFinalizing;
|
||||
|
||||
public Update() {
|
||||
}
|
||||
@@ -47,6 +48,7 @@ public class Update extends UpdateBase implements UpdateInfo {
|
||||
mSpeed = update.getSpeed();
|
||||
mInstallProgress = update.getInstallProgress();
|
||||
mAvailableOnline = update.getAvailableOnline();
|
||||
mIsFinalizing = update.getFinalizing();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -129,4 +131,13 @@ public class Update extends UpdateBase implements UpdateInfo {
|
||||
public void setAvailableOnline(boolean availableOnline) {
|
||||
mAvailableOnline = availableOnline;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFinalizing() {
|
||||
return mIsFinalizing;
|
||||
}
|
||||
|
||||
public void setFinalizing(boolean finalizing) {
|
||||
mIsFinalizing = finalizing;
|
||||
}
|
||||
}
|
||||
|
@@ -35,4 +35,6 @@ public interface UpdateInfo extends UpdateBaseInfo {
|
||||
int getInstallProgress();
|
||||
|
||||
boolean getAvailableOnline();
|
||||
|
||||
boolean getFinalizing();
|
||||
}
|
||||
|
Reference in New Issue
Block a user