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

Commit 931b41b7 authored by Annie Meng's avatar Annie Meng
Browse files

Don't backup/restore screen brightness

We no longer want to backup and restore screen brightness as it could
leave the new device in an unusable state and doesn't make sense
cross-device.

Test: 1) atest SettingsBackupTest
2) atest SettingsValidatorsTest
3) Manual:
- Old backup set that has screen brightness does not restore with change
- Screen brightness does not backup or restore with change
Bug: 77583401

Change-Id: I8a6d950717e6aeb9bf6773c14708ee70069f9df0
parent e15978ce
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -3133,9 +3133,6 @@ public final class Settings {
         */
        public static final String SCREEN_BRIGHTNESS = "screen_brightness";

        private static final Validator SCREEN_BRIGHTNESS_VALIDATOR =
                new SettingsValidators.InclusiveIntegerRangeValidator(0, 255);

        /**
         * The screen backlight brightness between 0 and 255.
         * @hide
@@ -4079,7 +4076,6 @@ public final class Settings {
            FONT_SCALE,
            DIM_SCREEN,
            SCREEN_OFF_TIMEOUT,
            SCREEN_BRIGHTNESS,
            SCREEN_BRIGHTNESS_MODE,
            SCREEN_AUTO_BRIGHTNESS_ADJ,
            SCREEN_BRIGHTNESS_FOR_VR,
@@ -4250,7 +4246,6 @@ public final class Settings {
            VALIDATORS.put(FONT_SCALE, FONT_SCALE_VALIDATOR);
            VALIDATORS.put(DIM_SCREEN, DIM_SCREEN_VALIDATOR);
            VALIDATORS.put(SCREEN_OFF_TIMEOUT, SCREEN_OFF_TIMEOUT_VALIDATOR);
            VALIDATORS.put(SCREEN_BRIGHTNESS, SCREEN_BRIGHTNESS_VALIDATOR);
            VALIDATORS.put(SCREEN_BRIGHTNESS_FOR_VR, SCREEN_BRIGHTNESS_FOR_VR_VALIDATOR);
            VALIDATORS.put(SCREEN_BRIGHTNESS_MODE, SCREEN_BRIGHTNESS_MODE_VALIDATOR);
            VALIDATORS.put(MODE_RINGER_STREAMS_AFFECTED, MODE_RINGER_STREAMS_AFFECTED_VALIDATOR);
+1 −0
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ public class SettingsBackupTest {
                    Settings.System.POINTER_LOCATION, // backup candidate?
                    Settings.System.DEBUG_ENABLE_ENHANCED_CALL_BLOCKING, // used for testing only
                    Settings.System.RINGTONE_CACHE, // internal cache
                    Settings.System.SCREEN_BRIGHTNESS, // removed in P
                    Settings.System.SETUP_WIZARD_HAS_RUN, // Only used by SuW
                    Settings.System.SHOW_GTALK_SERVICE_STATUS, // candidate for backup?
                    Settings.System.SHOW_TOUCHES, // bug?
+1 −8
Original line number Diff line number Diff line
@@ -144,10 +144,7 @@ public class SettingsHelper {
        }

        try {
            if (Settings.System.SCREEN_BRIGHTNESS.equals(name)) {
                setBrightness(Integer.parseInt(value));
                // fall through to the ordinary write to settings
            } else if (Settings.System.SOUND_EFFECTS_ENABLED.equals(name)) {
            if (Settings.System.SOUND_EFFECTS_ENABLED.equals(name)) {
                setSoundEffects(Integer.parseInt(value) == 1);
                // fall through to the ordinary write to settings
            } else if (Settings.Secure.LOCATION_PROVIDERS_ALLOWED.equals(name)) {
@@ -305,10 +302,6 @@ public class SettingsHelper {
        }
    }

    private void setBrightness(int brightness) {
        mContext.getSystemService(DisplayManager.class).setTemporaryBrightness(brightness);
    }

    /* package */ byte[] getLocaleData() {
        Configuration conf = mContext.getResources().getConfiguration();
        return conf.getLocales().toLanguageTags().getBytes();