Updater: No need to install every update

* Apparently users are not aware that they don't have to install every
  update we ever released (weeklies) after they have skipped some due
  to various reasons
* Since we are providing full installation packages, remind the user that
  it's ok to only ever choose the newest one

Change-Id: I70f9acd70344f36aaae7e45b848f6bcb7a8b3c0f
This commit is contained in:
Michael W
2022-02-05 15:22:41 +01:00
committed by Bruno Martins
parent d2557b8c6c
commit 811d050272
3 changed files with 25 additions and 1 deletions

View File

@@ -152,4 +152,8 @@
<string name="new_updates_channel_title">New updates</string> <string name="new_updates_channel_title">New updates</string>
<string name="ongoing_channel_title">Ongoing downloads</string> <string name="ongoing_channel_title">Ongoing downloads</string>
<string name="update_failed_channel_title">Update failed</string> <string name="update_failed_channel_title">Update failed</string>
<string name="info_dialog_title">Did you know?</string>
<string name="info_dialog_message">LineageOS updates are full installation packages. That means you can always install only the latest update, even if you skipped some in between!</string>
<string name="info_dialog_ok">Thanks for the info!</string>
</resources> </resources>

View File

@@ -477,7 +477,10 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
.setMessage(mActivity.getString(resId, buildInfoText, .setMessage(mActivity.getString(resId, buildInfoText,
mActivity.getString(android.R.string.ok))) mActivity.getString(android.R.string.ok)))
.setPositiveButton(android.R.string.ok, .setPositiveButton(android.R.string.ok,
(dialog, which) -> Utils.triggerUpdate(mActivity, downloadId)) (dialog, which) -> {
Utils.triggerUpdate(mActivity, downloadId);
maybeShowInfoDialog();
})
.setNegativeButton(android.R.string.cancel, null); .setNegativeButton(android.R.string.cancel, null);
} }
@@ -493,6 +496,21 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
.setNegativeButton(android.R.string.cancel, null); .setNegativeButton(android.R.string.cancel, null);
} }
private void maybeShowInfoDialog() {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mActivity);
boolean alreadySeen = preferences.getBoolean(Constants.HAS_SEEN_INFO_DIALOG, false);
if (alreadySeen) {
return;
}
new AlertDialog.Builder(mActivity)
.setTitle(R.string.info_dialog_title)
.setMessage(R.string.info_dialog_message)
.setPositiveButton(R.string.info_dialog_ok, (dialog, which) -> preferences.edit()
.putBoolean(Constants.HAS_SEEN_INFO_DIALOG, true)
.apply())
.show();
}
private void startActionMode(final UpdateInfo update, final boolean canDelete, View anchor) { private void startActionMode(final UpdateInfo update, final boolean canDelete, View anchor) {
mSelectedDownload = update.getDownloadId(); mSelectedDownload = update.getDownloadId();
notifyItemChanged(update.getDownloadId()); notifyItemChanged(update.getDownloadId());

View File

@@ -55,4 +55,6 @@ public final class Constants {
public static final String UPDATE_RECOVERY_EXEC = "/vendor/bin/install-recovery.sh"; public static final String UPDATE_RECOVERY_EXEC = "/vendor/bin/install-recovery.sh";
public static final String UPDATE_RECOVERY_PROPERTY = "persist.vendor.recovery_update"; public static final String UPDATE_RECOVERY_PROPERTY = "persist.vendor.recovery_update";
public static final String HAS_SEEN_INFO_DIALOG = "has_seen_info_dialog";
} }