Loading core/java/android/service/notification/ZenModeConfig.java +3 −4 Original line number Diff line number Diff line Loading @@ -2553,7 +2553,7 @@ public class ZenModeConfig implements Parcelable { if (!Flags.modesUi()) { return manualRule != null; } return manualRule != null && manualRule.isAutomaticActive(); return manualRule != null && manualRule.isActive(); } public static class ZenRule implements Parcelable { Loading Loading @@ -2932,8 +2932,7 @@ public class ZenModeConfig implements Parcelable { } } // TODO: b/363193376 - Rename to isActive() public boolean isAutomaticActive() { public boolean isActive() { if (Flags.modesApi() && Flags.modesUi()) { if (!enabled || getPkg() == null) { return false; Loading Loading @@ -3173,7 +3172,7 @@ public class ZenModeConfig implements Parcelable { // DND turned on by an automatic rule for (ZenRule automaticRule : config.automaticRules.values()) { if (automaticRule.isAutomaticActive()) { if (automaticRule.isActive()) { if (isValidEventConditionId(automaticRule.conditionId) || isValidScheduleConditionId(automaticRule.conditionId)) { // set text if automatic rule end time is the latest active rule end time Loading core/java/android/service/notification/ZenModeDiff.java +2 −2 Original line number Diff line number Diff line Loading @@ -495,8 +495,8 @@ public class ZenModeDiff { // Even if added or removed, there may be a change in whether or not it was active. // This only applies to automatic rules. boolean fromActive = from != null ? from.isAutomaticActive() : false; boolean toActive = to != null ? to.isAutomaticActive() : false; boolean fromActive = from != null ? from.isActive() : false; boolean toActive = to != null ? to.isActive() : false; if (fromActive != toActive) { mActiveDiff = new FieldDiff<>(fromActive, toActive); } Loading packages/SettingsLib/src/com/android/settingslib/notification/modes/ZenMode.java +1 −1 Original line number Diff line number Diff line Loading @@ -140,7 +140,7 @@ public class ZenMode implements Parcelable { private static Status computeStatus(@NonNull ZenModeConfig.ZenRule zenRuleExtraData) { if (zenRuleExtraData.enabled) { if (zenRuleExtraData.isAutomaticActive()) { if (zenRuleExtraData.isActive()) { return Status.ENABLED_AND_ACTIVE; } else { return Status.ENABLED; Loading services/core/java/com/android/server/notification/ZenModeEventLogger.java +1 −1 Original line number Diff line number Diff line Loading @@ -419,7 +419,7 @@ class ZenModeEventLogger { if (config.automaticRules != null) { for (ZenModeConfig.ZenRule rule : config.automaticRules.values()) { if (rule != null && rule.isAutomaticActive()) { if (rule != null && rule.isActive()) { rules.add(rule); } } Loading services/core/java/com/android/server/notification/ZenModeHelper.java +10 −10 Original line number Diff line number Diff line Loading @@ -887,7 +887,7 @@ public class ZenModeHelper { return Condition.STATE_UNKNOWN; } if (Flags.modesApi() && Flags.modesUi()) { return rule.isAutomaticActive() ? STATE_TRUE : STATE_FALSE; return rule.isActive() ? STATE_TRUE : STATE_FALSE; } else { // Buggy, does not consider snoozing! return rule.condition != null ? rule.condition.state : STATE_FALSE; Loading Loading @@ -967,12 +967,12 @@ public class ZenModeHelper { // snoozing-unsnoozing or activating-stopping. if (condition.state == STATE_TRUE) { rule.resetConditionOverride(); if (!rule.isAutomaticActive()) { if (!rule.isActive()) { rule.setConditionOverride(OVERRIDE_ACTIVATE); } } else if (condition.state == STATE_FALSE) { rule.resetConditionOverride(); if (rule.isAutomaticActive()) { if (rule.isActive()) { rule.setConditionOverride(OVERRIDE_DEACTIVATE); } } Loading Loading @@ -1609,7 +1609,7 @@ public class ZenModeHelper { // User deactivation of DND means just turning off the manual DND rule. // For API calls (different origin) keep old behavior of snoozing all rules. for (ZenRule automaticRule : newConfig.automaticRules.values()) { if (automaticRule.isAutomaticActive()) { if (automaticRule.isActive()) { automaticRule.setConditionOverride(OVERRIDE_DEACTIVATE); } } Loading @@ -1618,7 +1618,7 @@ public class ZenModeHelper { if (zenMode == Global.ZEN_MODE_OFF) { newConfig.manualRule = null; for (ZenRule automaticRule : newConfig.automaticRules.values()) { if (automaticRule.isAutomaticActive()) { if (automaticRule.isActive()) { automaticRule.setConditionOverride(OVERRIDE_DEACTIVATE); } } Loading Loading @@ -1665,7 +1665,7 @@ public class ZenModeHelper { mConfig.manualRule.dumpDebug(proto, ZenModeProto.ENABLED_ACTIVE_CONDITIONS); } for (ZenRule rule : mConfig.automaticRules.values()) { if (rule.isAutomaticActive()) { if (rule.isActive()) { rule.dumpDebug(proto, ZenModeProto.ENABLED_ACTIVE_CONDITIONS); } } Loading Loading @@ -2020,9 +2020,9 @@ public class ZenModeHelper { scheduleEnabledBroadcast( rule.getPkg(), config.user, rule.id, rule.enabled); } if (original.isAutomaticActive() != rule.isAutomaticActive()) { if (original.isActive() != rule.isActive()) { scheduleActivationBroadcast( rule.getPkg(), config.user, rule.id, rule.isAutomaticActive()); rule.getPkg(), config.user, rule.id, rule.isActive()); } } } Loading Loading @@ -2106,7 +2106,7 @@ public class ZenModeHelper { if (mConfig.isManualActive()) return mConfig.manualRule.zenMode; int zen = Global.ZEN_MODE_OFF; for (ZenRule automaticRule : mConfig.automaticRules.values()) { if (automaticRule.isAutomaticActive()) { if (automaticRule.isActive()) { if (zenSeverity(automaticRule.zenMode) > zenSeverity(zen)) { // automatic rule triggered dnd and user hasn't seen update dnd dialog if (Settings.Secure.getInt(mContext.getContentResolver(), Loading Loading @@ -2182,7 +2182,7 @@ public class ZenModeHelper { } for (ZenRule automaticRule : mConfig.automaticRules.values()) { if (automaticRule.isAutomaticActive()) { if (automaticRule.isActive()) { // Active rules with INTERRUPTION_FILTER_ALL are not included in consolidated // policy. This is relevant in case some other active rule has a more // restrictive INTERRUPTION_FILTER but a more lenient ZenPolicy! Loading Loading
core/java/android/service/notification/ZenModeConfig.java +3 −4 Original line number Diff line number Diff line Loading @@ -2553,7 +2553,7 @@ public class ZenModeConfig implements Parcelable { if (!Flags.modesUi()) { return manualRule != null; } return manualRule != null && manualRule.isAutomaticActive(); return manualRule != null && manualRule.isActive(); } public static class ZenRule implements Parcelable { Loading Loading @@ -2932,8 +2932,7 @@ public class ZenModeConfig implements Parcelable { } } // TODO: b/363193376 - Rename to isActive() public boolean isAutomaticActive() { public boolean isActive() { if (Flags.modesApi() && Flags.modesUi()) { if (!enabled || getPkg() == null) { return false; Loading Loading @@ -3173,7 +3172,7 @@ public class ZenModeConfig implements Parcelable { // DND turned on by an automatic rule for (ZenRule automaticRule : config.automaticRules.values()) { if (automaticRule.isAutomaticActive()) { if (automaticRule.isActive()) { if (isValidEventConditionId(automaticRule.conditionId) || isValidScheduleConditionId(automaticRule.conditionId)) { // set text if automatic rule end time is the latest active rule end time Loading
core/java/android/service/notification/ZenModeDiff.java +2 −2 Original line number Diff line number Diff line Loading @@ -495,8 +495,8 @@ public class ZenModeDiff { // Even if added or removed, there may be a change in whether or not it was active. // This only applies to automatic rules. boolean fromActive = from != null ? from.isAutomaticActive() : false; boolean toActive = to != null ? to.isAutomaticActive() : false; boolean fromActive = from != null ? from.isActive() : false; boolean toActive = to != null ? to.isActive() : false; if (fromActive != toActive) { mActiveDiff = new FieldDiff<>(fromActive, toActive); } Loading
packages/SettingsLib/src/com/android/settingslib/notification/modes/ZenMode.java +1 −1 Original line number Diff line number Diff line Loading @@ -140,7 +140,7 @@ public class ZenMode implements Parcelable { private static Status computeStatus(@NonNull ZenModeConfig.ZenRule zenRuleExtraData) { if (zenRuleExtraData.enabled) { if (zenRuleExtraData.isAutomaticActive()) { if (zenRuleExtraData.isActive()) { return Status.ENABLED_AND_ACTIVE; } else { return Status.ENABLED; Loading
services/core/java/com/android/server/notification/ZenModeEventLogger.java +1 −1 Original line number Diff line number Diff line Loading @@ -419,7 +419,7 @@ class ZenModeEventLogger { if (config.automaticRules != null) { for (ZenModeConfig.ZenRule rule : config.automaticRules.values()) { if (rule != null && rule.isAutomaticActive()) { if (rule != null && rule.isActive()) { rules.add(rule); } } Loading
services/core/java/com/android/server/notification/ZenModeHelper.java +10 −10 Original line number Diff line number Diff line Loading @@ -887,7 +887,7 @@ public class ZenModeHelper { return Condition.STATE_UNKNOWN; } if (Flags.modesApi() && Flags.modesUi()) { return rule.isAutomaticActive() ? STATE_TRUE : STATE_FALSE; return rule.isActive() ? STATE_TRUE : STATE_FALSE; } else { // Buggy, does not consider snoozing! return rule.condition != null ? rule.condition.state : STATE_FALSE; Loading Loading @@ -967,12 +967,12 @@ public class ZenModeHelper { // snoozing-unsnoozing or activating-stopping. if (condition.state == STATE_TRUE) { rule.resetConditionOverride(); if (!rule.isAutomaticActive()) { if (!rule.isActive()) { rule.setConditionOverride(OVERRIDE_ACTIVATE); } } else if (condition.state == STATE_FALSE) { rule.resetConditionOverride(); if (rule.isAutomaticActive()) { if (rule.isActive()) { rule.setConditionOverride(OVERRIDE_DEACTIVATE); } } Loading Loading @@ -1609,7 +1609,7 @@ public class ZenModeHelper { // User deactivation of DND means just turning off the manual DND rule. // For API calls (different origin) keep old behavior of snoozing all rules. for (ZenRule automaticRule : newConfig.automaticRules.values()) { if (automaticRule.isAutomaticActive()) { if (automaticRule.isActive()) { automaticRule.setConditionOverride(OVERRIDE_DEACTIVATE); } } Loading @@ -1618,7 +1618,7 @@ public class ZenModeHelper { if (zenMode == Global.ZEN_MODE_OFF) { newConfig.manualRule = null; for (ZenRule automaticRule : newConfig.automaticRules.values()) { if (automaticRule.isAutomaticActive()) { if (automaticRule.isActive()) { automaticRule.setConditionOverride(OVERRIDE_DEACTIVATE); } } Loading Loading @@ -1665,7 +1665,7 @@ public class ZenModeHelper { mConfig.manualRule.dumpDebug(proto, ZenModeProto.ENABLED_ACTIVE_CONDITIONS); } for (ZenRule rule : mConfig.automaticRules.values()) { if (rule.isAutomaticActive()) { if (rule.isActive()) { rule.dumpDebug(proto, ZenModeProto.ENABLED_ACTIVE_CONDITIONS); } } Loading Loading @@ -2020,9 +2020,9 @@ public class ZenModeHelper { scheduleEnabledBroadcast( rule.getPkg(), config.user, rule.id, rule.enabled); } if (original.isAutomaticActive() != rule.isAutomaticActive()) { if (original.isActive() != rule.isActive()) { scheduleActivationBroadcast( rule.getPkg(), config.user, rule.id, rule.isAutomaticActive()); rule.getPkg(), config.user, rule.id, rule.isActive()); } } } Loading Loading @@ -2106,7 +2106,7 @@ public class ZenModeHelper { if (mConfig.isManualActive()) return mConfig.manualRule.zenMode; int zen = Global.ZEN_MODE_OFF; for (ZenRule automaticRule : mConfig.automaticRules.values()) { if (automaticRule.isAutomaticActive()) { if (automaticRule.isActive()) { if (zenSeverity(automaticRule.zenMode) > zenSeverity(zen)) { // automatic rule triggered dnd and user hasn't seen update dnd dialog if (Settings.Secure.getInt(mContext.getContentResolver(), Loading Loading @@ -2182,7 +2182,7 @@ public class ZenModeHelper { } for (ZenRule automaticRule : mConfig.automaticRules.values()) { if (automaticRule.isAutomaticActive()) { if (automaticRule.isActive()) { // Active rules with INTERRUPTION_FILTER_ALL are not included in consolidated // policy. This is relevant in case some other active rule has a more // restrictive INTERRUPTION_FILTER but a more lenient ZenPolicy! Loading