Loading res/layout/preferences_dialog.xml +8 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,14 @@ android:text="@string/menu_ab_perf_mode" android:textSize="16sp" /> <androidx.appcompat.widget.SwitchCompat android:id="@+id/preferences_ab_auto_install" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" android:text="@string/menu_auto_install" android:textSize="16sp" /> <androidx.appcompat.widget.SwitchCompat android:id="@+id/preferences_update_recovery" android:layout_width="match_parent" Loading res/values/strings.xml +1 −1 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ <string name="menu_show_release_notes">Show release notes</string> <string name="menu_changelog_url" translatable="false">https://gitlab.e.foundation/e/os/releases/-/releases/v<xliff:g id="build_version">%1$s</xliff:g>-r</string> <string name="menu_ab_perf_mode">Prioritize update process</string> <string name="menu_auto_install">Install updates after download</string> <string name="menu_update_recovery">Update recovery</string> <string name="toast_forced_update_recovery">It is impossible to disable Lineage Recovery updates on this device.</string> Loading Loading @@ -106,7 +107,6 @@ <string name="list_no_updates">No new updates found. To manually check for new updates, use the Refresh button.</string> <string name="action_download">Download</string> <string name="action_download_install">Update</string> <string name="action_pause">Pause</string> <string name="action_resume">Resume</string> <string name="action_install">Install</string> Loading src/org/lineageos/updater/UpdatesActivity.java +4 −0 Original line number Diff line number Diff line Loading @@ -457,16 +457,19 @@ public class UpdatesActivity extends UpdatesListActivity { SwitchCompat autoDelete = view.findViewById(R.id.preferences_auto_delete_updates); SwitchCompat dataWarning = view.findViewById(R.id.preferences_mobile_data_warning); SwitchCompat abPerfMode = view.findViewById(R.id.preferences_ab_perf_mode); SwitchCompat abAutoInstall = view.findViewById(R.id.preferences_ab_auto_install); SwitchCompat updateRecovery = view.findViewById(R.id.preferences_update_recovery); if (!Utils.isABDevice()) { abPerfMode.setVisibility(View.GONE); abAutoInstall.setVisibility(View.GONE); } SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); autoCheckInterval.setSelection(Utils.getUpdateCheckSetting(this)); autoDelete.setChecked(prefs.getBoolean(Constants.PREF_AUTO_DELETE_UPDATES, true)); dataWarning.setChecked(prefs.getBoolean(Constants.PREF_MOBILE_DATA_WARNING, true)); abAutoInstall.setChecked(prefs.getBoolean(Constants.PREF_AB_AUTO_INSTALL, false)); abPerfMode.setChecked(prefs.getBoolean(Constants.PREF_AB_PERF_MODE, getResources().getBoolean(R.bool.config_prioritizeUpdateProcess))); Loading Loading @@ -508,6 +511,7 @@ public class UpdatesActivity extends UpdatesListActivity { .putBoolean(Constants.PREF_AUTO_DELETE_UPDATES, autoDelete.isChecked()) .putBoolean(Constants.PREF_MOBILE_DATA_WARNING, dataWarning.isChecked()) .putBoolean(Constants.PREF_AB_PERF_MODE, abPerfMode.isChecked()) .putBoolean(Constants.PREF_AB_AUTO_INSTALL, abAutoInstall.isChecked()) .apply(); if (Utils.isUpdateCheckEnabled(this)) { Loading src/org/lineageos/updater/UpdatesListAdapter.java +3 −6 Original line number Diff line number Diff line Loading @@ -255,8 +255,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. if (update == null) { // The update was deleted viewHolder.mAction.setEnabled(false); viewHolder.mAction.setText(Utils.isABDevice() ? R.string.action_download_install : R.string.action_download); viewHolder.mAction.setText(R.string.action_download); return; } Loading Loading @@ -338,8 +337,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. .setTitle(R.string.update_on_mobile_data_title) .setMessage(R.string.update_on_mobile_data_message) .setView(checkboxView) .setPositiveButton(Utils.isABDevice() ? R.string.action_download_install : R.string.action_download, .setPositiveButton(R.string.action_download, (dialog, which) -> { if (checkbox.isChecked()) { preferences.edit() Loading @@ -358,8 +356,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. final View.OnClickListener clickListener; switch (action) { case DOWNLOAD: button.setText(Utils.isABDevice() ? R.string.action_download_install : R.string.action_download); button.setText(R.string.action_download); button.setEnabled(enabled); clickListener = enabled ? view -> startDownloadWithWarning(downloadId) : null; break; Loading src/org/lineageos/updater/controller/UpdaterService.java +5 −3 Original line number Diff line number Diff line Loading @@ -343,7 +343,11 @@ public class UpdaterService extends Service { } case VERIFIED: { stopForeground(STOP_FOREGROUND_DETACH); if (!Utils.isABDevice()) { SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); boolean enabledAutoInstall = pref.getBoolean(Constants.PREF_AB_AUTO_INSTALL, false); if (Utils.isABDevice() && enabledAutoInstall) { Utils.triggerUpdate(this, update.getDownloadId()); } else { mNotificationBuilder.setStyle(null); mNotificationBuilder.setSmallIcon(R.drawable.ic_system_update); mNotificationBuilder.setProgress(0, 0, false); Loading @@ -354,8 +358,6 @@ public class UpdaterService extends Service { mNotificationBuilder.setAutoCancel(true); mNotificationManager.notify(NOTIFICATION_ID, mNotificationBuilder.build()); tryStopSelf(); } else { Utils.triggerUpdate(this, update.getDownloadId()); } break; } Loading Loading
res/layout/preferences_dialog.xml +8 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,14 @@ android:text="@string/menu_ab_perf_mode" android:textSize="16sp" /> <androidx.appcompat.widget.SwitchCompat android:id="@+id/preferences_ab_auto_install" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" android:text="@string/menu_auto_install" android:textSize="16sp" /> <androidx.appcompat.widget.SwitchCompat android:id="@+id/preferences_update_recovery" android:layout_width="match_parent" Loading
res/values/strings.xml +1 −1 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ <string name="menu_show_release_notes">Show release notes</string> <string name="menu_changelog_url" translatable="false">https://gitlab.e.foundation/e/os/releases/-/releases/v<xliff:g id="build_version">%1$s</xliff:g>-r</string> <string name="menu_ab_perf_mode">Prioritize update process</string> <string name="menu_auto_install">Install updates after download</string> <string name="menu_update_recovery">Update recovery</string> <string name="toast_forced_update_recovery">It is impossible to disable Lineage Recovery updates on this device.</string> Loading Loading @@ -106,7 +107,6 @@ <string name="list_no_updates">No new updates found. To manually check for new updates, use the Refresh button.</string> <string name="action_download">Download</string> <string name="action_download_install">Update</string> <string name="action_pause">Pause</string> <string name="action_resume">Resume</string> <string name="action_install">Install</string> Loading
src/org/lineageos/updater/UpdatesActivity.java +4 −0 Original line number Diff line number Diff line Loading @@ -457,16 +457,19 @@ public class UpdatesActivity extends UpdatesListActivity { SwitchCompat autoDelete = view.findViewById(R.id.preferences_auto_delete_updates); SwitchCompat dataWarning = view.findViewById(R.id.preferences_mobile_data_warning); SwitchCompat abPerfMode = view.findViewById(R.id.preferences_ab_perf_mode); SwitchCompat abAutoInstall = view.findViewById(R.id.preferences_ab_auto_install); SwitchCompat updateRecovery = view.findViewById(R.id.preferences_update_recovery); if (!Utils.isABDevice()) { abPerfMode.setVisibility(View.GONE); abAutoInstall.setVisibility(View.GONE); } SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); autoCheckInterval.setSelection(Utils.getUpdateCheckSetting(this)); autoDelete.setChecked(prefs.getBoolean(Constants.PREF_AUTO_DELETE_UPDATES, true)); dataWarning.setChecked(prefs.getBoolean(Constants.PREF_MOBILE_DATA_WARNING, true)); abAutoInstall.setChecked(prefs.getBoolean(Constants.PREF_AB_AUTO_INSTALL, false)); abPerfMode.setChecked(prefs.getBoolean(Constants.PREF_AB_PERF_MODE, getResources().getBoolean(R.bool.config_prioritizeUpdateProcess))); Loading Loading @@ -508,6 +511,7 @@ public class UpdatesActivity extends UpdatesListActivity { .putBoolean(Constants.PREF_AUTO_DELETE_UPDATES, autoDelete.isChecked()) .putBoolean(Constants.PREF_MOBILE_DATA_WARNING, dataWarning.isChecked()) .putBoolean(Constants.PREF_AB_PERF_MODE, abPerfMode.isChecked()) .putBoolean(Constants.PREF_AB_AUTO_INSTALL, abAutoInstall.isChecked()) .apply(); if (Utils.isUpdateCheckEnabled(this)) { Loading
src/org/lineageos/updater/UpdatesListAdapter.java +3 −6 Original line number Diff line number Diff line Loading @@ -255,8 +255,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. if (update == null) { // The update was deleted viewHolder.mAction.setEnabled(false); viewHolder.mAction.setText(Utils.isABDevice() ? R.string.action_download_install : R.string.action_download); viewHolder.mAction.setText(R.string.action_download); return; } Loading Loading @@ -338,8 +337,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. .setTitle(R.string.update_on_mobile_data_title) .setMessage(R.string.update_on_mobile_data_message) .setView(checkboxView) .setPositiveButton(Utils.isABDevice() ? R.string.action_download_install : R.string.action_download, .setPositiveButton(R.string.action_download, (dialog, which) -> { if (checkbox.isChecked()) { preferences.edit() Loading @@ -358,8 +356,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter. final View.OnClickListener clickListener; switch (action) { case DOWNLOAD: button.setText(Utils.isABDevice() ? R.string.action_download_install : R.string.action_download); button.setText(R.string.action_download); button.setEnabled(enabled); clickListener = enabled ? view -> startDownloadWithWarning(downloadId) : null; break; Loading
src/org/lineageos/updater/controller/UpdaterService.java +5 −3 Original line number Diff line number Diff line Loading @@ -343,7 +343,11 @@ public class UpdaterService extends Service { } case VERIFIED: { stopForeground(STOP_FOREGROUND_DETACH); if (!Utils.isABDevice()) { SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); boolean enabledAutoInstall = pref.getBoolean(Constants.PREF_AB_AUTO_INSTALL, false); if (Utils.isABDevice() && enabledAutoInstall) { Utils.triggerUpdate(this, update.getDownloadId()); } else { mNotificationBuilder.setStyle(null); mNotificationBuilder.setSmallIcon(R.drawable.ic_system_update); mNotificationBuilder.setProgress(0, 0, false); Loading @@ -354,8 +358,6 @@ public class UpdaterService extends Service { mNotificationBuilder.setAutoCancel(true); mNotificationManager.notify(NOTIFICATION_ID, mNotificationBuilder.build()); tryStopSelf(); } else { Utils.triggerUpdate(this, update.getDownloadId()); } break; } Loading