diff --git a/res/values/strings.xml b/res/values/strings.xml
index c16ecb574cf..0922ebb13c3 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -7218,9 +7218,11 @@
Allow visual signals
- What to block
+ Block visual disturbances
- When notifications arrive
+ When the screen is on
+
+ When the screen is off
Mute sound and vibration
@@ -7238,6 +7240,12 @@
Hide from notification list
+
+ Never
+
+ When screen is off
+
+ When screen is on
Sound and vibration
@@ -7245,6 +7253,8 @@
Sound, vibration, and visual signs of notifications
+ Notifications needed for basic phone activity and status will never be hidden
+
None
diff --git a/res/xml/zen_mode_block_settings.xml b/res/xml/zen_mode_block_settings.xml
index 595e2caade5..63dbd476b97 100644
--- a/res/xml/zen_mode_block_settings.xml
+++ b/res/xml/zen_mode_block_settings.xml
@@ -18,17 +18,11 @@
-
-
-
+ android:title="@string/zen_mode_what_to_block_title">
+ android:title="@string/zen_mode_block_effects_screen_off"
+ android:key="zen_mode_block_screen_off">
-
-
+ android:key="zen_effect_ambient"
+ android:title="@string/zen_mode_block_effect_ambient" />
+
+
-
+
+
+
+
+
+
blockedStrings = new ArrayList<>();
+ if (Policy.areAnyScreenOffEffectsSuppressed(policy.suppressedVisualEffects)) {
+ blockedStrings.add(mContext.getResources().getString(
+ R.string.zen_mode_block_effect_summary_screen_off));
+ }
+ if (Policy.areAnyScreenOnEffectsSuppressed(policy.suppressedVisualEffects)) {
+ blockedStrings.add(mContext.getResources().getString(
+ R.string.zen_mode_block_effect_summary_screen_on));
+ }
+
+ if (blockedStrings.size() == 0) {
+ return mContext.getResources().getString(
+ R.string.zen_mode_block_effect_summary_none);
+ } else if (blockedStrings.size() == 1) {
+ return blockedStrings.get(0);
+ } else {
+ return mContext.getResources().getString(R.string.join_two_unrelated_items,
+ blockedStrings.get(0), blockedStrings.get(1));
}
- return mContext.getResources().getString(
- R.string.zen_mode_block_effect_summary_some);
}
String getAutomaticRulesSummary() {
diff --git a/tests/robotests/src/com/android/settings/notification/ZenModeSettingsTest.java b/tests/robotests/src/com/android/settings/notification/ZenModeSettingsTest.java
index bd94bf5f24d..d706d126c07 100644
--- a/tests/robotests/src/com/android/settings/notification/ZenModeSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/notification/ZenModeSettingsTest.java
@@ -71,6 +71,35 @@ public class ZenModeSettingsTest {
assertEquals(alarmsAndMedia, result);
}
+ @Test
+ public void testBlockedEffectsSummary_none() {
+ NotificationManager.Policy policy = new NotificationManager.Policy(0, 0, 0, 0);
+ assertEquals("Never", mBuilder.getBlockedEffectsSummary(policy));
+ }
+
+ @Test
+ public void testBlockedEffectsSummary_screen_on() {
+ NotificationManager.Policy policy = new NotificationManager.Policy(
+ 0, 0, 0, NotificationManager.Policy.SUPPRESSED_EFFECT_PEEK);
+ assertEquals("When screen is on", mBuilder.getBlockedEffectsSummary(policy));
+ }
+
+ @Test
+ public void testBlockedEffectsSummary_screen_off() {
+ NotificationManager.Policy policy = new NotificationManager.Policy(
+ 0, 0, 0, NotificationManager.Policy.SUPPRESSED_EFFECT_AMBIENT);
+ assertEquals("When screen is off", mBuilder.getBlockedEffectsSummary(policy));
+ }
+
+ @Test
+ public void testBlockedEffectsSummary_both() {
+ NotificationManager.Policy policy = new NotificationManager.Policy(0, 0, 0,
+ NotificationManager.Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST
+ | NotificationManager.Policy.SUPPRESSED_EFFECT_LIGHTS);
+ assertEquals("When screen is off, When screen is on",
+ mBuilder.getBlockedEffectsSummary(policy));
+ }
+
@Test
public void searchProvider_shouldIndexDefaultXml() {
final List sir = ZenModeSettings.SEARCH_INDEX_DATA_PROVIDER