From 9a9787e116616370c1af1665e5ccf3fa04161fd1 Mon Sep 17 00:00:00 2001 From: Beverly Date: Mon, 1 Jun 2020 13:00:03 -0400 Subject: [PATCH] Don't announce dnd intercepted notfications When talkback is enabled, don't announce notifications that are being visually blocked by DND. Test: manual Fixes: 126670462 Change-Id: I61e7a99691149dff0c4c2dcb60f0fe68c1db876d --- .../notification/NotificationManagerService.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 6ae58ec7feeaa..62de3a1bc7cc4 100755 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -6802,9 +6802,13 @@ public class NotificationManagerService extends SystemService { boolean hasValidVibrate = false; boolean hasValidSound = false; boolean sentAccessibilityEvent = false; - // If the notification will appear in the status bar, it should send an accessibility - // event - if (!record.isUpdate && record.getImportance() > IMPORTANCE_MIN) { + + // If the notification will appear in the status bar, it should send an accessibility event + final boolean suppressedByDnd = record.isIntercepted() + && (record.getSuppressedVisualEffects() & SUPPRESSED_EFFECT_STATUS_BAR) != 0; + if (!record.isUpdate + && record.getImportance() > IMPORTANCE_MIN + && !suppressedByDnd) { sendAccessibilityEvent(notification, record.getSbn().getPackageName()); sentAccessibilityEvent = true; }