Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a8fe3a8f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Daniel Norman
Browse files

[conflict] Merge "Do not send AccessibilityEvent if notification is for...

[conflict] Merge "Do not send AccessibilityEvent if notification is for different user." into qt-dev am: dedf573b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19607760



Change-Id: I62ba986987ba4f490177e2e5bc4c981a8f4a8fe7
Merged-In: I62a875e26e214847ec72ce3c41b4f2fa8e597e07
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents e37a0ac9 dedf573b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -5973,7 +5973,8 @@ public class NotificationManagerService extends SystemService {
        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 (!record.isUpdate && record.getImportance() > IMPORTANCE_MIN
                && isNotificationForCurrentUser(record)) {
            sendAccessibilityEvent(notification, record.sbn.getPackageName());
            sentAccessibilityEvent = true;
        }
+15 −0
Original line number Diff line number Diff line
@@ -1125,6 +1125,21 @@ public class BuzzBeepBlinkTest extends UiServiceTestCase {
        verify(mAccessibilityService, times(1)).sendAccessibilityEvent(any(), anyInt());
    }

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