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

Commit 4a78446c 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: I1963e27e59353e1a7e26a4edf905bee6c9da0571
parent 8bac7b3f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -101,4 +101,7 @@
    <!-- Does the device allow for manual subscription provisioning? Only works for multi-sim devices,
         and currently depends on QC's proprietary telephony stack -->
    <bool name="config_enableManualSubProvisioning">true</bool>

    <!-- Does the device allow updating the recovery. -->
    <bool name="config_enableRecoveryUpdater">true</bool>
</resources>
+18 −4
Original line number Diff line number Diff line
@@ -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();
        if (mUpdateRecovery != null) {
            updateUpdateRecoveryOptions();
        }
        if (mColorTemperaturePreference != null) {
            updateColorTemperature();
        }
@@ -830,7 +841,9 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
        resetAdbNotifyOptions();
        resetVerifyAppsOverUsbOptions();
        resetDevelopmentShortcutOptions();
        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();
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -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) {