Loading services/core/java/com/android/server/notification/ZenModeFiltering.java +18 −4 Original line number Original line Diff line number Diff line Loading @@ -149,8 +149,13 @@ public class ZenModeFiltering { */ */ public boolean shouldIntercept(int zen, NotificationManager.Policy policy, public boolean shouldIntercept(int zen, NotificationManager.Policy policy, NotificationRecord record) { NotificationRecord record) { if (zen == ZEN_MODE_OFF) { return false; } if (isCritical(record)) { // Zen mode is ignored for critical notifications. // Zen mode is ignored for critical notifications. if (zen == ZEN_MODE_OFF || isCritical(record)) { ZenLog.traceNotIntercepted(record, "criticalNotification"); return false; return false; } } // Make an exception to policy for the notification saying that policy has changed // Make an exception to policy for the notification saying that policy has changed Loading @@ -168,6 +173,7 @@ public class ZenModeFiltering { case Global.ZEN_MODE_ALARMS: case Global.ZEN_MODE_ALARMS: if (isAlarm(record)) { if (isAlarm(record)) { // Alarms only // Alarms only ZenLog.traceNotIntercepted(record, "alarm"); return false; return false; } } ZenLog.traceIntercepted(record, "alarmsOnly"); ZenLog.traceIntercepted(record, "alarmsOnly"); Loading @@ -184,6 +190,7 @@ public class ZenModeFiltering { ZenLog.traceIntercepted(record, "!allowAlarms"); ZenLog.traceIntercepted(record, "!allowAlarms"); return true; return true; } } ZenLog.traceNotIntercepted(record, "allowedAlarm"); return false; return false; } } if (isEvent(record)) { if (isEvent(record)) { Loading @@ -191,6 +198,7 @@ public class ZenModeFiltering { ZenLog.traceIntercepted(record, "!allowEvents"); ZenLog.traceIntercepted(record, "!allowEvents"); return true; return true; } } ZenLog.traceNotIntercepted(record, "allowedEvent"); return false; return false; } } if (isReminder(record)) { if (isReminder(record)) { Loading @@ -198,6 +206,7 @@ public class ZenModeFiltering { ZenLog.traceIntercepted(record, "!allowReminders"); ZenLog.traceIntercepted(record, "!allowReminders"); return true; return true; } } ZenLog.traceNotIntercepted(record, "allowedReminder"); return false; return false; } } if (isMedia(record)) { if (isMedia(record)) { Loading @@ -205,6 +214,7 @@ public class ZenModeFiltering { ZenLog.traceIntercepted(record, "!allowMedia"); ZenLog.traceIntercepted(record, "!allowMedia"); return true; return true; } } ZenLog.traceNotIntercepted(record, "allowedMedia"); return false; return false; } } if (isSystem(record)) { if (isSystem(record)) { Loading @@ -212,6 +222,7 @@ public class ZenModeFiltering { ZenLog.traceIntercepted(record, "!allowSystem"); ZenLog.traceIntercepted(record, "!allowSystem"); return true; return true; } } ZenLog.traceNotIntercepted(record, "allowedSystem"); return false; return false; } } if (isConversation(record)) { if (isConversation(record)) { Loading Loading @@ -253,6 +264,7 @@ public class ZenModeFiltering { ZenLog.traceIntercepted(record, "!priority"); ZenLog.traceIntercepted(record, "!priority"); return true; return true; default: default: ZenLog.traceNotIntercepted(record, "unknownZenMode"); return false; return false; } } } } Loading @@ -271,10 +283,12 @@ public class ZenModeFiltering { } } private static boolean shouldInterceptAudience(int source, NotificationRecord record) { private static boolean shouldInterceptAudience(int source, NotificationRecord record) { if (!audienceMatches(source, record.getContactAffinity())) { float affinity = record.getContactAffinity(); ZenLog.traceIntercepted(record, "!audienceMatches"); if (!audienceMatches(source, affinity)) { ZenLog.traceIntercepted(record, "!audienceMatches,affinity=" + affinity); return true; return true; } } ZenLog.traceNotIntercepted(record, "affinity=" + affinity); return false; return false; } } Loading Loading
services/core/java/com/android/server/notification/ZenModeFiltering.java +18 −4 Original line number Original line Diff line number Diff line Loading @@ -149,8 +149,13 @@ public class ZenModeFiltering { */ */ public boolean shouldIntercept(int zen, NotificationManager.Policy policy, public boolean shouldIntercept(int zen, NotificationManager.Policy policy, NotificationRecord record) { NotificationRecord record) { if (zen == ZEN_MODE_OFF) { return false; } if (isCritical(record)) { // Zen mode is ignored for critical notifications. // Zen mode is ignored for critical notifications. if (zen == ZEN_MODE_OFF || isCritical(record)) { ZenLog.traceNotIntercepted(record, "criticalNotification"); return false; return false; } } // Make an exception to policy for the notification saying that policy has changed // Make an exception to policy for the notification saying that policy has changed Loading @@ -168,6 +173,7 @@ public class ZenModeFiltering { case Global.ZEN_MODE_ALARMS: case Global.ZEN_MODE_ALARMS: if (isAlarm(record)) { if (isAlarm(record)) { // Alarms only // Alarms only ZenLog.traceNotIntercepted(record, "alarm"); return false; return false; } } ZenLog.traceIntercepted(record, "alarmsOnly"); ZenLog.traceIntercepted(record, "alarmsOnly"); Loading @@ -184,6 +190,7 @@ public class ZenModeFiltering { ZenLog.traceIntercepted(record, "!allowAlarms"); ZenLog.traceIntercepted(record, "!allowAlarms"); return true; return true; } } ZenLog.traceNotIntercepted(record, "allowedAlarm"); return false; return false; } } if (isEvent(record)) { if (isEvent(record)) { Loading @@ -191,6 +198,7 @@ public class ZenModeFiltering { ZenLog.traceIntercepted(record, "!allowEvents"); ZenLog.traceIntercepted(record, "!allowEvents"); return true; return true; } } ZenLog.traceNotIntercepted(record, "allowedEvent"); return false; return false; } } if (isReminder(record)) { if (isReminder(record)) { Loading @@ -198,6 +206,7 @@ public class ZenModeFiltering { ZenLog.traceIntercepted(record, "!allowReminders"); ZenLog.traceIntercepted(record, "!allowReminders"); return true; return true; } } ZenLog.traceNotIntercepted(record, "allowedReminder"); return false; return false; } } if (isMedia(record)) { if (isMedia(record)) { Loading @@ -205,6 +214,7 @@ public class ZenModeFiltering { ZenLog.traceIntercepted(record, "!allowMedia"); ZenLog.traceIntercepted(record, "!allowMedia"); return true; return true; } } ZenLog.traceNotIntercepted(record, "allowedMedia"); return false; return false; } } if (isSystem(record)) { if (isSystem(record)) { Loading @@ -212,6 +222,7 @@ public class ZenModeFiltering { ZenLog.traceIntercepted(record, "!allowSystem"); ZenLog.traceIntercepted(record, "!allowSystem"); return true; return true; } } ZenLog.traceNotIntercepted(record, "allowedSystem"); return false; return false; } } if (isConversation(record)) { if (isConversation(record)) { Loading Loading @@ -253,6 +264,7 @@ public class ZenModeFiltering { ZenLog.traceIntercepted(record, "!priority"); ZenLog.traceIntercepted(record, "!priority"); return true; return true; default: default: ZenLog.traceNotIntercepted(record, "unknownZenMode"); return false; return false; } } } } Loading @@ -271,10 +283,12 @@ public class ZenModeFiltering { } } private static boolean shouldInterceptAudience(int source, NotificationRecord record) { private static boolean shouldInterceptAudience(int source, NotificationRecord record) { if (!audienceMatches(source, record.getContactAffinity())) { float affinity = record.getContactAffinity(); ZenLog.traceIntercepted(record, "!audienceMatches"); if (!audienceMatches(source, affinity)) { ZenLog.traceIntercepted(record, "!audienceMatches,affinity=" + affinity); return true; return true; } } ZenLog.traceNotIntercepted(record, "affinity=" + affinity); return false; return false; } } Loading