diff options
| author | 2022-08-19 23:12:10 +0000 | |
|---|---|---|
| committer | 2022-08-19 23:12:10 +0000 | |
| commit | b6e37f6f9ee0f354b7be371952787e6cfedc60e2 (patch) | |
| tree | 5d47dfc7fa0e612a7a5b727f7126b39d46a4b8ff | |
| parent | 9fbc372e61e93f6cb91e384e72927f5603374ed9 (diff) | |
| parent | 3e2e58838502fb5a2b4326cce090df461b56361d (diff) | |
Merge "Do not send AccessibilityEvent if notification is for different user." into rvc-dev am: f914ec1768 am: d000f2dbec am: 47f7686223 am: 3e2e588385
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19608552
Change-Id: I6216a188d70536b0ab79ffc0e046d29768048211
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -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 03544eff4f21..eb28a328a7e4 100755 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -7387,7 +7387,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 d593e8000048..c1bbad147872 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java @@ -1300,6 +1300,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(); |