Update DND strings

Fixes: 120497233
Bug: 111475013
Test: manually flash and check strings
Test: make RunSettingsRoboTests -j40
Change-Id: I0a8971226a485f8ec41d83c167e51dac1a9c8107
This commit is contained in:
Beverly
2018-12-05 12:33:02 -05:00
parent c4be214f47
commit fdebb9632b
16 changed files with 131 additions and 141 deletions

View File

@@ -1077,11 +1077,18 @@
<item>never</item> <item>never</item>
</string-array> </string-array>
<string-array name="zen_mode_contacts_entries" translatable="false"> <string-array name="zen_mode_contacts_messages_entries" translatable="false">
<item>@string/zen_mode_from_anyone</item> <item>@string/zen_mode_from_anyone</item>
<item>@string/zen_mode_from_contacts</item> <item>@string/zen_mode_from_contacts</item>
<item>@string/zen_mode_from_starred</item> <item>@string/zen_mode_from_starred</item>
<item>@string/zen_mode_from_none</item> <item>@string/zen_mode_from_none_calls</item>
</string-array>
<string-array name="zen_mode_contacts_calls_entries" translatable="false">
<item>@string/zen_mode_from_anyone</item>
<item>@string/zen_mode_from_contacts</item>
<item>@string/zen_mode_from_starred</item>
<item>@string/zen_mode_from_none_messages</item>
</string-array> </string-array>
<string-array name="zen_mode_contacts_values" translatable="false"> <string-array name="zen_mode_contacts_values" translatable="false">

View File

