Merge "Keep consistency between sound and accessibility settings."

This commit is contained in:
Yiwen Chen
2019-05-23 14:52:48 +00:00
committed by Android (Google) Code Review
7 changed files with 150 additions and 13 deletions

View File

@@ -36,6 +36,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.UserHandle;
import android.os.Vibrator;
import android.provider.DeviceConfig;
import android.provider.SearchIndexableResource;
import android.provider.Settings;
import android.text.TextUtils;
@@ -168,6 +169,8 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
private static final String ANIMATION_ON_VALUE = "1";
private static final String ANIMATION_OFF_VALUE = "0";
static final String RAMPING_RINGER_ENABLED = "ramping_ringer_enabled";
private final Map<String, String> mLongPressTimeoutValueToTitleMap = new HashMap<>();
private final Handler mHandler = new Handler();
@@ -389,6 +392,15 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
: stateSummaryCombo;
}
@VisibleForTesting
static boolean isRampingRingerEnabled(final Context context) {
return (Settings.Global.getInt(
context.getContentResolver(),
Settings.Global.APPLY_RAMPING_RINGER, 0) == 1)
&& DeviceConfig.getBoolean(
DeviceConfig.NAMESPACE_TELEPHONY, RAMPING_RINGER_ENABLED, false);
}
private void handleToggleTextContrastPreferenceClick() {
Settings.Secure.putInt(getContentResolver(),
Settings.Secure.ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED,
@@ -866,7 +878,7 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
Settings.System.RING_VIBRATION_INTENSITY,
vibrator.getDefaultRingVibrationIntensity());
if (Settings.System.getInt(context.getContentResolver(),
Settings.System.VIBRATE_WHEN_RINGING, 0) == 0) {
Settings.System.VIBRATE_WHEN_RINGING, 0) == 0 && !isRampingRingerEnabled(context)) {
ringIntensity = Vibrator.VIBRATION_INTENSITY_OFF;
}
CharSequence ringIntensityString =