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

Commit 21ca44d6 authored by Daniel Sandler's avatar Daniel Sandler
Browse files

Properly support USER_ALL in notification listener API.

Listeners should be notified for any notification if they
register for USER_ALL, or for any notification posted to
USER_ALL.

Bug: 8328357
Change-Id: Ib5024d41287090d1a390539a015d8cb4dfa854a7
parent 4c333e17
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -186,8 +186,14 @@ public class NotificationManagerService extends INotificationManager.Stub
            this.userid = userid;
        }

        boolean userMatches(StatusBarNotification sbn) {
            if (this.userid == UserHandle.USER_ALL) return true;
            int nid = sbn.getUserId();
            return (nid == UserHandle.USER_ALL || nid == this.userid);
        }

        public void notifyPostedIfUserMatch(StatusBarNotification sbn) {
            if (this.userid != sbn.getUserId()) return;
            if (!userMatches(sbn)) return;
            try {
                listener.onNotificationPosted(sbn);
            } catch (RemoteException ex) {
@@ -196,7 +202,7 @@ public class NotificationManagerService extends INotificationManager.Stub
        }

        public void notifyRemovedIfUserMatch(StatusBarNotification sbn) {
            if (this.userid != sbn.getUserId()) return;
            if (!userMatches(sbn)) return;
            try {
                listener.onNotificationRemoved(sbn);
            } catch (RemoteException ex) {