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
This commit is contained in:
Michael Wright
2018-05-26 00:31:20 +01:00
parent 64a33d695d
commit 0e9eeee0dd
2 changed files with 19 additions and 1 deletions

View File

@@ -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>

View File

@@ -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) {