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
This commit is contained in:
Beverly
2020-06-01 13:00:03 -04:00
parent eadf939db8
commit 9a9787e116

View File

@@ -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;
}