Settings for Polite Notifications

Adds settings page for polite notifications.

Test: atest PoliteNotificationsPreferenceControllerTest
Test: atest PoliteNotificationFilterControllerTest
Test: atest PoliteNotifVibrateUnlockedToggleControllerTest
Test: atest PoliteNotifWorkProfileToggleControllerTest

Bug: 270456865

Change-Id: I3ec497b068c15205df97bb26ee007beed8da9ee1
This commit is contained in:
Valentin Iftime
2023-06-30 15:04:56 +02:00
committed by Iavor-Valentin Iftime
parent 747d86fef5
commit 9f82e7381a
15 changed files with 925 additions and 3 deletions

View File

@@ -1475,4 +1475,19 @@
<item>en-XA</item> <!-- English (Pseudo-Accents) -->
<item>ar-XB</item> <!-- Arabic (Pseudo-Bidi) -->
</string-array>
<!-- Values for notification cooldown -->
<string-array name="notification_polite_options">
<item>@string/notification_polite_all_apps</item>
<item>@string/notification_polite_conversations</item>
<item>@string/notification_polite_disabled</item>
</string-array>
<!-- Values for notification cooldown -->
<string-array name="notification_polite_options_values" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
</resources>

View File

@@ -8198,6 +8198,20 @@
<string name="notif_listener_more_settings">More settings</string>
<string name="notif_listener_more_settings_desc">More settings are available inside this app</string>
<!-- Title for Polite Notifications setting [CHAR LIMIT=30]-->
<string name="notification_polite_title">Notification cooldown</string>
<string name="notification_polite_all_apps">Apply cooldown to all notifications</string>
<string name="notification_polite_all_apps_summary">Gradually lower the notification volume when you get many successive notifications from the same app</string>
<string name="notification_polite_conversations">Apply cooldown to conversations</string>
<string name="notification_polite_conversations_summary">Gradually lower the notification volume when you get many messages from the same chat within a short period of time</string>
<string name="notification_polite_disabled">Don\'t use notification cooldown</string>
<string name="notification_polite_disabled_summary">Never lower notification volume, regardless of the amount of successive notifications from the same app</string>
<string name="notification_polite_vibrate_unlocked">Vibrate when unlocked</string>
<string name="notification_polite_vibrate_unlocked_summary">Only vibrate when screen is unlocked</string>
<string name="notification_polite_work">Apply to work profiles</string>
<string name="notification_polite_work_summary">Apply the notification cooldown settings from your personal profile to your work profile</string>
<!-- Title for managing VR (virtual reality) helper services. [CHAR LIMIT=50] -->
<string name="vr_listeners_title">VR helper services</string>

View File

@@ -180,5 +180,13 @@
android:title="@string/notification_assistant_title"
android:summary="@string/notification_assistant_summary"
settings:controller="com.android.settings.notification.NotificationAssistantPreferenceController"/>
<Preference
android:fragment="com.android.settings.notification.PoliteNotificationsPreferenceFragment"
android:key="polite_notifications_preference"
android:order="26"
android:persistent="false"
android:title="@string/notification_polite_title"
settings:controller="com.android.settings.notification.PoliteNotificationsPreferenceController" />
</PreferenceCategory>
</PreferenceScreen>

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2023 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.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/notification_polite_title">
<com.android.settings.RestrictedListPreference
android:key="polite_notifications_pref_dlg"
android:persistent="false"
android:title="@string/notification_polite_title"
android:entries="@array/notification_polite_options"
android:entryValues="@array/notification_polite_options_values"
settings:controller="com.android.settings.notification.PoliteNotificationFilterController"/>
<SwitchPreference
android:key="notification_polite_vibrate_unlocked"
android:persistent="false"
android:title="@string/notification_polite_vibrate_unlocked"
android:summary="@string/notification_polite_vibrate_unlocked_summary"
settings:controller="com.android.settings.notification.PoliteNotifVibrateUnlockedToggleController" />
<SwitchPreference
android:key="notification_polite_work_profile"
android:persistent="false"
android:title="@string/notification_polite_work"
android:summary="@string/notification_polite_work_summary"
settings:controller="com.android.settings.notification.PoliteNotifWorkProfileToggleController" />
</PreferenceScreen>