Merge messages & conversations settings for DND priority senders.

This change explicitly allows for multiselect between priority senders (starred, contacts) & priority conversations, and also allows unchecking boxes by clicking on the same ones again.

Also makes the screens for setting messages and calls in custom rules consistent in behavior with the main DND settings. Since much of the functionality is shared, this change refactors most of the logic into a new helper class used by both.

While these changes also affect how the "calls" screen is constructed, in effect there is no change to the functionality of priority call sender settings except under the hood.

Test: atest ZenPrioritySendersHelperTest; Settings robotests
Bug: 190180868
Bug: 197223270
Change-Id: I894775537a18feb7a891b2668b9a613a203a129c
This commit is contained in:
Yuri Lin
2021-07-12 12:02:53 -04:00
parent 0571ab940a
commit 00d824657d
17 changed files with 1585 additions and 302 deletions

View File

@@ -287,6 +287,20 @@ public class ZenModeBackend {
}
}
protected static int getContactSettingFromZenPolicySetting(int setting) {
switch (setting) {
case ZenPolicy.PEOPLE_TYPE_ANYONE:
return NotificationManager.Policy.PRIORITY_SENDERS_ANY;
case ZenPolicy.PEOPLE_TYPE_CONTACTS:
return NotificationManager.Policy.PRIORITY_SENDERS_CONTACTS;
case ZenPolicy.PEOPLE_TYPE_STARRED:
return NotificationManager.Policy.PRIORITY_SENDERS_STARRED;
case ZenPolicy.PEOPLE_TYPE_NONE:
default:
return SOURCE_NONE;
}
}
protected int getAlarmsTotalSilencePeopleSummary(int category) {
if (category == NotificationManager.Policy.PRIORITY_CATEGORY_MESSAGES) {
return R.string.zen_mode_none_messages;