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

Commit 0e9eeee0 authored by Michael Wright's avatar Michael Wright
Browse files

Add per-device defaults for VIBRATE_WHEN_RINGING

Some devices have hand-crafted, artisanal haptics to go along with the
dulcet tones of the ringer. When making such a device, we really want
our users to have the opportunity to appreciate the fine buzzes and
clicks we spent so long orchestrating, and so this makes it possible to
default VIBRATE_WHEN_RINGING on.

Bug: 79212179
Test: manual
Change-Id: I52bf133345bd3e8b09b591b9bac4711d0d485094
parent 64a33d69
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -214,4 +214,7 @@

    <!-- Default for Settings.Global.BACKUP_AGENT_TIMEOUT_PARAMETERS -->
    <string name="def_backup_agent_timeout_parameters"></string>

    <!-- Default for Settings.System.VIBRATE_WHEN_RINGING -->
    <bool name="def_vibrate_when_ringing">false</bool>
</resources>
+16 −1
Original line number Diff line number Diff line
@@ -2935,7 +2935,7 @@ public class SettingsProvider extends ContentProvider {
        }

        private final class UpgradeController {
            private static final int SETTINGS_VERSION = 168;
            private static final int SETTINGS_VERSION = 169;

            private final int mUserId;

@@ -3805,6 +3805,21 @@ public class SettingsProvider extends ContentProvider {
                    currentVersion = 168;
                }

                if (currentVersion == 168) {
                    // Version 168: by default, vibrate for phone calls
                    final SettingsState systemSettings = getSystemSettingsLocked(userId);
                    final Setting currentSetting = systemSettings.getSettingLocked(
                            Settings.System.VIBRATE_WHEN_RINGING);
                    if (currentSetting.isNull()) {
                        systemSettings.insertSettingLocked(
                                Settings.System.VIBRATE_WHEN_RINGING,
                                getContext().getResources().getBoolean(
                                        R.bool.def_vibrate_when_ringing) ? "1" : "0",
                                null, true, SettingsState.SYSTEM_PACKAGE_NAME);
                    }
                    currentVersion = 169;
                }

                // vXXX: Add new settings above this point.

                if (currentVersion != newVersion) {