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

Commit e46b6d5c authored by Wilson Wu's avatar Wilson Wu
Browse files

Default keyboard vibration settings to touch feedback

Independent keyboard vibration settings is default on,
it may be confusing if the user disable haptic but get
keyboard haptics after OTA.

Set the keyboard vibration default value based on the
touch feedback settings to mitigate the confusion.

Bug: 326648023
Test: manual
Change-Id: I68be12e7394b9c2f5c19b377a3bbce9259b869c7
parent 54a9156d
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
@@ -3812,7 +3812,7 @@ public class SettingsProvider extends ContentProvider {
        }

        private final class UpgradeController {
            private static final int SETTINGS_VERSION = 225;
            private static final int SETTINGS_VERSION = 226;

            private final int mUserId;

@@ -6011,6 +6011,28 @@ public class SettingsProvider extends ContentProvider {
                    currentVersion = 225;
                }

                // Version 225: Set the System#KEYBOARD_VIBRATION_ENABLED based on touch
                // feedback enabled state.
                if (currentVersion == 225) {
                    final SettingsState systemSettings = getSystemSettingsLocked(userId);
                    final Setting touchFeedbackSettings = systemSettings
                            .getSettingLocked(Settings.System.HAPTIC_FEEDBACK_ENABLED);
                    final Setting keyboardVibrationSettings = systemSettings
                            .getSettingLocked(Settings.System.KEYBOARD_VIBRATION_ENABLED);
                    if (keyboardVibrationSettings.isNull()) {
                        if (!touchFeedbackSettings.isNull()) {
                            // Use touch feedback settings.
                            systemSettings.insertSettingOverrideableByRestoreLocked(
                                    Settings.System.KEYBOARD_VIBRATION_ENABLED,
                                    touchFeedbackSettings.getValue(),
                                    touchFeedbackSettings.getTag(),
                                    touchFeedbackSettings.isDefaultFromSystem(),
                                    SettingsState.SYSTEM_PACKAGE_NAME);
                        }
                    }
                    currentVersion = 226;
                }

                // vXXX: Add new settings above this point.

                if (currentVersion != newVersion) {