Commit e46f532c authored by LuK1337's avatar LuK1337

Updater: Fix 'REBOOT' button not showing up after A/B update

* After update is complete button is being handled in
  handleNotActiveStatus instead of handleActiveStatus.

Change-Id: I6a4df580f93b71fd12e902801125acae668ec991
parent 412810e0
......@@ -161,11 +161,6 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
setButtonAction(viewHolder.mAction, Action.INSTALL, downloadId, false);
viewHolder.mProgressText.setText(R.string.list_verifying_update);
viewHolder.mProgressBar.setIndeterminate(true);
} else if (mUpdaterController.isWaitingForReboot(downloadId)) {
setButtonAction(viewHolder.mAction, Action.REBOOT, downloadId, false);
viewHolder.mProgressText.setText(R.string.installing_update_finished);
viewHolder.mProgressBar.setIndeterminate(false);
viewHolder.mProgressBar.setProgress(100);
} else {
canDelete = true;
setButtonAction(viewHolder.mAction, Action.RESUME, downloadId, !isBusy());
......@@ -188,20 +183,25 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
}
private void handleNotActiveStatus(ViewHolder viewHolder, UpdateInfo update) {
if (update.getPersistentStatus() == UpdateStatus.Persistent.VERIFIED) {
final String downloadId = update.getDownloadId();
if (mUpdaterController.isWaitingForReboot(downloadId)) {
viewHolder.itemView.setOnLongClickListener(
getLongClickListener(update, false, viewHolder.mBuildDate));
setButtonAction(viewHolder.mAction, Action.REBOOT, downloadId, true);
} else if (update.getPersistentStatus() == UpdateStatus.Persistent.VERIFIED) {
viewHolder.itemView.setOnLongClickListener(
getLongClickListener(update, true, viewHolder.mBuildDate));
setButtonAction(viewHolder.mAction,
Utils.canInstall(update) ? Action.INSTALL : Action.DELETE,
update.getDownloadId(), !isBusy());
downloadId, !isBusy());
} else if (!Utils.canInstall(update)) {
viewHolder.itemView.setOnLongClickListener(
getLongClickListener(update, false, viewHolder.mBuildDate));
setButtonAction(viewHolder.mAction, Action.INFO, update.getDownloadId(), !isBusy());
setButtonAction(viewHolder.mAction, Action.INFO, downloadId, !isBusy());
} else {
viewHolder.itemView.setOnLongClickListener(
getLongClickListener(update, false, viewHolder.mBuildDate));
setButtonAction(viewHolder.mAction, Action.DOWNLOAD, update.getDownloadId(), !isBusy());
setButtonAction(viewHolder.mAction, Action.DOWNLOAD, downloadId, !isBusy());
}
String fileSize = Formatter.formatShortFileSize(mActivity, update.getFileSize());
viewHolder.mBuildSize.setText(fileSize);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment