Loading core/java/android/service/notification/ZenModeConfig.java +2 −2 Original line number Diff line number Diff line Loading @@ -813,9 +813,9 @@ public class ZenModeConfig implements Parcelable { rt.enabler = parser.getAttributeValue(null, RULE_ATT_ENABLER); rt.condition = readConditionXml(parser); // all default rules and user created rules updated to zenMode important interruptions if (rt.zenMode != Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS if (!Flags.modesApi() && rt.zenMode != Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS && Condition.isValidId(rt.conditionId, SYSTEM_AUTHORITY)) { // all default rules and user created rules updated to zenMode important interruptions Slog.i(TAG, "Updating zenMode of automatic rule " + rt.name); rt.zenMode = Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS; } Loading services/tests/uiservicestests/src/com/android/server/notification/ZenModeConfigTest.java +15 −0 Original line number Diff line number Diff line Loading @@ -624,6 +624,21 @@ public class ZenModeConfigTest extends UiServiceTestCase { assertEquals(rule.condition, fromXml.condition); } @Test public void testRuleXml_customInterruptionFilter() throws Exception { ZenModeConfig.ZenRule rule = new ZenModeConfig.ZenRule(); rule.zenMode = Settings.Global.ZEN_MODE_ALARMS; rule.conditionId = Uri.parse("condition://android/blah"); assertThat(Condition.isValidId(rule.conditionId, ZenModeConfig.SYSTEM_AUTHORITY)).isTrue(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); writeRuleXml(rule, baos); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); ZenModeConfig.ZenRule fromXml = readRuleXml(bais); assertEquals(rule.zenMode, fromXml.zenMode); } @Test public void testZenPolicyXml_allUnset() throws Exception { ZenPolicy policy = new ZenPolicy.Builder().build(); Loading Loading
core/java/android/service/notification/ZenModeConfig.java +2 −2 Original line number Diff line number Diff line Loading @@ -813,9 +813,9 @@ public class ZenModeConfig implements Parcelable { rt.enabler = parser.getAttributeValue(null, RULE_ATT_ENABLER); rt.condition = readConditionXml(parser); // all default rules and user created rules updated to zenMode important interruptions if (rt.zenMode != Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS if (!Flags.modesApi() && rt.zenMode != Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS && Condition.isValidId(rt.conditionId, SYSTEM_AUTHORITY)) { // all default rules and user created rules updated to zenMode important interruptions Slog.i(TAG, "Updating zenMode of automatic rule " + rt.name); rt.zenMode = Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS; } Loading
services/tests/uiservicestests/src/com/android/server/notification/ZenModeConfigTest.java +15 −0 Original line number Diff line number Diff line Loading @@ -624,6 +624,21 @@ public class ZenModeConfigTest extends UiServiceTestCase { assertEquals(rule.condition, fromXml.condition); } @Test public void testRuleXml_customInterruptionFilter() throws Exception { ZenModeConfig.ZenRule rule = new ZenModeConfig.ZenRule(); rule.zenMode = Settings.Global.ZEN_MODE_ALARMS; rule.conditionId = Uri.parse("condition://android/blah"); assertThat(Condition.isValidId(rule.conditionId, ZenModeConfig.SYSTEM_AUTHORITY)).isTrue(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); writeRuleXml(rule, baos); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); ZenModeConfig.ZenRule fromXml = readRuleXml(bais); assertEquals(rule.zenMode, fromXml.zenMode); } @Test public void testZenPolicyXml_allUnset() throws Exception { ZenPolicy policy = new ZenPolicy.Builder().build(); Loading