diff options
| author | 2020-02-20 18:51:46 -0500 | |
|---|---|---|
| committer | 2020-03-16 16:48:27 -0400 | |
| commit | 168a8165acdc0c57767e60652a4d71d45fd2aa23 (patch) | |
| tree | a3a63dabd0a1379f00ad021e6fc7f3865dae0ff3 | |
| parent | 4723328ceece47d182a25dd0752154a6c4054c2d (diff) | |
Ignore missing rankings in GroupCoalescer
Companion change to one we made in NotifCollection.
Due to a race condition outside of our control, we have to disable this
check and just accept that rankings may sometimes be malformed.
Test: atest
Fixes: 149912196
Change-Id: Iff53944553d0da22df915b55709b9feef5c8d1a4
2 files changed, 15 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coalescer/GroupCoalescer.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coalescer/GroupCoalescer.java index 98c45ffd6afb..596235cfb4d0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coalescer/GroupCoalescer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coalescer/GroupCoalescer.java @@ -260,11 +260,14 @@ public class GroupCoalescer implements Dumpable { private void applyRanking(RankingMap rankingMap) { for (CoalescedEvent event : mCoalescedEvents.values()) { Ranking ranking = new Ranking(); - if (!rankingMap.getRanking(event.getKey(), ranking)) { - throw new IllegalStateException( - "Ranking map doesn't contain key: " + event.getKey()); + if (rankingMap.getRanking(event.getKey(), ranking)) { + event.setRanking(ranking); + } else { + // TODO: (b/148791039) We should crash if we are ever handed a ranking with + // incomplete entries. Right now, there's a race condition in NotificationListener + // that means this might occur when SystemUI is starting up. + mLogger.logMissingRanking(event.getKey()); } - event.setRanking(ranking); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coalescer/GroupCoalescerLogger.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coalescer/GroupCoalescerLogger.kt index 6e8788db59d7..d4d5b64240c2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coalescer/GroupCoalescerLogger.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coalescer/GroupCoalescerLogger.kt @@ -57,6 +57,14 @@ class GroupCoalescerLogger @Inject constructor( "Modification of notif $str1 triggered TIMEOUT emit of batched group $str2" }) } + + fun logMissingRanking(forKey: String) { + buffer.log(TAG, LogLevel.WARNING, { + str1 = forKey + }, { + "RankingMap is missing an entry for coalesced notification $str1" + }) + } } private const val TAG = "GroupCoalescer"
\ No newline at end of file |