Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 3a7f69f5 authored by Adrian DC's avatar Adrian DC
Browse files

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: Ieb398ba82f8bf89fa41942ad5b515e7030afa2a7
parent 57d0ca97
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -98,4 +98,7 @@
    <!-- This is use to determine whether to hide the performance settings-->
    <bool name="config_hidePerformanceSettings" translatable="false">false</bool>

    <!-- Does the device allow updating the recovery. -->
    <bool name="config_enableRecoveryUpdater">true</bool>

</resources>
+15 −2
Original line number Diff line number Diff line
@@ -394,6 +394,15 @@ public class DevelopmentSettings extends RestrictedSettingsFragment

        mDevelopmentTools = (PreferenceScreen) findPreference(DEVELOPMENT_TOOLS);
        mAllPrefs.add(mDevelopmentTools);

        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) {
@@ -604,8 +613,10 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
        updateRootAccessOptions();
        updateAdvancedRebootOptions();
        updateDevelopmentShortcutOptions();
        if (mUpdateRecovery != null) {
            updateUpdateRecoveryOptions();
        }
    }

    private void writeAdvancedRebootOptions() {
        Settings.Secure.putInt(getActivity().getContentResolver(),
@@ -676,7 +687,9 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
        resetAdbNotifyOptions();
        resetVerifyAppsOverUsbOptions();
        resetDevelopmentShortcutOptions();
        if (mUpdateRecovery != null) {
            resetUpdateRecoveryOptions();
        }
        writeAnimationScaleOption(0, mWindowAnimationScale, null);
        writeAnimationScaleOption(1, mTransitionAnimationScale, null);
        writeAnimationScaleOption(2, mAnimatorDurationScale, null);