Introduce alarm and media vibration intensity settings

Introduce toggles and sliders to configure the alarm and media
vibrations in the "Vibration & haptics" settings app.

Also update the multiple intensities configuration flag into a integer,
where the device can specify how many distinct levels are supported.
Follow existing implementation to map the intensities to higher setting
values.

Bug: 198346559
Bug: 207477604
Test: [Alarm|Media]Vibration[Intensity|Toggle]PreferenceControllerTest
Change-Id: Ie3d570b72ba1229e613ecf0c45fac81233529e32
This commit is contained in:
Lais Andrade
2022-01-07 20:12:19 +00:00
parent 8e7a57e8fa
commit eaaf5331d6
26 changed files with 1102 additions and 146 deletions

View File

@@ -41,9 +41,9 @@ public class VibrationSettings extends DashboardFragment {
@Override
protected int getPreferenceScreenResId() {
final boolean supportsMultipleIntensities = getContext().getResources().getBoolean(
R.bool.config_vibration_supports_multiple_intensities);
return supportsMultipleIntensities
final int supportedIntensities = getContext().getResources().getInteger(
R.integer.config_vibration_supported_intensity_levels);
return supportedIntensities > 1
? R.xml.accessibility_vibration_intensity_settings
: R.xml.accessibility_vibration_settings;
}