diff options
| author | 2022-08-24 13:44:52 -0400 | |
|---|---|---|
| committer | 2022-08-24 14:33:25 -0400 | |
| commit | d810b582515528d682cf98804131b3ca8e20aa7d (patch) | |
| tree | c5e2b25790b79184a01d99e29b50eae99f8d51f7 | |
| parent | f68bb6df1e9f81d8cd8376ed339d8e6d03641722 (diff) | |
Log all non-intercepted notifications in Zen Log with the reason.
Also, log the contact affinity whenever we check it in shouldInterceptAudience (whether or not the notification is intercepted).
Bug: 232941276
Test: manual
Change-Id: I09816c1055d149b59c0d4a1f2963b105647e6bc0
| -rw-r--r-- | services/core/java/com/android/server/notification/ZenModeFiltering.java | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/notification/ZenModeFiltering.java b/services/core/java/com/android/server/notification/ZenModeFiltering.java index 7e36aed81d4a..db0ce2ef6fe2 100644 --- a/services/core/java/com/android/server/notification/ZenModeFiltering.java +++ b/services/core/java/com/android/server/notification/ZenModeFiltering.java @@ -149,8 +149,13 @@ public class ZenModeFiltering { */ public boolean shouldIntercept(int zen, NotificationManager.Policy policy, NotificationRecord record) { - // Zen mode is ignored for critical notifications. - if (zen == ZEN_MODE_OFF || isCritical(record)) { + if (zen == ZEN_MODE_OFF) { + return false; + } + + if (isCritical(record)) { + // Zen mode is ignored for critical notifications. + ZenLog.traceNotIntercepted(record, "criticalNotification"); return false; } // Make an exception to policy for the notification saying that policy has changed @@ -168,6 +173,7 @@ public class ZenModeFiltering { case Global.ZEN_MODE_ALARMS: if (isAlarm(record)) { // Alarms only + ZenLog.traceNotIntercepted(record, "alarm"); return false; } ZenLog.traceIntercepted(record, "alarmsOnly"); @@ -184,6 +190,7 @@ public class ZenModeFiltering { ZenLog.traceIntercepted(record, "!allowAlarms"); return true; } + ZenLog.traceNotIntercepted(record, "allowedAlarm"); return false; } if (isEvent(record)) { @@ -191,6 +198,7 @@ public class ZenModeFiltering { ZenLog.traceIntercepted(record, "!allowEvents"); return true; } + ZenLog.traceNotIntercepted(record, "allowedEvent"); return false; } if (isReminder(record)) { @@ -198,6 +206,7 @@ public class ZenModeFiltering { ZenLog.traceIntercepted(record, "!allowReminders"); return true; } + ZenLog.traceNotIntercepted(record, "allowedReminder"); return false; } if (isMedia(record)) { @@ -205,6 +214,7 @@ public class ZenModeFiltering { ZenLog.traceIntercepted(record, "!allowMedia"); return true; } + ZenLog.traceNotIntercepted(record, "allowedMedia"); return false; } if (isSystem(record)) { @@ -212,6 +222,7 @@ public class ZenModeFiltering { ZenLog.traceIntercepted(record, "!allowSystem"); return true; } + ZenLog.traceNotIntercepted(record, "allowedSystem"); return false; } if (isConversation(record)) { @@ -253,6 +264,7 @@ public class ZenModeFiltering { ZenLog.traceIntercepted(record, "!priority"); return true; default: + ZenLog.traceNotIntercepted(record, "unknownZenMode"); return false; } } @@ -271,10 +283,12 @@ public class ZenModeFiltering { } private static boolean shouldInterceptAudience(int source, NotificationRecord record) { - if (!audienceMatches(source, record.getContactAffinity())) { - ZenLog.traceIntercepted(record, "!audienceMatches"); + float affinity = record.getContactAffinity(); + if (!audienceMatches(source, affinity)) { + ZenLog.traceIntercepted(record, "!audienceMatches,affinity=" + affinity); return true; } + ZenLog.traceNotIntercepted(record, "affinity=" + affinity); return false; } |