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

Commit cb60c7a8 authored by Adrian Roos's avatar Adrian Roos
Browse files

Ambient: If user turned off ambient, keep it off after split

The split ambient settings default to on - which is a bad experience
if the user explicitly turned it off before the split.

Change-Id: I346a53b0dc9cdf578c238113f4f33056ba0f3aea
Merged-In: I986d35a1a28e97f4c8d7d3d47ed5658e1836a44f
Fixes: 32332195
Test: Flash angler to NYC, disable ambient, upgrade to NYC-MR1, check if "Lift to check phone" is still off.
parent 4f14be3d
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -2102,7 +2102,7 @@ public class SettingsProvider extends ContentProvider {
        }

        private final class UpgradeController {
            private static final int SETTINGS_VERSION = 131;
            private static final int SETTINGS_VERSION = 132;

            private final int mUserId;

@@ -2417,6 +2417,21 @@ public class SettingsProvider extends ContentProvider {
                }

                if (currentVersion == 130) {
                    // Split Ambient settings
                    final SettingsState secureSettings = getSecureSettingsLocked(userId);
                    boolean dozeExplicitlyDisabled = "0".equals(secureSettings.
                            getSettingLocked(Settings.Secure.DOZE_ENABLED).getValue());

                    if (dozeExplicitlyDisabled) {
                        secureSettings.insertSettingLocked(Settings.Secure.DOZE_PULSE_ON_PICK_UP,
                                "0", SettingsState.SYSTEM_PACKAGE_NAME);
                        secureSettings.insertSettingLocked(Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP,
                                "0", SettingsState.SYSTEM_PACKAGE_NAME);
                    }
                    currentVersion = 131;
                }

                if (currentVersion == 131) {
                    // Initialize new multi-press timeout to default value
                    final SettingsState systemSecureSettings = getSecureSettingsLocked(userId);
                    final String oldValue = systemSecureSettings.getSettingLocked(
@@ -2429,7 +2444,7 @@ public class SettingsProvider extends ContentProvider {
                                SettingsState.SYSTEM_PACKAGE_NAME);
                    }

                    currentVersion = 131;
                    currentVersion = 132;
                }

                if (currentVersion != newVersion) {