Move APPLY_RAMPING_RINGER from Global to System

This configuration should be user-scoped.

Bug: 184165158
Test: AccessibilitySettingsTest
      RingVibrationPreferenceFragmentTest
      VibrateForCallsPreferenceControllerTest
      VibrateForCallsPreferenceFragmentTest
Change-Id: I7b8684fb1cf03d41872a700fd8732c76422e37c3
This commit is contained in:
Lais Andrade
2021-11-04 12:10:49 +00:00
parent 74a797efd8
commit 24b2d9e5a1
9 changed files with 38 additions and 38 deletions

View File

@@ -295,8 +295,8 @@ public class AccessibilitySettings extends DashboardFragment {
}
static boolean isRampingRingerEnabled(final Context context) {
return Settings.Global.getInt(
context.getContentResolver(), Settings.Global.APPLY_RAMPING_RINGER, 0) == 1;
return Settings.System.getInt(
context.getContentResolver(), Settings.System.APPLY_RAMPING_RINGER, 0) == 1;
}
@VisibleForTesting

View File

@@ -47,7 +47,7 @@ public class RingVibrationPreferenceFragment extends VibrationPreferenceFragment
@Override
protected String getVibrationEnabledSetting() {
if (AccessibilitySettings.isRampingRingerEnabled(getContext())) {
return Settings.Global.APPLY_RAMPING_RINGER;
return Settings.System.APPLY_RAMPING_RINGER;
} else {
return Settings.System.VIBRATE_WHEN_RINGING;
}

View File

@@ -116,12 +116,12 @@ public abstract class VibrationPreferenceFragment extends RadioButtonPickerFragm
// Update vibration enabled setting
final String vibrationEnabledSetting = getVibrationEnabledSetting();
final boolean wasEnabled = TextUtils.equals(
vibrationEnabledSetting, Settings.Global.APPLY_RAMPING_RINGER)
vibrationEnabledSetting, Settings.System.APPLY_RAMPING_RINGER)
? true
: (Settings.System.getInt(
getContext().getContentResolver(), vibrationEnabledSetting, 1) == 1);
if (vibrationEnabled != wasEnabled) {
if (vibrationEnabledSetting.equals(Settings.Global.APPLY_RAMPING_RINGER)) {
if (vibrationEnabledSetting.equals(Settings.System.APPLY_RAMPING_RINGER)) {
Settings.Global.putInt(getContext().getContentResolver(),
vibrationEnabledSetting, 0);
} else {
@@ -212,7 +212,7 @@ public abstract class VibrationPreferenceFragment extends RadioButtonPickerFragm
getVibrationIntensitySetting(), getDefaultVibrationIntensity());
final String vibrationEnabledSetting = getVibrationEnabledSetting();
final boolean vibrationEnabled = TextUtils.equals(
vibrationEnabledSetting, Settings.Global.APPLY_RAMPING_RINGER)
vibrationEnabledSetting, Settings.System.APPLY_RAMPING_RINGER)
? true
: (Settings.System.getInt(
getContext().getContentResolver(), vibrationEnabledSetting, 1) == 1);