@@ -670,7 +670,7 @@
<!-- check box cellular data title [CHAR LIMIT=30] --> <!-- check box cellular data title [CHAR LIMIT=30] -->
<string name="cellular_data_title">Mobile data</string> <string name="cellular_data_title">Mobile data</string>
<!-- check box Calls title [CHAR LIMIT=30] --> <!-- check box Calls title [CHAR LIMIT=30] -->
<string name="calls_title">Calls</string> <string name="calls_title">Allow calls</string>
<!-- check box SMS Messges title [CHAR LIMIT=30] --> <!-- check box SMS Messges title [CHAR LIMIT=30] -->
<string name="sms_messages_title">SMS messages</string> <string name="sms_messages_title">SMS messages</string>
<!-- check box cellular data summary [CHAR LIMIT=85] --> <!-- check box cellular data summary [CHAR LIMIT=85] -->
@@ -7083,8 +7083,8 @@
<!-- Sound: Summary for the Do not Disturb option when at least one automatic rules turned on. [CHAR LIMIT=NONE]--> <!-- Sound: Summary for the Do not Disturb option when at least one automatic rules turned on. [CHAR LIMIT=NONE]-->
<plurals name="zen_mode_settings_summary_on"> <plurals name="zen_mode_settings_summary_on">
<item quantity="one">1 rule</item> <item quantity="one">1 enabled</item>
<item quantity="other"><xliff:g id="on_count" example="10">%d</xliff:g> rules</item> <item quantity="other"><xliff:g id="on_count" example="10">%d</xliff:g> enabled</item>
</plurals> </plurals>
<!-- Sound: Title for the Do not Disturb option and associated settings page. [CHAR LIMIT=50]--> <!-- Sound: Title for the Do not Disturb option and associated settings page. [CHAR LIMIT=50]-->
@@ -7124,10 +7124,10 @@
<string name="zen_mode_schedule_delete">Delete</string> <string name="zen_mode_schedule_delete">Delete</string>
<!-- Do not disturb: Title for the zen mode automatic rules page in settings. [CHAR LIMIT=30] --> <!-- Do not disturb: Title for the zen mode automatic rules page in settings. [CHAR LIMIT=30] -->
<string name="zen_mode_automation_settings_page_title">Do Not Disturb</string> <string name="zen_mode_automation_settings_page_title">Schedules</string>
<!-- Do not disturb: Title for a specific zen mode automatic rule in settings. [CHAR LIMIT=30] --> <!-- Do not disturb: Title for a specific zen mode automatic rule in settings. [CHAR LIMIT=30] -->
<string name="zen_mode_automatic_rule_settings_page_title">Automatic rule</string> <string name="zen_mode_automatic_rule_settings_page_title">Schedule</string>
<!-- Do not disturb: Title do not disturb settings representing automatic (scheduled) do not disturb rules. [CHAR LIMIT=30] --> <!-- Do not disturb: Title do not disturb settings representing automatic (scheduled) do not disturb rules. [CHAR LIMIT=30] -->
<string name="zen_mode_schedule_category_title">Schedule</string> <string name="zen_mode_schedule_category_title">Schedule</string>
@@ -7142,7 +7142,7 @@
<string name="zen_mode_schedule_title">Schedule</string> <string name="zen_mode_schedule_title">Schedule</string>
<!-- Do not disturb: Switch toggle to toggle whether to use an automatic dnd rule or not [CHAR LIMIT=40] --> <!-- Do not disturb: Switch toggle to toggle whether to use an automatic dnd rule or not [CHAR LIMIT=40] -->
<string name="zen_mode_use_automatic_rule">Use rule</string> <string name="zen_mode_use_automatic_rule">Use schedule</string>
<!-- Do not disturb: Zen mode option: Important interruptions [CHAR LIMIT=60] --> <!-- Do not disturb: Zen mode option: Important interruptions [CHAR LIMIT=60] -->
<string name="zen_mode_option_important_interruptions">Priority only</string> <string name="zen_mode_option_important_interruptions">Priority only</string>
@@ -7166,7 +7166,7 @@
<string name="zen_mode_settings_category">When Do Not Disturb is on</string> <string name="zen_mode_settings_category">When Do Not Disturb is on</string>
<!-- Do not disturb: restrict notifications title [CHAR LIMIT=80] --> <!-- Do not disturb: restrict notifications title [CHAR LIMIT=80] -->
<string name="zen_mode_restrict_notifications_title">Notification restrictions</string> <string name="zen_mode_restrict_notifications_title">Restrict notifications</string>
<!-- Do not disturb: Mute notifications option [CHAR LIMIT=60] --> <!-- Do not disturb: Mute notifications option [CHAR LIMIT=60] -->
<string name="zen_mode_restrict_notifications_mute">No sound from notifications</string> <string name="zen_mode_restrict_notifications_mute">No sound from notifications</string>
<!-- Do not disturb:Mute notifications summary [CHAR LIMIT=NONE] --> <!-- Do not disturb:Mute notifications summary [CHAR LIMIT=NONE] -->
@@ -7272,7 +7272,7 @@
<string name="zen_mode_sound_summary_on_with_info">On / <xliff:g name="dnd_summary" example="No sound except alarms and media">%1$s</xliff:g></string> <string name="zen_mode_sound_summary_on_with_info">On / <xliff:g name="dnd_summary" example="No sound except alarms and media">%1$s</xliff:g></string>
<!-- Sound settings screen, summary format of do not disturb when off with extra information. [CHAR LIMIT=NONE] --> <!-- Sound settings screen, summary format of do not disturb when off with extra information. [CHAR LIMIT=NONE] -->
<string name="zen_mode_sound_summary_off_with_info">Off / <xliff:g name="dnd_summary" example="1 rule can turn on automatically">%1$s</xliff:g></string> <string name="zen_mode_sound_summary_off_with_info">Off / <xliff:g name="dnd_summary" example="1 schedule can turn on automatically">%1$s</xliff:g></string>
<!-- Sound settings screen, summary format of do not disturb when off with no extra information. [CHAR LIMIT=NONE] --> <!-- Sound settings screen, summary format of do not disturb when off with no extra information. [CHAR LIMIT=NONE] -->
<string name="zen_mode_sound_summary_off">Off</string> <string name="zen_mode_sound_summary_off">Off</string>
@@ -7297,12 +7297,12 @@
<!-- Summary for the Sound Do not Disturb option when at least one automatic rules is enabled. [CHAR LIMIT=NONE]--> <!-- Summary for the Sound Do not Disturb option when at least one automatic rules is enabled. [CHAR LIMIT=NONE]-->
<plurals name="zen_mode_sound_summary_summary_off_info"> <plurals name="zen_mode_sound_summary_summary_off_info">
<item quantity="one">1 rule can turn on automatically</item> <item quantity="one">1 schedule can turn on automatically</item>
<item quantity="other"><xliff:g id="on_count" example="3">%d</xliff:g> rules can turn on automatically</item> <item quantity="other"><xliff:g id="on_count" example="3">%d</xliff:g> schedules can turn on automatically</item>
</plurals> </plurals>
<!-- Do not disturb settings, category header [CHAR LIMIT=120]--> <!-- Do not disturb settings, category header [CHAR LIMIT=120]-->
<string name="zen_category_behavior">Mute phone, but allow exceptions</string> <string name="zen_category_behavior">Mute device but allow exceptions</string>
<!-- Do not disturb settings, exceptions to dnd title [CHAR LIMIT=100]--> <!-- Do not disturb settings, exceptions to dnd title [CHAR LIMIT=100]-->
<string name="zen_category_exceptions">Exceptions</string> <string name="zen_category_exceptions">Exceptions</string>
<!-- Do not disturb settings, category header [CHAR LIMIT=100]--> <!-- Do not disturb settings, category header [CHAR LIMIT=100]-->
@@ -7753,28 +7753,28 @@
<string name="zen_mode_rule_rename_button">Rename</string> <string name="zen_mode_rule_rename_button">Rename</string>
<!-- [CHAR LIMIT=40] Zen mode settings: Rule name option and edit dialog title --> <!-- [CHAR LIMIT=40] Zen mode settings: Rule name option and edit dialog title -->
<string name="zen_mode_rule_name">Rule name</string> <string name="zen_mode_rule_name">Schedule name</string>
<!-- [CHAR LIMIT=40] Zen mode settings: Rule name hint text --> <!-- [CHAR LIMIT=40] Zen mode settings: Rule name hint text -->
<string name="zen_mode_rule_name_hint">Enter rule name</string> <string name="zen_mode_rule_name_hint">Enter schedule name</string>
<!-- [CHAR LIMIT=100] Zen mode settings: Warning text for invalid zen rule names --> <!-- [CHAR LIMIT=100] Zen mode settings: Warning text for invalid zen rule names -->
<string name="zen_mode_rule_name_warning">Rule name already in use</string> <string name="zen_mode_rule_name_warning">Schedule name already in use</string>
<!-- [CHAR LIMIT=40] Zen mode settings: Add another automatic zen rule option name--> <!-- [CHAR LIMIT=40] Zen mode settings: Add another automatic zen rule option name-->
<string name="zen_mode_add_rule">Add more</string> <string name="zen_mode_add_rule">Add more</string>
<!-- [CHAR LIMIT=40] Zen mode settings: Add event-based rule, set rule name title --> <!-- [CHAR LIMIT=40] Zen mode settings: Add event-based rule, set rule name title -->
<string name="zen_mode_add_event_rule">Add event rule</string> <string name="zen_mode_add_event_rule">Add event schedule</string>
<!-- [CHAR LIMIT=40] Zen mode settings: Add time-based rule, set rule name title --> <!-- [CHAR LIMIT=40] Zen mode settings: Add time-based rule, set rule name title -->
<string name="zen_mode_add_time_rule">Add time rule</string> <string name="zen_mode_add_time_rule">Add time schedule</string>
<!-- [CHAR LIMIT=40] Zen mode settings: Delete rule menu option name --> <!-- [CHAR LIMIT=40] Zen mode settings: Delete rule menu option name -->
<string name="zen_mode_delete_rule">Delete rule</string> <string name="zen_mode_delete_rule">Delete schedule</string>
<!-- [CHAR LIMIT=60] Zen mode settings: Choose rule type dialog title --> <!-- [CHAR LIMIT=60] Zen mode settings: Choose rule type dialog title -->
<string name="zen_mode_choose_rule_type">Choose rule type</string> <string name="zen_mode_choose_rule_type">Choose schedule type</string>
<!-- [CHAR LIMIT=40] Zen mode settings: Delete rule dialog confirmation message --> <!-- [CHAR LIMIT=40] Zen mode settings: Delete rule dialog confirmation message -->
<string name="zen_mode_delete_rule_confirmation">Delete \u201c<xliff:g id="rule" example="Weekends">%1$s</xliff:g>\u201d rule?</string> <string name="zen_mode_delete_rule_confirmation">Delete \u201c<xliff:g id="rule" example="Weekends">%1$s</xliff:g>\u201d rule?</string>
@@ -7855,7 +7855,7 @@
<string name="zen_mode_schedule_alarm_title">Alarm can override end time</string> <string name="zen_mode_schedule_alarm_title">Alarm can override end time</string>
<!-- [CHAR LIMIT=NONE] Zen mode settings: Downtime rule setting --> <!-- [CHAR LIMIT=NONE] Zen mode settings: Downtime rule setting -->
<string name="zen_mode_schedule_alarm_summary">Stop at the end time or next alarm, whichever comes first</string> <string name="zen_mode_schedule_alarm_summary">Schedule turns off when an alarm rings</string>
<!-- [CHAR LIMIT=80] Zen mode settings: Title for preference to allow custom behavior for the dnd schedule --> <!-- [CHAR LIMIT=80] Zen mode settings: Title for preference to allow custom behavior for the dnd schedule -->
<string name="zen_mode_custom_behavior_title">Do Not Disturb behavior</string> <string name="zen_mode_custom_behavior_title">Do Not Disturb behavior</string>
@@ -7876,10 +7876,10 @@
<string name="summary_range_verbal_combination"><xliff:g id="start" example="Sun">%1$s</xliff:g> to <xliff:g id="end" example="Thu">%2$s</xliff:g></string> <string name="summary_range_verbal_combination"><xliff:g id="start" example="Sun">%1$s</xliff:g> to <xliff:g id="end" example="Thu">%2$s</xliff:g></string>
<!-- [CHAR LIMIT=20] Zen mode settings: Calls option --> <!-- [CHAR LIMIT=20] Zen mode settings: Calls option -->
<string name="zen_mode_calls">Calls</string> <string name="zen_mode_calls">Allow calls</string>
<!-- [CHAR LIMIT=40] Zen mode settings: Allow calls toggle title --> <!-- [CHAR LIMIT=40] Zen mode settings: Allow calls toggle title -->
<string name="zen_mode_calls_title">Allow calls</string> <string name="zen_mode_calls_title">Calls</string>
<!-- [CHAR LIMIT=20] Zen mode settings: Calls screen footer --> <!-- [CHAR LIMIT=20] Zen mode settings: Calls screen footer -->
<string name="zen_mode_calls_footer">When Do Not Disturb is on, incoming calls are blocked. You can adjust settings to allow your friends, family, or other contacts to reach you.</string> <string name="zen_mode_calls_footer">When Do Not Disturb is on, incoming calls are blocked. You can adjust settings to allow your friends, family, or other contacts to reach you.</string>
@@ -7894,25 +7894,13 @@
</plurals> </plurals>
<!-- [CHAR LIMIT=20] Zen mode settings: Messages option --> <!-- [CHAR LIMIT=20] Zen mode settings: Messages option -->
<string name="zen_mode_messages">Messages</string> <string name="zen_mode_messages">Allow text messages</string>
<!-- Do not disturb settings, messages, events and reminders footer [CHAR LIMIT=NONE]--> <!-- Do not disturb settings, messages, events and reminders footer [CHAR LIMIT=NONE]-->
<string name="zen_mode_messages_footer">When Do Not Disturb is on, incoming text messages are blocked. You can adjust settings to allow your friends, family, or other contacts to reach you.</string> <string name="zen_mode_messages_footer">When Do Not Disturb is on, incoming text messages are blocked. You can adjust settings to allow your friends, family, or other contacts to reach you.</string>
<!-- [CHAR LIMIT=40] Zen mode settings: Allow messages toggle title --> <!-- [CHAR LIMIT=40] Zen mode settings: Allow messages to bypass DND title -->
<string name="zen_mode_messages_title">Allow messages</string> <string name="zen_mode_messages_title">Text messages</string>
<!-- [CHAR LIMIT=50] Zen mode settings: All messages summary -->
<string name="zen_mode_all_messages">Messages</string>
<!-- [CHAR LIMIT=50] Zen mode settings: Messages option (ie: text messages) -->
<string name="zen_mode_all_messages_list">messages</string>
<!-- [CHAR LIMIT=50] Zen mode settings: Selected messages summary -->
<string name="zen_mode_selected_messages">Some messages</string>
<!-- [CHAR LIMIT=50] Zen mode settings: Selected messages (ie: some text messages are allowed to bypass dnd) -->
<string name="zen_mode_selected_messages_list">some messages</string>
<!-- [CHAR LIMIT=40] Zen mode settings: Calls or messages option value: From anyone --> <!-- [CHAR LIMIT=40] Zen mode settings: Calls or messages option value: From anyone -->
<string name="zen_mode_from_anyone">From anyone</string> <string name="zen_mode_from_anyone">From anyone</string>
@@ -7932,9 +7920,15 @@
<!-- Do not disturb settings, calls summary [CHAR LIMIT=100]--> <!-- Do not disturb settings, calls summary [CHAR LIMIT=100]-->
<string name="zen_calls_summary_repeat_only">From repeat callers only</string> <string name="zen_calls_summary_repeat_only">From repeat callers only</string>
<!-- [CHAR LIMIT=40] Zen mode settings: Calls or messages option value: None --> <!-- [CHAR LIMIT=40] Zen mode settings: Calls and/or messages from none-->
<string name="zen_mode_from_none">None</string> <string name="zen_mode_from_none">None</string>
<!-- [CHAR LIMIT=40] Zen mode settings: Calls option value: No calls allowed -->
<string name="zen_mode_from_none_calls">Don\u2019t allow any calls</string>
<!-- [CHAR LIMIT=40] Zen mode settings: Messages option value: No messages allowed -->
<string name="zen_mode_from_none_messages">Don\u2019t allow any messages</string>
<!-- [CHAR LIMIT=80] Zen mode settings: Allow alarms option --> <!-- [CHAR LIMIT=80] Zen mode settings: Allow alarms option -->
<string name="zen_mode_alarms">Allow alarms</string> <string name="zen_mode_alarms">Allow alarms</string>
@@ -7942,7 +7936,7 @@
<string name="zen_mode_alarms_list">alarms</string> <string name="zen_mode_alarms_list">alarms</string>
<!-- [CHAR LIMIT=80] Zen mode settings: Allow media (sound from video) to bypass dnd --> <!-- [CHAR LIMIT=80] Zen mode settings: Allow media (sound from video) to bypass dnd -->
<string name="zen_mode_media">Allow media</string> <string name="zen_mode_media">Allow media sounds</string>
<!-- [CHAR LIMIT=50] Zen mode settings: Media (ie: sound from video) --> <!-- [CHAR LIMIT=50] Zen mode settings: Media (ie: sound from video) -->
<string name="zen_mode_media_list">media</string> <string name="zen_mode_media_list">media</string>
@@ -7966,7 +7960,7 @@
<string name="zen_mode_bypassing_apps">Allow apps to override</string> <string name="zen_mode_bypassing_apps">Allow apps to override</string>
<!-- [CHAR LIMIT=100] Zen mode settings: Allow apps to bypass DND title--> <!-- [CHAR LIMIT=100] Zen mode settings: Allow apps to bypass DND title-->
<string name="zen_mode_bypassing_apps_title">Overrides Do Not Disturb</string> <string name="zen_mode_bypassing_apps_title">App exceptions</string>
<!-- [CHAR LIMIT=80] Zen mode settings: Allow apps to bypass DND --> <!-- [CHAR LIMIT=80] Zen mode settings: Allow apps to bypass DND -->
<plurals name="zen_mode_bypassing_apps_subtext"> <plurals name="zen_mode_bypassing_apps_subtext">
@@ -7997,10 +7991,10 @@
<string name="zen_mode_repeat_callers_title">Allow repeat callers</string> <string name="zen_mode_repeat_callers_title">Allow repeat callers</string>
<!-- [CHAR LIMIT=50] Zen mode settings: calls summary --> <!-- [CHAR LIMIT=50] Zen mode settings: calls summary -->
<string name="zen_mode_calls_summary_one">From <xliff:g id="caller type" example="contacts">%1$s</xliff:g></string> <string name="zen_mode_calls_summary_one">Allow from <xliff:g id="caller type" example="contacts">%1$s</xliff:g></string>
<!-- [CHAR LIMIT=50] Zen mode settings: calls summary --> <!-- [CHAR LIMIT=50] Zen mode settings: calls summary -->
<string name="zen_mode_calls_summary_two">From <xliff:g id="caller type" example="starred contacts">%1$s</xliff:g> and <xliff:g id="callert tpye" example="repeat callers">%2$s</xliff:g></string> <string name="zen_mode_calls_summary_two">Allow from <xliff:g id="caller type" example="starred contacts">%1$s</xliff:g> and <xliff:g id="callert tpye" example="repeat callers">%2$s</xliff:g></string>
<!-- [CHAR LIMIT=200] Zen mode settings: Repeat callers option summary --> <!-- [CHAR LIMIT=200] Zen mode settings: Repeat callers option summary -->
<string name="zen_mode_repeat_callers_summary">If the same person calls a second time within a <xliff:g id="minutes">%d</xliff:g> minute period</string> <string name="zen_mode_repeat_callers_summary">If the same person calls a second time within a <xliff:g id="minutes">%d</xliff:g> minute period</string>

