diff options
| author | 2014-06-16 16:28:30 +0000 | |
|---|---|---|
| committer | 2014-06-16 16:28:30 +0000 | |
| commit | 26b6db36a3543072d358ae58486b09792318828c (patch) | |
| tree | c63601e845c3185c0786a05c8acecfce1a0745d4 | |
| parent | 7b1fda8c98b17dcb49a16c43d801a8042503f2fc (diff) | |
| parent | c5115556707d24dfbe6cbef8f3e9476b6c5e3021 (diff) | |
am afaf0c54: Prevent duplicate notifications
* commit 'afaf0c54731e126affcd3319a1d9a4f0da63411e':
Prevent duplicate notifications
| -rw-r--r-- | services/core/java/com/android/server/notification/NotificationManagerService.java | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 06732caef530..825dc84dd876 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -2268,16 +2268,15 @@ public class NotificationManagerService extends SystemService { // lock on mNotificationList int indexOfNotificationLocked(String key) { - NotificationRecord r = mNotificationsByKey.get(key); - if (r == null) { - return -1; + final int N = mNotificationList.size(); + for (int i = 0; i < N; i++) { + if (key.equals(mNotificationList.get(i).getKey())) { + return i; + } } - int index = Collections.binarySearch(mNotificationList, r, mRankingComparator); - // Guarantee to return -1 when not found. - return (index >= 0) ? index : -1; + return -1; } - private void updateNotificationPulse() { synchronized (mNotificationList) { updateLightsLocked(); |