diff options
author | Adrian DC <radian.dc@gmail.com> | 2014-06-09 21:16:24 -0500 |
---|---|---|
committer | Adrian DC <radian.dc@gmail.com> | 2016-09-15 10:26:56 -0700 |
commit | 4a78446c3e9eab9c116e1523425d366f401ef13e (patch) | |
tree | 187ab5a0d790153e49f2b39843f0d9fe54f82f2b /src/com/android/settings | |
parent | 8bac7b3f128db6df21acbc8b7668d240e9bc1802 (diff) | |
download | packages_apps_Settings-4a78446c3e9eab9c116e1523425d366f401ef13e.zip packages_apps_Settings-4a78446c3e9eab9c116e1523425d366f401ef13e.tar.gz packages_apps_Settings-4a78446c3e9eab9c116e1523425d366f401ef13e.tar.bz2 |
DevelopmentSettings: Add an opt-out for recovery updater
* Some devices should not have this option,
for instance all Sony devices supported on CyanogenMod
already include the ROM's recovery inside the ramdisk
and provide their own init_sony boot selection
* Makes sure a user did not enable the option
on old installations by disabling it if needed
* Disable the recovery updater through the new overlay
* Prevent recovery updater related features to run, and
pass an additional context argument from BootReceiver
to initializeUpdateRecoveryOption to access resources
* Similar to the original CM 11.0 commit by Dan Pasanen
Change-Id: I1963e27e59353e1a7e26a4edf905bee6c9da0571
Diffstat (limited to 'src/com/android/settings')
-rw-r--r-- | src/com/android/settings/DevelopmentSettings.java | 22 | ||||
-rw-r--r-- | src/com/android/settings/cyanogenmod/BootReceiver.java | 2 |
2 files changed, 19 insertions, 5 deletions
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java index a30dba2..b5b89cb 100644 --- a/src/com/android/settings/DevelopmentSettings.java +++ b/src/com/android/settings/DevelopmentSettings.java @@ -519,6 +519,15 @@ public class DevelopmentSettings extends SettingsPreferenceFragment removePreference(COLOR_TEMPERATURE_KEY); mColorTemperaturePreference = null; } + + if (!getResources().getBoolean(R.bool.config_enableRecoveryUpdater)) { + removePreference(mUpdateRecovery); + mUpdateRecovery = null; + if (SystemProperties.getBoolean(UPDATE_RECOVERY_PROPERTY, false)) { + SystemProperties.set(UPDATE_RECOVERY_PROPERTY, "false"); + pokeSystemProperties(); + } + } } private ListPreference addListPreference(String prefKey) { @@ -754,7 +763,9 @@ public class DevelopmentSettings extends SettingsPreferenceFragment updateRootAccessOptions(); updateAdvancedRebootOptions(); updateDevelopmentShortcutOptions(); - updateUpdateRecoveryOptions(); + if (mUpdateRecovery != null) { + updateUpdateRecoveryOptions(); + } if (mColorTemperaturePreference != null) { updateColorTemperature(); } @@ -830,7 +841,9 @@ public class DevelopmentSettings extends SettingsPreferenceFragment resetAdbNotifyOptions(); resetVerifyAppsOverUsbOptions(); resetDevelopmentShortcutOptions(); - resetUpdateRecoveryOptions(); + if (mUpdateRecovery != null) { + resetUpdateRecoveryOptions(); + } writeAnimationScaleOption(0, mWindowAnimationScale, null); writeAnimationScaleOption(1, mTransitionAnimationScale, null); writeAnimationScaleOption(2, mAnimatorDurationScale, null); @@ -1855,8 +1868,9 @@ public class DevelopmentSettings extends SettingsPreferenceFragment } } - public static void initializeUpdateRecoveryOption() { - if (TextUtils.isEmpty(SystemProperties.get(UPDATE_RECOVERY_PROPERTY))) { + public static void initializeUpdateRecoveryOption(Context context) { + if (TextUtils.isEmpty(SystemProperties.get(UPDATE_RECOVERY_PROPERTY)) && + context.getResources().getBoolean(R.bool.config_enableRecoveryUpdater)) { resetUpdateRecoveryOptions(); } } diff --git a/src/com/android/settings/cyanogenmod/BootReceiver.java b/src/com/android/settings/cyanogenmod/BootReceiver.java index 20190e6..406ccb1 100644 --- a/src/com/android/settings/cyanogenmod/BootReceiver.java +++ b/src/com/android/settings/cyanogenmod/BootReceiver.java @@ -53,7 +53,7 @@ public class BootReceiver extends BroadcastReceiver { // Extract the contributors database ContributorsCloudFragment.extractContributorsCloudDatabase(ctx); - DevelopmentSettings.initializeUpdateRecoveryOption(); + DevelopmentSettings.initializeUpdateRecoveryOption(ctx); } private boolean hasRestoredTunable(Context context) { |