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

@@ -197,11 +197,24 @@
<!-- Whether or not to show the night light suggestion. -->
<bool name="config_night_light_suggestion_enabled">true</bool>
<!-- Whether or not the device is capable of multiple levels of vibration intensity.
Note that this is different from whether it can control the vibration amplitude as some
devices will be able to vary their amplitude but do not possess enough dynamic range to
have distinct intensity levels -->
<bool name="config_vibration_supports_multiple_intensities">false</bool>
<!-- The number of vibration intensity levels supported by the device.
Note that this should correspond to the ability to vary the vibration amplitude, with
enough dynamic range to have at least as many distinct intensity levels as defined here.
Supported values are 1, 2, 3. If '1', the settings app will use a toggle for the settings,
otherwise a slider. If '3', the settings app maps intensities directly to the levels
supported by the Vibrator HAL APIs. If '2', then the levels will be mapped to
VIBRATION_INTENSITY_LOW and VIBRATION_INTENSITY_HIGH, which gives the most range for
scaling vibrations. The medium intensity will be skipped.
The default intensity values are configured at
frameworks/base/core/res/res/values/config.xml's config_default[type]VibrationIntensity.
Make sure that each default intensity value is consistent with the supported levels set
here. If this settings supports only 2 levels, for example, then the default intensity
should be either LOW (1) or HIGH (3).
-->
<integer name="config_vibration_supported_intensity_levels">1</integer>
<!--
Whether or not the homepage should be powered by legacy suggestion (versus contextual cards)

View File

@@ -5457,6 +5457,10 @@
<string name="accessibility_notification_alarm_vibration_category_title">Notifications and alarms</string>
<!-- Title for the category of preferences to configure device vibrations triggered by user interaction with the device. [CHAR LIMIT=NONE] -->
<string name="accessibility_interactive_haptics_category_title">Interactive haptics</string>
<!-- Title for preference for configuring alarm vibrations. [CHAR LIMIT=NONE] -->
<string name="accessibility_alarm_vibration_title">Alarm vibration</string>
<!-- Title for preference for configuring media vibrations (e.g. vibrations played together with animations, music, videos, etc). [CHAR LIMIT=NONE] -->
<string name="accessibility_media_vibration_title">Media vibration</string>
<!-- Title for accessibility preference for configuring ring vibrations. [CHAR LIMIT=NONE] -->
<string name="accessibility_ring_vibration_title">Ring vibration</string>
<!-- Title for accessibility preference for configuring notification vibrations. -->
@@ -8238,7 +8242,11 @@
<!-- List of synonyms for ring vibration setting (changes whether your phone vibrates when it rings), used to match in settings search [CHAR LIMIT=NONE] -->
<string name="keywords_ramping_ringer_vibration">haptics, vibrate, phone, call, ring, gradually</string>
<!-- List of synonyms for notification vibration setting (changes whether your phone vibrates when it shows a notification), used to match in settings search [CHAR LIMIT=NONE] -->
<string name="keywords_notification_vibration">haptics, vibrate, sensitivity</string>
<string name="keywords_notification_vibration">haptics, vibrate, sensitivity, notification</string>
<!-- List of synonyms for alarm vibration setting (changes whether your phone vibrates when an alarm goes off), used to match in settings search [CHAR LIMIT=NONE] -->
<string name="keywords_alarm_vibration">haptics, vibrate, sensitivity, alarm</string>
<!-- List of synonyms for media vibration setting (changes whether your phone vibrates as part of a music, animation, video, etc), used to match in settings search [CHAR LIMIT=NONE] -->
<string name="keywords_media_vibration">haptics, vibrate, sensitivity, media</string>
<!-- List of synonyms for vibration and haptics setting, used to match in settings search [CHAR LIMIT=NONE] -->
<string name="keywords_vibration">haptics, vibrate, vibration</string>
<!-- Battery Saver: Search terms for sticky battery saver preference [CHAR_LIMIT=NONE] -->