diff options
author | Adam Lesinski <adamlesinski@google.com> | 2014-03-27 11:15:11 -0700 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2014-03-27 18:26:11 +0000 |
commit | 350159c65a52092db04f1b8efce6943f61e50e73 (patch) | |
tree | 6b5adf53f5bfb7ec03d0d271ae07657e04987168 | |
parent | d00e8b5f7c5ac62f1fa4f6bd8746b57aeb42a8c0 (diff) | |
parent | 6984e4f9bbeb48fb7437183ed2aeb06661bbc228 (diff) | |
download | frameworks_base-350159c65a52092db04f1b8efce6943f61e50e73.zip frameworks_base-350159c65a52092db04f1b8efce6943f61e50e73.tar.gz frameworks_base-350159c65a52092db04f1b8efce6943f61e50e73.tar.bz2 |
resolved conflicts for merge of 6984e4f9 to master
Conflicts:
services/core/java/com/android/server/notification/NotificationManagerService.java
Change-Id: Ief1bf339cf7d75094c9a169264c015b1f286ed63
-rw-r--r-- | services/core/java/com/android/server/notification/NotificationManagerService.java | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 3bc7f4f..e25e42c 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -763,7 +763,7 @@ public class NotificationManagerService extends SystemService { } } - private NotificationListenerInfo checkListenerToken(INotificationListener listener) { + private NotificationListenerInfo checkListenerTokenLocked(INotificationListener listener) { checkNullListener(listener); final IBinder token = listener.asBinder(); final int N = mListeners.size(); @@ -927,7 +927,9 @@ public class NotificationManagerService extends SystemService { @Override public void onClearAll(int callingUid, int callingPid, int userId) { - cancelAll(callingUid, callingPid, userId, REASON_DELEGATE_CANCEL_ALL, null); + synchronized (mNotificationList) { + cancelAllLocked(callingUid, callingPid, userId, REASON_DELEGATE_CANCEL_ALL, null); + } } @Override @@ -1553,13 +1555,15 @@ public class NotificationManagerService extends SystemService { */ @Override public void cancelAllNotificationsFromListener(INotificationListener token) { - NotificationListenerInfo info = checkListenerToken(token); final int callingUid = Binder.getCallingUid(); final int callingPid = Binder.getCallingPid(); long identity = Binder.clearCallingIdentity(); try { - cancelAll(callingUid, callingPid, info.userid, - REASON_LISTENER_CANCEL_ALL, info); + synchronized (mNotificationList) { + NotificationListenerInfo info = checkListenerTokenLocked(token); + cancelAllLocked(callingUid, callingPid, info.userid, + REASON_LISTENER_CANCEL_ALL, info); + } } finally { Binder.restoreCallingIdentity(identity); } @@ -1575,15 +1579,17 @@ public class NotificationManagerService extends SystemService { @Override public void cancelNotificationFromListener(INotificationListener token, String pkg, String tag, int id) { - NotificationListenerInfo info = checkListenerToken(token); final int callingUid = Binder.getCallingUid(); final int callingPid = Binder.getCallingPid(); long identity = Binder.clearCallingIdentity(); try { - cancelNotification(callingUid, callingPid, pkg, tag, id, 0, - Notification.FLAG_ONGOING_EVENT | Notification.FLAG_FOREGROUND_SERVICE, - true, - info.userid, REASON_LISTENER_CANCEL, info); + synchronized (mNotificationList) { + NotificationListenerInfo info = checkListenerTokenLocked(token); + cancelNotification(callingUid, callingPid, pkg, tag, id, 0, + Notification.FLAG_ONGOING_EVENT | Notification.FLAG_FOREGROUND_SERVICE, + true, + info.userid, REASON_LISTENER_CANCEL, info); + } } finally { Binder.restoreCallingIdentity(identity); } @@ -1599,11 +1605,9 @@ public class NotificationManagerService extends SystemService { @Override public StatusBarNotification[] getActiveNotificationsFromListener( INotificationListener token) { - NotificationListenerInfo info = checkListenerToken(token); - - StatusBarNotification[] result = new StatusBarNotification[0]; - ArrayList<StatusBarNotification> list = new ArrayList<StatusBarNotification>(); synchronized (mNotificationList) { + NotificationListenerInfo info = checkListenerTokenLocked(token); + ArrayList<StatusBarNotification> list = new ArrayList<StatusBarNotification>(); final int N = mNotificationList.size(); for (int i=0; i<N; i++) { StatusBarNotification sbn = mNotificationList.get(i).sbn; @@ -1611,8 +1615,8 @@ public class NotificationManagerService extends SystemService { list.add(sbn); } } + return list.toArray(new StatusBarNotification[list.size()]); } - return list.toArray(result); } @Override @@ -2446,29 +2450,26 @@ public class NotificationManagerService extends SystemService { } } - void cancelAll(int callingUid, int callingPid, int userId, int reason, + void cancelAllLocked(int callingUid, int callingPid, int userId, int reason, NotificationListenerInfo listener) { EventLogTags.writeNotificationCancelAll(callingUid, callingPid, null, userId, 0, 0, reason, listener == null ? null : listener.component.toShortString()); - synchronized (mNotificationList) { - final int N = mNotificationList.size(); - for (int i=N-1; i>=0; i--) { - NotificationRecord r = mNotificationList.get(i); + final int N = mNotificationList.size(); + for (int i=N-1; i>=0; i--) { + NotificationRecord r = mNotificationList.get(i); - if (!notificationMatchesUserIdOrRelated(r, userId)) { - continue; - } - - if ((r.getFlags() & (Notification.FLAG_ONGOING_EVENT - | Notification.FLAG_NO_CLEAR)) == 0) { - mNotificationList.remove(i); - cancelNotificationLocked(r, true); - } + if (!notificationMatchesUserIdOrRelated(r, userId)) { + continue; } - updateLightsLocked(); + if ((r.getFlags() & (Notification.FLAG_ONGOING_EVENT + | Notification.FLAG_NO_CLEAR)) == 0) { + mNotificationList.remove(i); + cancelNotificationLocked(r, true); + } } + updateLightsLocked(); } // lock on mNotificationList |