View File

@@ -19,7 +19,7 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto" xmlns:settings="http://schemas.android.com/apk/res-auto"
android:key="zen_mode_calls_settings_page" android:key="zen_mode_calls_settings_page"
android:title="@string/zen_mode_calls" > android:title="@string/zen_mode_calls_title" >
<PreferenceCategory <PreferenceCategory
android:title="@string/zen_mode_settings_category" android:title="@string/zen_mode_settings_category"
@@ -27,8 +27,8 @@
<!-- Calls --> <!-- Calls -->
<ListPreference <ListPreference
android:key="zen_mode_calls" android:key="zen_mode_calls"
android:title="@string/zen_mode_calls_title" android:title="@string/zen_mode_calls"
android:entries="@array/zen_mode_contacts_entries" android:entries="@array/zen_mode_contacts_calls_entries"
android:entryValues="@array/zen_mode_contacts_values"/> android:entryValues="@array/zen_mode_contacts_values"/>
<Preference <Preference

View File

@@ -18,7 +18,7 @@
<PreferenceScreen <PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:key="zen_mode_messages_settings_page" android:key="zen_mode_messages_settings_page"
android:title="@string/zen_mode_messages" > android:title="@string/zen_mode_messages_title" >
<PreferenceCategory <PreferenceCategory
android:title="@string/zen_mode_settings_category" android:title="@string/zen_mode_settings_category"
@@ -26,8 +26,8 @@
<!-- Messages --> <!-- Messages -->
<ListPreference <ListPreference
android:key="zen_mode_messages" android:key="zen_mode_messages"
android:title="@string/zen_mode_messages_title" android:title="@string/zen_mode_messages"
android:entries="@array/zen_mode_contacts_entries" android:entries="@array/zen_mode_contacts_messages_entries"
android:entryValues="@array/zen_mode_contacts_values"/> android:entryValues="@array/zen_mode_contacts_values"/>
<Preference <Preference

