@@ -991,6 +991,14 @@ public void enqueueNotificationInternal(String pkg, int callingUid, int callingP
991991 | Notification .FLAG_NO_CLEAR ;
992992 }
993993
994+ final int currentUser ;
995+ final long token = Binder .clearCallingIdentity ();
996+ try {
997+ currentUser = ActivityManager .getCurrentUser ();
998+ } finally {
999+ Binder .restoreCallingIdentity (token );
1000+ }
1001+
9941002 if (notification .icon != 0 ) {
9951003 final StatusBarNotification n = new StatusBarNotification (
9961004 pkg , id , tag , r .uid , r .initialPid , score , notification , user );
@@ -1015,7 +1023,10 @@ public void enqueueNotificationInternal(String pkg, int callingUid, int callingP
10151023 Binder .restoreCallingIdentity (identity );
10161024 }
10171025 }
1018- sendAccessibilityEvent (notification , pkg );
1026+ // Send accessibility events only for the current user.
1027+ if (currentUser == userId ) {
1028+ sendAccessibilityEvent (notification , pkg );
1029+ }
10191030 } else {
10201031 Slog .e (TAG , "Ignoring notification with icon==0: " + notification );
10211032 if (old != null && old .statusBarKey != null ) {
@@ -1029,14 +1040,6 @@ public void enqueueNotificationInternal(String pkg, int callingUid, int callingP
10291040 }
10301041 }
10311042
1032- final int currentUser ;
1033- final long token = Binder .clearCallingIdentity ();
1034- try {
1035- currentUser = ActivityManager .getCurrentUser ();
1036- } finally {
1037- Binder .restoreCallingIdentity (token );
1038- }
1039-
10401043 // If we're not supposed to beep, vibrate, etc. then don't.
10411044 if (((mDisabledNotifications & StatusBarManager .DISABLE_NOTIFICATION_ALERTS ) == 0 )
10421045 && (!(old != null
0 commit comments