summaryrefslogtreecommitdiff
path: root/services/java/com/android/server/NotificationManagerService.java
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2013-03-07 13:58:00 -0500
committerDaniel Sandler <dsandler@android.com>2013-03-07 14:01:22 -0500
commit21ca44d67b972e66a5c8698886ee8747366c8b05 (patch)
tree8213848925220e0e3b691189f87f5981e624b04c /services/java/com/android/server/NotificationManagerService.java
parent4c333e177220387cf6746d47e1948bbfcc374512 (diff)
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
Diffstat (limited to 'services/java/com/android/server/NotificationManagerService.java')
-rw-r--r--services/java/com/android/server/NotificationManagerService.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java
index 9f2685bbb6bb..1e394d6f9e4c 100644
--- a/services/java/com/android/server/NotificationManagerService.java
+++ b/services/java/com/android/server/NotificationManagerService.java
@@ -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) {