diff options
| author | 2022-08-19 21:35:32 +0000 | |
|---|---|---|
| committer | 2022-08-19 21:35:32 +0000 | |
| commit | f914ec1768d06ce756891d0625a27f123a969fbf (patch) | |
| tree | d4c3bc920004a50b47dc0debea36e9f0d61f7f50 | |
| parent | 26f72ff555b04cf9043d04d892a6c2d72c251c96 (diff) | |
| parent | a367c0a16a9070ed6bee3028ac5bbc967773ee8f (diff) | |
Merge "Do not send AccessibilityEvent if notification is for different user." into rvc-dev
| -rwxr-xr-x | services/core/java/com/android/server/notification/NotificationManagerService.java | 3 | ||||
| -rw-r--r-- | services/tests/uiservicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java | 15 |
2 files changed, 17 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index ad34aeaf906b..54c2f1ed5fc4 100755 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -7014,7 +7014,8 @@ public class NotificationManagerService extends SystemService { && (record.getSuppressedVisualEffects() & SUPPRESSED_EFFECT_STATUS_BAR) != 0; if (!record.isUpdate && record.getImportance() > IMPORTANCE_MIN - && !suppressedByDnd) { + && !suppressedByDnd + && isNotificationForCurrentUser(record)) { sendAccessibilityEvent(record); sentAccessibilityEvent = true; } diff --git a/services/tests/uiservicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java b/services/tests/uiservicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java index eff25e51f405..b80eb20a32ff 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java @@ -1275,6 +1275,21 @@ public class BuzzBeepBlinkTest extends UiServiceTestCase { } @Test + public void testA11yCrossUserEventNotSent() throws Exception { + final Notification n = new Builder(getContext(), "test") + .setSmallIcon(android.R.drawable.sym_def_app_icon).build(); + int userId = mUser.getIdentifier() + 1; + StatusBarNotification sbn = new StatusBarNotification(mPkg, mPkg, 0, mTag, mUid, + mPid, n, UserHandle.of(userId), null, System.currentTimeMillis()); + NotificationRecord r = new NotificationRecord(getContext(), sbn, + new NotificationChannel("test", "test", IMPORTANCE_HIGH)); + + mService.buzzBeepBlinkLocked(r); + + verify(mAccessibilityService, never()).sendAccessibilityEvent(any(), anyInt()); + } + + @Test public void testLightsScreenOn() { mService.mScreenOn = true; NotificationRecord r = getLightsNotification(); |