Skip to content
Snippets Groups Projects
Commit d6df8749 authored by lijilou's avatar lijilou Committed by Jilou li
Browse files

NotificationManagerService: add right lock for some methods.

Test: atest
Bug: 343818003
Change-Id: Ia30d818d6ac19c2a3e9ae31b29122fb5bbac338a
parent e4016645
No related branches found
No related tags found
No related merge requests found
...@@ -2291,7 +2291,7 @@ public class NotificationManagerService extends SystemService { ...@@ -2291,7 +2291,7 @@ public class NotificationManagerService extends SystemService {
   
@VisibleForTesting @VisibleForTesting
void clearNotifications() { void clearNotifications() {
synchronized (mNotificationList) { synchronized (mNotificationLock) {
mEnqueuedNotifications.clear(); mEnqueuedNotifications.clear();
mNotificationList.clear(); mNotificationList.clear();
mNotificationsByKey.clear(); mNotificationsByKey.clear();
...@@ -2301,21 +2301,27 @@ public class NotificationManagerService extends SystemService { ...@@ -2301,21 +2301,27 @@ public class NotificationManagerService extends SystemService {
   
@VisibleForTesting @VisibleForTesting
void addNotification(NotificationRecord r) { void addNotification(NotificationRecord r) {
mNotificationList.add(r); synchronized (mNotificationLock) {
mNotificationsByKey.put(r.getSbn().getKey(), r); mNotificationList.add(r);
if (r.getSbn().isGroup()) { mNotificationsByKey.put(r.getSbn().getKey(), r);
mSummaryByGroupKey.put(r.getGroupKey(), r); if (r.getSbn().isGroup()) {
mSummaryByGroupKey.put(r.getGroupKey(), r);
}
} }
} }
   
@VisibleForTesting @VisibleForTesting
void addEnqueuedNotification(NotificationRecord r) { void addEnqueuedNotification(NotificationRecord r) {
mEnqueuedNotifications.add(r); synchronized (mNotificationLock) {
mEnqueuedNotifications.add(r);
}
} }
   
@VisibleForTesting @VisibleForTesting
NotificationRecord getNotificationRecord(String key) { NotificationRecord getNotificationRecord(String key) {
return mNotificationsByKey.get(key); synchronized (mNotificationLock) {
return mNotificationsByKey.get(key);
}
} }
   
   
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment