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

Commit 5d999e26 authored by wilsonshih's avatar wilsonshih
Browse files

Upgrade ring vibration level after OTA.

In Q we separate "ring vibration" from "ring and notification
vibration", when user upgrade from P to Q, the value should followed the
settings in P.

Bug: 127901773
Test: simulating upgrade device from P to Q, then check ring vibration
level is followed notification vibration level.
Test: flash Q Rom and check ring vibration is default value.

Change-Id: Id63e0a777be00c5c51dbeb43655c04ee9f66989d
parent bed3db4d
Loading
Loading
Loading
Loading
+26 −1
Original line number Diff line number Diff line
@@ -3235,7 +3235,7 @@ public class SettingsProvider extends ContentProvider {
        }

        private final class UpgradeController {
            private static final int SETTINGS_VERSION = 175;
            private static final int SETTINGS_VERSION = 176;

            private final int mUserId;

@@ -4286,6 +4286,31 @@ public class SettingsProvider extends ContentProvider {
                    currentVersion = 175;
                }

                if (currentVersion == 175) {
                    // Version 175: Set the default value for System Settings:
                    // RING_VIBRATION_INTENSITY. If the notification vibration intensity has been
                    // set and ring vibration intensity hasn't, the ring vibration intensity should
                    // followed notification vibration intensity.

                    final SettingsState systemSettings = getSystemSettingsLocked(userId);

                    Setting notificationVibrationIntensity = systemSettings.getSettingLocked(
                            Settings.System.NOTIFICATION_VIBRATION_INTENSITY);

                    Setting ringVibrationIntensity = systemSettings.getSettingLocked(
                            Settings.System.RING_VIBRATION_INTENSITY);

                    if (!notificationVibrationIntensity.isNull()
                            && ringVibrationIntensity.isNull()) {
                        systemSettings.insertSettingLocked(
                                Settings.System.RING_VIBRATION_INTENSITY,
                                notificationVibrationIntensity.getValue(),
                                null , true, SettingsState.SYSTEM_PACKAGE_NAME);
                    }

                    currentVersion = 176;
                }

                // vXXX: Add new settings above this point.

                if (currentVersion != newVersion) {