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

Commit 1566290b authored by Lais Andrade's avatar Lais Andrade
Browse files

[Catalyst] Migrate alarm and notification vibration switches

Migrate the alarm and notification vibration category and the
vibration toggles.

NO_IFTTT=migration ongoing, no need to update legacy controllers

Bug: 390338213
Flag: com.android.settings.flags.catalyst_vibration_intensity_screen_25q4
Test: AlarmVibrationIntensitySwitchPreferenceTest
      NotificationVibrationIntensitySwitchPreferenceTest
Change-Id: Ia0e9b6e77ec76a55a1f7c792da394179d6e5cfbe
parent 55fa5901
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -46,16 +46,17 @@

    <PreferenceCategory
        android:key="vibration_category_notification_alarm"
        android:title="@string/accessibility_notification_alarm_vibration_category_title">
        android:title="@string/accessibility_notification_alarm_vibration_category_title"
        android:persistent="false">

        <SwitchPreferenceCompat
            android:key="vibration_preference_notification"
            android:key="notification_vibration_intensity"
            android:title="@string/accessibility_notification_vibration_title"
            app:keywords="@string/keywords_notification_vibration"
            app:controller="com.android.settings.accessibility.NotificationVibrationTogglePreferenceController" />

        <SwitchPreferenceCompat
            android:key="vibration_preference_alarm"
            android:key="alarm_vibration_intensity"
            android:title="@string/accessibility_alarm_vibration_title"
            app:keywords="@string/keywords_alarm_vibration"
            app:controller="com.android.settings.accessibility.AlarmVibrationTogglePreferenceController" />
+37 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 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.os.VibrationAttributes
import android.provider.Settings
import com.android.settings.R

/** Accessibility settings for alarm vibration. */
// LINT.IfChange
class AlarmVibrationIntensitySwitchPreference :
    VibrationIntensitySwitchPreference(
        key = KEY,
        vibrationUsage = VibrationAttributes.USAGE_ALARM,
        title = R.string.accessibility_alarm_vibration_title,
    ) {
    override val keywords: Int
        get() = R.string.keywords_alarm_vibration

    companion object {
        const val KEY = Settings.System.ALARM_VIBRATION_INTENSITY
    }
}
// LINT.ThenChange(AlarmVibrationTogglePreferenceController.java)
+2 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.Context;
import com.android.settings.accessibility.AlarmVibrationIntensityPreferenceController.AlarmVibrationPreferenceConfig;

/** Preference controller for alarm vibration with only a toggle for on/off states. */
// LINT.IfChange
public class AlarmVibrationTogglePreferenceController extends VibrationTogglePreferenceController {

    public AlarmVibrationTogglePreferenceController(Context context, String preferenceKey) {
@@ -32,3 +33,4 @@ public class AlarmVibrationTogglePreferenceController extends VibrationTogglePre
        return AVAILABLE;
    }
}
// LINT.ThenChange(AlarmVibrationIntensitySwitchPreference.java)
+37 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 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.os.VibrationAttributes
import android.provider.Settings
import com.android.settings.R

/** Accessibility settings for notification vibration. */
// LINT.IfChange
class NotificationVibrationIntensitySwitchPreference :
    VibrationIntensitySwitchPreference(
        key = KEY,
        vibrationUsage = VibrationAttributes.USAGE_NOTIFICATION,
        title = R.string.accessibility_notification_vibration_title,
    ) {
    override val keywords: Int
        get() = R.string.keywords_notification_vibration

    companion object {
        const val KEY = Settings.System.NOTIFICATION_VIBRATION_INTENSITY
    }
}
// LINT.ThenChange(NotificationVibrationTogglePreferenceController.java)
+2 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.Context;
import com.android.settings.accessibility.NotificationVibrationIntensityPreferenceController.NotificationVibrationPreferenceConfig;

/** Preference controller for notification vibration with only a toggle for on/off states. */
// LINT.IfChange
public class NotificationVibrationTogglePreferenceController
        extends VibrationTogglePreferenceController {

@@ -33,3 +34,4 @@ public class NotificationVibrationTogglePreferenceController
        return AVAILABLE;
    }
}
// LINT.ThenChange(NotificationVibrationIntensitySwitchPreference.java)
Loading