Lock all the things
Fix some instances of .*Locked() methods being called without
holding mNotificationLock.
Also, if this happens again, don't crash system server
Change-Id: I0a51310a6f6c8b07266092176e189e7cd08778cc
Fixes: 37444864
Test: runtest systemui-notification
diff --git a/services/core/java/com/android/server/notification/GlobalSortKeyComparator.java b/services/core/java/com/android/server/notification/GlobalSortKeyComparator.java
index ce976d2..acedafc 100644
--- a/services/core/java/com/android/server/notification/GlobalSortKeyComparator.java
+++ b/services/core/java/com/android/server/notification/GlobalSortKeyComparator.java
@@ -15,19 +15,25 @@
*/
package com.android.server.notification;
+import android.util.Slog;
+
import java.util.Comparator;
/**
* Sorts notifications by their global sort key.
*/
public class GlobalSortKeyComparator implements Comparator<NotificationRecord> {
+ private final static String TAG = "GlobalSortComp";
+
@Override
public int compare(NotificationRecord left, NotificationRecord right) {
if (left.getGlobalSortKey() == null) {
- throw new IllegalStateException("Missing left global sort key: " + left);
+ Slog.wtf(TAG, "Missing left global sort key: " + left);
+ return 1;
}
if (right.getGlobalSortKey() == null) {
- throw new IllegalStateException("Missing right global sort key: " + right);
+ Slog.wtf(TAG, "Missing right global sort key: " + right);
+ return -1;
}
return left.getGlobalSortKey().compareTo(right.getGlobalSortKey());
}