View File

@@ -27,13 +27,13 @@
<!-- Calls --> <!-- Calls -->
<Preference <Preference
android:key="zen_mode_calls_settings" android:key="zen_mode_calls_settings"
android:title="@string/zen_mode_calls_title" android:title="@string/zen_mode_calls"
android:fragment="com.android.settings.notification.ZenModeCallsSettings" /> android:fragment="com.android.settings.notification.ZenModeCallsSettings" />
<!-- Messages --> <!-- Messages -->
<Preference <Preference
android:key="zen_mode_messages_settings" android:key="zen_mode_messages_settings"
android:title="@string/zen_mode_messages_title" android:title="@string/zen_mode_messages"
android:fragment="com.android.settings.notification.ZenModeMessagesSettings" /> android:fragment="com.android.settings.notification.ZenModeMessagesSettings" />
<!-- Alarms --> <!-- Alarms -->

View File

@@ -73,8 +73,7 @@ public class ZenModeAutomaticRulesPreferenceController extends
// 2. rule was added or deleted, so reload the entire list // 2. rule was added or deleted, so reload the entire list
if (Objects.equals(pref.mId, sortedRules[i].getKey())) { if (Objects.equals(pref.mId, sortedRules[i].getKey())) {
AutomaticZenRule rule = sortedRules[i].getValue(); AutomaticZenRule rule = sortedRules[i].getValue();
pref.setName(rule.getName()); pref.updatePreference(rule);
pref.setChecked(rule.isEnabled());
} else { } else {
reloadAllRules(sortedRules); reloadAllRules(sortedRules);
break; break;

View File

@@ -250,15 +250,17 @@ public class ZenModeBackend {
} }
} }
protected int getAlarmsTotalSilenceCallsMessagesSummary(int category) {
if (category == NotificationManager.Policy.PRIORITY_CATEGORY_MESSAGES) {
return R.string.zen_mode_from_none_messages;
} else if (category == NotificationManager.Policy.PRIORITY_CATEGORY_CALLS){
return R.string.zen_mode_from_none_calls;
}
return 0;
}
protected int getContactsSummary(int category) { protected int getContactsSummary(int category) {
int contactType = -1; int contactType = -1;
// SOURCE_NONE can be used when in total silence or alarms only
// (policy is based on user's preferences but the UI displayed is based on zenMode)
if (category == SOURCE_NONE) {
return R.string.zen_mode_from_none;
}
if (category == NotificationManager.Policy.PRIORITY_CATEGORY_MESSAGES) { if (category == NotificationManager.Policy.PRIORITY_CATEGORY_MESSAGES) {
if (isPriorityCategoryEnabled(category)) { if (isPriorityCategoryEnabled(category)) {
contactType = getPriorityMessageSenders(); contactType = getPriorityMessageSenders();
@@ -273,12 +275,16 @@ public class ZenModeBackend {
case NotificationManager.Policy.PRIORITY_SENDERS_ANY: case NotificationManager.Policy.PRIORITY_SENDERS_ANY:
return R.string.zen_mode_from_anyone; return R.string.zen_mode_from_anyone;
case NotificationManager.Policy.PRIORITY_SENDERS_CONTACTS: case NotificationManager.Policy.PRIORITY_SENDERS_CONTACTS:
return R.string.zen_mode_from_contacts; return R.string.zen_mode_from_contacts;
case NotificationManager.Policy.PRIORITY_SENDERS_STARRED: case NotificationManager.Policy.PRIORITY_SENDERS_STARRED:
return R.string.zen_mode_from_starred; return R.string.zen_mode_from_starred;
case SOURCE_NONE: case SOURCE_NONE:
default: default:
return R.string.zen_mode_from_none; if (category == NotificationManager.Policy.PRIORITY_CATEGORY_MESSAGES) {
return R.string.zen_mode_from_none_messages;
} else {
return R.string.zen_mode_from_none_calls;
}
} }
} }

View File

@@ -18,11 +18,11 @@ package com.android.settings.notification;
import android.content.Context; import android.content.Context;
import androidx.preference.Preference;
import com.android.settings.core.PreferenceControllerMixin; import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.core.lifecycle.Lifecycle; import com.android.settingslib.core.lifecycle.Lifecycle;
import androidx.preference.Preference;
public class ZenModeMessagesPreferenceController extends public class ZenModeMessagesPreferenceController extends
AbstractZenModePreferenceController implements PreferenceControllerMixin { AbstractZenModePreferenceController implements PreferenceControllerMixin {
@@ -48,6 +48,7 @@ public class ZenModeMessagesPreferenceController extends
@Override @Override
public void updateState(Preference preference) { public void updateState(Preference preference) {
super.updateState(preference); super.updateState(preference);
// TODO: (b/111475013 - beverlyt) set messages summary
preference.setSummary(mSummaryBuilder.getMessagesSettingSummary(getPolicy()));
} }
} }

View File

@@ -21,14 +21,14 @@ import android.content.Context;
import android.provider.Settings; import android.provider.Settings;
import android.text.TextUtils; import android.text.TextUtils;
import com.android.settings.R;
import com.android.settingslib.core.lifecycle.Lifecycle;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import androidx.preference.ListPreference; import androidx.preference.ListPreference;
import androidx.preference.Preference; import androidx.preference.Preference;
import androidx.preference.PreferenceScreen; import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settingslib.core.lifecycle.Lifecycle;
public class ZenModePriorityCallsPreferenceController extends AbstractZenModePreferenceController public class ZenModePriorityCallsPreferenceController extends AbstractZenModePreferenceController
implements Preference.OnPreferenceChangeListener { implements Preference.OnPreferenceChangeListener {
@@ -80,7 +80,8 @@ public class ZenModePriorityCallsPreferenceController extends AbstractZenModePre
case Settings.Global.ZEN_MODE_ALARMS: case Settings.Global.ZEN_MODE_ALARMS:
mPreference.setEnabled(false); mPreference.setEnabled(false);
mPreference.setValue(ZenModeBackend.ZEN_MODE_FROM_NONE); mPreference.setValue(ZenModeBackend.ZEN_MODE_FROM_NONE);
mPreference.setSummary(mBackend.getContactsSummary(ZenModeBackend.SOURCE_NONE)); mPreference.setSummary(mBackend.getAlarmsTotalSilenceCallsMessagesSummary(
NotificationManager.Policy.PRIORITY_CATEGORY_CALLS));
break; break;
default: default:
preference.setEnabled(true); preference.setEnabled(true);

View File

@@ -21,14 +21,14 @@ import android.content.Context;
import android.provider.Settings; import android.provider.Settings;
import android.text.TextUtils; import android.text.TextUtils;
import com.android.settings.R;
import com.android.settingslib.core.lifecycle.Lifecycle;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import androidx.preference.ListPreference; import androidx.preference.ListPreference;
import androidx.preference.Preference; import androidx.preference.Preference;
import androidx.preference.PreferenceScreen; import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settingslib.core.lifecycle.Lifecycle;
public class ZenModePriorityMessagesPreferenceController extends AbstractZenModePreferenceController public class ZenModePriorityMessagesPreferenceController extends AbstractZenModePreferenceController
implements Preference.OnPreferenceChangeListener { implements Preference.OnPreferenceChangeListener {
@@ -80,7 +80,8 @@ public class ZenModePriorityMessagesPreferenceController extends AbstractZenMode
case Settings.Global.ZEN_MODE_ALARMS: case Settings.Global.ZEN_MODE_ALARMS:
mPreference.setEnabled(false); mPreference.setEnabled(false);
mPreference.setValue(ZenModeBackend.ZEN_MODE_FROM_NONE); mPreference.setValue(ZenModeBackend.ZEN_MODE_FROM_NONE);
mPreference.setSummary(mBackend.getContactsSummary(ZenModeBackend.SOURCE_NONE)); mPreference.setSummary(mBackend.getAlarmsTotalSilenceCallsMessagesSummary(
NotificationManager.Policy.PRIORITY_CATEGORY_MESSAGES));
break; break;
default: default:
preference.setEnabled(true); preference.setEnabled(true);

View File

@@ -145,7 +145,7 @@ public class ZenModeSettings extends ZenModeSettingsBase {
|| PRIORITY_CATEGORY_REPEAT_CALLERS == category, false); || PRIORITY_CATEGORY_REPEAT_CALLERS == category, false);
int numCategories = enabledCategories.size(); int numCategories = enabledCategories.size();
if (numCategories == 0) { if (numCategories == 0) {
return mContext.getString(R.string.zen_mode_no_exceptions); return mContext.getString(R.string.zen_mode_from_none_calls);
} else if (numCategories == 1) { } else if (numCategories == 1) {
return mContext.getString(R.string.zen_mode_calls_summary_one, return mContext.getString(R.string.zen_mode_calls_summary_one,
enabledCategories.get(0)); enabledCategories.get(0));
@@ -156,34 +156,14 @@ public class ZenModeSettings extends ZenModeSettingsBase {
} }
} }
String getMsgEventReminderSettingSummary(Policy policy) { String getMessagesSettingSummary(Policy policy) {
List<String> enabledCategories = getEnabledCategories(policy, List<String> enabledCategories = getEnabledCategories(policy,
category -> PRIORITY_CATEGORY_EVENTS == category category -> PRIORITY_CATEGORY_MESSAGES == category, false);
|| PRIORITY_CATEGORY_REMINDERS == category
|| PRIORITY_CATEGORY_MESSAGES == category, true);
int numCategories = enabledCategories.size(); int numCategories = enabledCategories.size();
if (numCategories == 0) { if (numCategories == 0) {
return mContext.getString(R.string.zen_mode_no_exceptions); return mContext.getString(R.string.zen_mode_from_none_messages);
} else if (numCategories == 1) {
return enabledCategories.get(0);
} else if (numCategories == 2) {
return mContext.getString(R.string.join_two_items, enabledCategories.get(0),
enabledCategories.get(1));
} else if (numCategories == 3){
final List<String> summaries = new ArrayList<>();
summaries.add(enabledCategories.get(0));
summaries.add(enabledCategories.get(1));
summaries.add(enabledCategories.get(2));
return ListFormatter.getInstance().format(summaries);
} else { } else {
final List<String> summaries = new ArrayList<>(); return enabledCategories.get(0);
summaries.add(enabledCategories.get(0));
summaries.add(enabledCategories.get(1));
summaries.add(enabledCategories.get(2));
summaries.add(mContext.getString(R.string.zen_mode_other_options));
return ListFormatter.getInstance().format(summaries);
} }
} }
@@ -292,17 +272,11 @@ public class ZenModeSettings extends ZenModeSettingsBase {
} }
} else if (category == Policy.PRIORITY_CATEGORY_MESSAGES) { } else if (category == Policy.PRIORITY_CATEGORY_MESSAGES) {
if (policy.priorityMessageSenders == Policy.PRIORITY_SENDERS_ANY) { if (policy.priorityMessageSenders == Policy.PRIORITY_SENDERS_ANY) {
if (isFirst) { return mContext.getString(R.string.zen_mode_from_anyone);
return mContext.getString(R.string.zen_mode_all_messages); } else if (policy.priorityMessageSenders == Policy.PRIORITY_SENDERS_CONTACTS){
} else { return mContext.getString(R.string.zen_mode_from_contacts);
return mContext.getString(R.string.zen_mode_all_messages_list);
}
} else { } else {
if (isFirst) { return mContext.getString(R.string.zen_mode_from_starred);
return mContext.getString(R.string.zen_mode_selected_messages);
} else {
return mContext.getString(R.string.zen_mode_selected_messages_list);
}
} }
} else if (category == Policy.PRIORITY_CATEGORY_EVENTS) { } else if (category == Policy.PRIORITY_CATEGORY_EVENTS) {
if (isFirst) { if (isFirst) {

View File

@@ -31,6 +31,7 @@ import androidx.fragment.app.Fragment;
import androidx.preference.Preference; import androidx.preference.Preference;
import androidx.preference.PreferenceViewHolder; import androidx.preference.PreferenceViewHolder;
import com.android.internal.annotations.VisibleForTesting;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.utils.ManagedServiceSettings; import com.android.settings.utils.ManagedServiceSettings;
import com.android.settings.utils.ZenServiceListing; import com.android.settings.utils.ZenServiceListing;
@@ -122,17 +123,17 @@ public class ZenRulePreference extends TwoTargetPreference {
return mChecked; return mChecked;
} }
public void setChecked(boolean checked) { public void updatePreference(AutomaticZenRule rule) {
mChecked = checked; if (!mRule.getName().equals(rule.getName())) {
if (mCheckBox != null) { mName = rule.getName();
mCheckBox.setChecked(checked);
}
}
public void setName(String name) {
if (!Objects.equals(mName, name)) {
mName = name;
setTitle(mName); setTitle(mName);
mRule.setName(mName.toString());
}
if (mRule.isEnabled() != rule.isEnabled()) {
mRule.setEnabled(rule.isEnabled());
setChecked(mRule.isEnabled());
setSummary(computeRuleSummary(mRule));
} }
} }
@@ -141,6 +142,13 @@ public class ZenRulePreference extends TwoTargetPreference {
mOnCheckBoxClickListener.onClick(null); mOnCheckBoxClickListener.onClick(null);
} }
private void setChecked(boolean checked) {
mChecked = checked;
if (mCheckBox != null) {
mCheckBox.setChecked(checked);
}
}
private View.OnClickListener mOnCheckBoxClickListener = new View.OnClickListener() { private View.OnClickListener mOnCheckBoxClickListener = new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@@ -159,7 +167,7 @@ public class ZenRulePreference extends TwoTargetPreference {
try { try {
ApplicationInfo info = mPm.getApplicationInfo(rule.getOwner().getPackageName(), 0); ApplicationInfo info = mPm.getApplicationInfo(rule.getOwner().getPackageName(), 0);
setSummary(computeRuleSummary(rule, mIsSystemRule, info.loadLabel(mPm))); setSummary(computeRuleSummary(rule));
} catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) {
appExists = false; appExists = false;
return; return;
@@ -179,8 +187,7 @@ public class ZenRulePreference extends TwoTargetPreference {
setKey(mId); setKey(mId);
} }
private String computeRuleSummary(AutomaticZenRule rule, boolean isSystemRule, private String computeRuleSummary(AutomaticZenRule rule) {
CharSequence providerLabel) {
return (rule == null || !rule.isEnabled()) return (rule == null || !rule.isEnabled())
? mContext.getResources().getString(R.string.switch_off_text) ? mContext.getResources().getString(R.string.switch_off_text)
: mContext.getResources().getString(R.string.switch_on_text); : mContext.getResources().getString(R.string.switch_on_text);

View File

@@ -144,7 +144,7 @@ public class ZenModeAutomaticRulesPreferenceControllerTest {
mockGetAutomaticZenRules(NUM_RULES, rMap); mockGetAutomaticZenRules(NUM_RULES, rMap);
FieldSetter.setField(mZenRulePreference, ZenRulePreference.class.getDeclaredField("mId"), testId); FieldSetter.setField(mZenRulePreference, ZenRulePreference.class.getDeclaredField("mId"), testId);
mController.updateState(mockPref); mController.updateState(mockPref);
verify(mZenRulePreference, times(1)).setChecked(false); verify(mZenRulePreference, times(1)).updatePreference(any());
verify(mController, never()).reloadAllRules(any()); verify(mController, never()).reloadAllRules(any());
} }

View File

@@ -30,6 +30,9 @@ import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
import android.provider.Settings; import android.provider.Settings;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.testutils.SettingsRobolectricTestRunner; import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settingslib.core.lifecycle.Lifecycle; import com.android.settingslib.core.lifecycle.Lifecycle;
@@ -43,9 +46,6 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.shadows.ShadowApplication; import org.robolectric.shadows.ShadowApplication;
import org.robolectric.util.ReflectionHelpers; import org.robolectric.util.ReflectionHelpers;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceScreen;
@RunWith(SettingsRobolectricTestRunner.class) @RunWith(SettingsRobolectricTestRunner.class)
public class ZenModePriorityCallsPreferenceControllerTest { public class ZenModePriorityCallsPreferenceControllerTest {
@@ -86,8 +86,8 @@ public class ZenModePriorityCallsPreferenceControllerTest {
when(mBackend.getPriorityCallSenders()) when(mBackend.getPriorityCallSenders())
.thenReturn(NotificationManager.Policy.PRIORITY_SENDERS_STARRED); .thenReturn(NotificationManager.Policy.PRIORITY_SENDERS_STARRED);
when(mBackend.getContactsSummary(ZenModeBackend.SOURCE_NONE)) when(mBackend.getAlarmsTotalSilenceCallsMessagesSummary(
.thenCallRealMethod(); NotificationManager.Policy.PRIORITY_CATEGORY_CALLS)).thenCallRealMethod();
when(mBackend.getContactsSummary(NotificationManager.Policy.PRIORITY_CATEGORY_CALLS)) when(mBackend.getContactsSummary(NotificationManager.Policy.PRIORITY_CATEGORY_CALLS))
.thenCallRealMethod(); .thenCallRealMethod();
@@ -110,7 +110,7 @@ public class ZenModePriorityCallsPreferenceControllerTest {
mController.updateState(mockPref); mController.updateState(mockPref);
verify(mockPref).setEnabled(false); verify(mockPref).setEnabled(false);
verify(mockPref).setSummary(R.string.zen_mode_from_none); verify(mockPref).setSummary(R.string.zen_mode_from_none_calls);
} }
@Test @Test
@@ -121,7 +121,7 @@ public class ZenModePriorityCallsPreferenceControllerTest {
mController.updateState(mockPref); mController.updateState(mockPref);
verify(mockPref).setEnabled(false); verify(mockPref).setEnabled(false);
verify(mockPref).setSummary(R.string.zen_mode_from_none); verify(mockPref).setSummary(R.string.zen_mode_from_none_calls);
} }
@Test @Test

View File

@@ -30,6 +30,9 @@ import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
import android.provider.Settings; import android.provider.Settings;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.testutils.SettingsRobolectricTestRunner; import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settingslib.core.lifecycle.Lifecycle; import com.android.settingslib.core.lifecycle.Lifecycle;
@@ -43,9 +46,6 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.shadows.ShadowApplication; import org.robolectric.shadows.ShadowApplication;
import org.robolectric.util.ReflectionHelpers; import org.robolectric.util.ReflectionHelpers;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceScreen;
@RunWith(SettingsRobolectricTestRunner.class) @RunWith(SettingsRobolectricTestRunner.class)
public class ZenModePriorityMessagesPreferenceControllerTest { public class ZenModePriorityMessagesPreferenceControllerTest {
@@ -86,8 +86,8 @@ public class ZenModePriorityMessagesPreferenceControllerTest {
when(mBackend.getPriorityMessageSenders()) when(mBackend.getPriorityMessageSenders())
.thenReturn(NotificationManager.Policy.PRIORITY_SENDERS_STARRED); .thenReturn(NotificationManager.Policy.PRIORITY_SENDERS_STARRED);
when(mBackend.getContactsSummary(ZenModeBackend.SOURCE_NONE)) when(mBackend.getAlarmsTotalSilenceCallsMessagesSummary(
.thenCallRealMethod(); NotificationManager.Policy.PRIORITY_CATEGORY_MESSAGES)).thenCallRealMethod();
when(mBackend.getContactsSummary(NotificationManager.Policy.PRIORITY_CATEGORY_MESSAGES)) when(mBackend.getContactsSummary(NotificationManager.Policy.PRIORITY_CATEGORY_MESSAGES))
.thenCallRealMethod(); .thenCallRealMethod();
@@ -110,7 +110,7 @@ public class ZenModePriorityMessagesPreferenceControllerTest {
mController.updateState(mockPref); mController.updateState(mockPref);
verify(mockPref).setEnabled(false); verify(mockPref).setEnabled(false);
verify(mockPref).setSummary(R.string.zen_mode_from_none); verify(mockPref).setSummary(R.string.zen_mode_from_none_messages);
} }
@Test @Test
@@ -121,7 +121,7 @@ public class ZenModePriorityMessagesPreferenceControllerTest {
mController.updateState(mockPref); mController.updateState(mockPref);
verify(mockPref).setEnabled(false); verify(mockPref).setEnabled(false);
verify(mockPref).setSummary(R.string.zen_mode_from_none); verify(mockPref).setSummary(R.string.zen_mode_from_none_messages);
} }
@Test @Test

View File

@@ -71,20 +71,20 @@ public class ZenModeSettingsTest {
@Test @Test
public void testGetCallsSettingSummary_none() { public void testGetCallsSettingSummary_none() {
Policy policy = new Policy(0, 0, 0, 0); Policy policy = new Policy(0, 0, 0, 0);
assertThat(mBuilder.getCallsSettingSummary(policy)).isEqualTo("None"); assertThat(mBuilder.getCallsSettingSummary(policy)).isEqualTo("Don\u2019t allow any calls");
} }
@Test @Test
public void testGetCallsSettingSummary_contacts() { public void testGetCallsSettingSummary_contacts() {
Policy policy = new Policy(Policy.PRIORITY_CATEGORY_ALARMS | Policy.PRIORITY_CATEGORY_CALLS, Policy policy = new Policy(Policy.PRIORITY_CATEGORY_ALARMS | Policy.PRIORITY_CATEGORY_CALLS,
Policy.PRIORITY_SENDERS_CONTACTS, 0, 0); Policy.PRIORITY_SENDERS_CONTACTS, 0, 0);
assertThat(mBuilder.getCallsSettingSummary(policy)).isEqualTo("From contacts"); assertThat(mBuilder.getCallsSettingSummary(policy)).isEqualTo("Allow from contacts");
} }
@Test @Test
public void testGetCallsSettingSummary_repeatCallers() { public void testGetCallsSettingSummary_repeatCallers() {
Policy policy = new Policy(Policy.PRIORITY_CATEGORY_REPEAT_CALLERS, 0, 0, 0); Policy policy = new Policy(Policy.PRIORITY_CATEGORY_REPEAT_CALLERS, 0, 0, 0);
assertThat(mBuilder.getCallsSettingSummary(policy)).isEqualTo("From repeat callers"); assertThat(mBuilder.getCallsSettingSummary(policy)).isEqualTo("Allow from repeat callers");
} }
@Test @Test
@@ -93,7 +93,7 @@ public class ZenModeSettingsTest {
Policy.PRIORITY_CATEGORY_REPEAT_CALLERS | Policy.PRIORITY_CATEGORY_CALLS, Policy.PRIORITY_CATEGORY_REPEAT_CALLERS | Policy.PRIORITY_CATEGORY_CALLS,
Policy.PRIORITY_SENDERS_STARRED, 0, 0); Policy.PRIORITY_SENDERS_STARRED, 0, 0);
assertThat(mBuilder.getCallsSettingSummary(policy)) assertThat(mBuilder.getCallsSettingSummary(policy))
.isEqualTo("From starred contacts and repeat callers"); .isEqualTo("Allow from starred contacts and repeat callers");
} }
@Test @Test