Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6b2e2e4c authored by Lais Andrade's avatar Lais Andrade Committed by Android (Google) Code Review
Browse files

Merge "Introduce alarm and media vibration intensity settings"

parents b81f2b77 eaaf5331
Loading
Loading
Loading
Loading
+18 −5
Original line number Diff line number Diff line
@@ -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)
+9 −1
Original line number Diff line number Diff line
@@ -5461,6 +5461,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. -->
@@ -8254,7 +8258,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] -->
+12 −0
Original line number Diff line number Diff line
@@ -47,6 +47,12 @@
            app:keywords="@string/keywords_notification_vibration"
            app:controller="com.android.settings.accessibility.NotificationVibrationIntensityPreferenceController" />

        <com.android.settings.widget.SeekBarPreference
            android:key="alarm_vibration_preference_screen"
            android:title="@string/accessibility_alarm_vibration_title"
            app:keywords="@string/keywords_alarm_vibration"
            app:controller="com.android.settings.accessibility.AlarmVibrationIntensityPreferenceController" />

    </PreferenceCategory>

    <PreferenceCategory
@@ -59,6 +65,12 @@
            app:keywords="@string/keywords_touch_vibration"
            app:controller="com.android.settings.accessibility.HapticFeedbackIntensityPreferenceController" />

        <com.android.settings.widget.SeekBarPreference
            android:key="media_vibration_preference_screen"
            android:title="@string/accessibility_media_vibration_title"
            app:keywords="@string/keywords_media_vibration"
            app:controller="com.android.settings.accessibility.MediaVibrationIntensityPreferenceController" />

    </PreferenceCategory>

</PreferenceScreen>
+12 −0
Original line number Diff line number Diff line
@@ -47,6 +47,12 @@
            app:keywords="@string/keywords_notification_vibration"
            app:controller="com.android.settings.accessibility.NotificationVibrationTogglePreferenceController" />

        <SwitchPreference
            android:key="alarm_vibration_preference_screen"
            android:title="@string/accessibility_alarm_vibration_title"
            app:keywords="@string/keywords_alarm_vibration"
            app:controller="com.android.settings.accessibility.AlarmVibrationTogglePreferenceController" />

    </PreferenceCategory>

    <PreferenceCategory
@@ -59,6 +65,12 @@
            app:keywords="@string/keywords_touch_vibration"
            app:controller="com.android.settings.accessibility.HapticFeedbackTogglePreferenceController" />

        <SwitchPreference
            android:key="media_vibration_preference_screen"
            android:title="@string/accessibility_media_vibration_title"
            app:keywords="@string/keywords_media_vibration"
            app:controller="com.android.settings.accessibility.MediaVibrationTogglePreferenceController" />

    </PreferenceCategory>

</PreferenceScreen>
+50 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.settings.accessibility;

import android.content.Context;
import android.os.VibrationAttributes;
import android.provider.Settings;

/** Preference controller for alarm vibration intensity */
public class AlarmVibrationIntensityPreferenceController
        extends VibrationIntensityPreferenceController {

    /** General configuration for alarm vibration intensity settings. */
    public static final class AlarmVibrationPreferenceConfig extends VibrationPreferenceConfig {

        public AlarmVibrationPreferenceConfig(Context context) {
            super(context, Settings.System.ALARM_VIBRATION_INTENSITY,
                    VibrationAttributes.USAGE_ALARM);
        }
    }

    public AlarmVibrationIntensityPreferenceController(Context context, String preferenceKey) {
        super(context, preferenceKey, new AlarmVibrationPreferenceConfig(context));
    }

    protected AlarmVibrationIntensityPreferenceController(Context context, String preferenceKey,
            int supportedIntensityLevels) {
        super(context, preferenceKey, new AlarmVibrationPreferenceConfig(context),
                supportedIntensityLevels);
    }

    @Override
    public int getAvailabilityStatus() {
        return AVAILABLE;
    }
}
Loading