Make sure vibration previews in Settings apply latest intensities

Update the Settings app to enforce fresh settings are applied to preview
vibrations triggered after the intensity is updated.

Add preview haptics to main switch, only when touch feedback is enabled,
and to the "apply ramping ringer" toggle for consistency with the rest
of the screen, using ringtone intensity for preview.

Bug: 219693646
Bug: 219695212
Bug: 157533521
Test: manual
Change-Id: I872a75d6b00dffae943b0f403185a39047909884
This commit is contained in:
Lais Andrade
2022-03-18 16:41:33 +00:00
parent e7b38f27a3
commit b827221ed3
4 changed files with 46 additions and 11 deletions

View File

@@ -73,11 +73,11 @@ public abstract class VibrationIntensityPreferenceController extends SliderPrefe
mSettingsContentObserver.onDisplayPreference(this, preference);
preference.setEnabled(mPreferenceConfig.isPreferenceEnabled());
preference.setSummaryProvider(unused -> mPreferenceConfig.getSummary());
// TODO: remove setContinuousUpdates and replace with a different way to play the haptic
// preview without relying on the setting being propagated to the service.
preference.setContinuousUpdates(true);
preference.setMin(getMin());
preference.setMax(getMax());
// Haptics previews played by the Settings app don't bypass user settings to be played.
// The sliders continuously updates the intensity value so the previews can apply them.
preference.setContinuousUpdates(true);
}
@Override