From bc9e3664bd2f8a81627cb19557697c5e6155f06c Mon Sep 17 00:00:00 2001 From: SahilSonar Date: Sun, 6 Oct 2024 16:33:10 +0530 Subject: [PATCH] Updater: Kill recovery update option - Enabled by default. --- .../lineageos/updater/UpdatesActivity.java | 34 ------------------- .../org/lineageos/updater/misc/Constants.java | 3 -- .../org/lineageos/updater/misc/Utils.java | 4 --- .../main/res/layout/preferences_dialog.xml | 7 ---- app/src/main/res/values/config.xml | 20 ----------- app/src/main/res/values/symbols.xml | 20 ----------- 6 files changed, 88 deletions(-) delete mode 100644 app/src/main/res/values/config.xml delete mode 100644 app/src/main/res/values/symbols.xml diff --git a/app/src/main/java/org/lineageos/updater/UpdatesActivity.java b/app/src/main/java/org/lineageos/updater/UpdatesActivity.java index d9d4aea2..0837346e 100644 --- a/app/src/main/java/org/lineageos/updater/UpdatesActivity.java +++ b/app/src/main/java/org/lineageos/updater/UpdatesActivity.java @@ -597,7 +597,6 @@ public class UpdatesActivity extends UpdatesListActivity implements UpdateImport SwitchCompat meteredNetworkWarning = view.findViewById( R.id.preferences_metered_network_warning); SwitchCompat abPerfMode = view.findViewById(R.id.preferences_ab_perf_mode); - SwitchCompat updateRecovery = view.findViewById(R.id.preferences_update_recovery); if (!Utils.isABDevice()) { abPerfMode.setVisibility(View.GONE); @@ -630,34 +629,6 @@ public class UpdatesActivity extends UpdatesListActivity implements UpdateImport abPerfMode.setChecked(prefs.getBoolean(Constants.PREF_AB_PERF_MODE, getResources().getBoolean(R.bool.config_prioritizeUpdateProcess))); - if (getResources().getBoolean(R.bool.config_hideRecoveryUpdate)) { - // Hide the update feature if explicitly requested. - // Might be the case of A-only devices using prebuilt vendor images. - updateRecovery.setVisibility(View.GONE); - } else if (Utils.isRecoveryUpdateExecPresent()) { - updateRecovery.setChecked( - SystemProperties.getBoolean(Constants.UPDATE_RECOVERY_PROPERTY, false)); - } else { - // There is no recovery updater script in the device, so the feature is considered - // forcefully enabled, just to avoid users to be confused and complain that - // recovery gets overwritten. That's the case of A/B and recovery-in-boot devices. - updateRecovery.setChecked(true); - updateRecovery.setOnTouchListener(new View.OnTouchListener() { - private Toast forcedUpdateToast = null; - - @Override - public boolean onTouch(View v, MotionEvent event) { - if (forcedUpdateToast != null) { - forcedUpdateToast.cancel(); - } - forcedUpdateToast = Toast.makeText(getApplicationContext(), - getString(R.string.toast_forced_update_recovery), Toast.LENGTH_SHORT); - forcedUpdateToast.show(); - return true; - } - }); - } - new AlertDialog.Builder(this) .setTitle(R.string.menu_preferences) .setView(view) @@ -683,11 +654,6 @@ public class UpdatesActivity extends UpdatesListActivity implements UpdateImport boolean enableABPerfMode = abPerfMode.isChecked(); mUpdaterService.getUpdaterController().setPerformanceMode(enableABPerfMode); } - if (Utils.isRecoveryUpdateExecPresent()) { - boolean enableRecoveryUpdate = updateRecovery.isChecked(); - SystemProperties.set(Constants.UPDATE_RECOVERY_PROPERTY, - String.valueOf(enableRecoveryUpdate)); - } }) .show(); } diff --git a/app/src/main/java/org/lineageos/updater/misc/Constants.java b/app/src/main/java/org/lineageos/updater/misc/Constants.java index 5c38037a..b3c6185d 100644 --- a/app/src/main/java/org/lineageos/updater/misc/Constants.java +++ b/app/src/main/java/org/lineageos/updater/misc/Constants.java @@ -62,9 +62,6 @@ public final class Constants { public static final String PREF_INSTALL_AGAIN = "install_again"; public static final String PREF_INSTALL_NOTIFIED = "install_notified"; - 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 RESUME_DOWNLOAD_ID = "resume_download_id"; public static final String AUTO_UPDATE_CHECK_FAILED = "auto_update_check_failed"; } diff --git a/app/src/main/java/org/lineageos/updater/misc/Utils.java b/app/src/main/java/org/lineageos/updater/misc/Utils.java index 8be60282..3b8f6830 100644 --- a/app/src/main/java/org/lineageos/updater/misc/Utils.java +++ b/app/src/main/java/org/lineageos/updater/misc/Utils.java @@ -594,10 +594,6 @@ public class Utils { } } - public static boolean isRecoveryUpdateExecPresent() { - return new File(Constants.UPDATE_RECOVERY_EXEC).exists(); - } - public static boolean isBatteryLevelOk(Context context) { Intent intent = context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); diff --git a/app/src/main/res/layout/preferences_dialog.xml b/app/src/main/res/layout/preferences_dialog.xml index bad8f44a..49ec137d 100644 --- a/app/src/main/res/layout/preferences_dialog.xml +++ b/app/src/main/res/layout/preferences_dialog.xml @@ -60,11 +60,4 @@ android:text="@string/menu_ab_perf_mode" android:textSize="16sp" /> - diff --git a/app/src/main/res/values/config.xml b/app/src/main/res/values/config.xml deleted file mode 100644 index 16ab670f..00000000 --- a/app/src/main/res/values/config.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - false - false - diff --git a/app/src/main/res/values/symbols.xml b/app/src/main/res/values/symbols.xml deleted file mode 100644 index 992614c0..00000000 --- a/app/src/main/res/values/symbols.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - -- GitLab