summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xservices/core/java/com/android/server/notification/NotificationManagerService.java20
1 files changed, 13 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 3a7ac0bd659d..02265aca79de 100755
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -2408,7 +2408,7 @@ public class NotificationManagerService extends SystemService {
@VisibleForTesting
void clearNotifications() {
- synchronized (mNotificationList) {
+ synchronized (mNotificationLock) {
mEnqueuedNotifications.clear();
mNotificationList.clear();
mNotificationsByKey.clear();
@@ -2418,21 +2418,27 @@ public class NotificationManagerService extends SystemService {
@VisibleForTesting
void addNotification(NotificationRecord r) {
- mNotificationList.add(r);
- mNotificationsByKey.put(r.getSbn().getKey(), r);
- if (r.getSbn().isGroup()) {
- mSummaryByGroupKey.put(r.getGroupKey(), r);
+ synchronized (mNotificationLock) {
+ mNotificationList.add(r);
+ mNotificationsByKey.put(r.getSbn().getKey(), r);
+ if (r.getSbn().isGroup()) {
+ mSummaryByGroupKey.put(r.getGroupKey(), r);
+ }
}
}
@VisibleForTesting
void addEnqueuedNotification(NotificationRecord r) {
- mEnqueuedNotifications.add(r);
+ synchronized (mNotificationLock) {
+ mEnqueuedNotifications.add(r);
+ }
}
@VisibleForTesting
NotificationRecord getNotificationRecord(String key) {
- return mNotificationsByKey.get(key);
+ synchronized (mNotificationLock) {
+ return mNotificationsByKey.get(key);
+ }
}