Merge "Ignore nonsensical clears from NoMan" into rvc-dev

This commit is contained in:
TreeHugger Robot
2020-06-29 17:00:53 +00:00
committed by Android (Google) Code Review
3 changed files with 14 additions and 6 deletions

View File

@@ -382,9 +382,8 @@ public class NotifCollection implements Dumpable {
final NotificationEntry entry = mNotificationSet.get(sbn.getKey());
if (entry == null) {
crashIfNotInitializing(
new IllegalStateException("No notification to remove with key "
+ sbn.getKey()));
// TODO (b/160008901): Throw an exception here
mLogger.logNoNotificationToRemoveWithKey(sbn.getKey());
return;
}

View File

@@ -121,6 +121,14 @@ class NotifCollectionLogger @Inject constructor(
})
}
fun logNoNotificationToRemoveWithKey(key: String) {
buffer.log(TAG, ERROR, {
str1 = key
}, {
"No notification to remove with key $str1"
})
}
fun logRankingMissing(key: String, rankingMap: RankingMap) {
buffer.log(TAG, WARNING, { str1 = key }, { "Ranking update is missing ranking for $str1" })
buffer.log(TAG, DEBUG, {}, { "Ranking map contents:" })

View File

@@ -1273,8 +1273,8 @@ public class NotifCollectionTest extends SysuiTestCase {
verify(mInterceptor3, never()).shouldInterceptDismissal(clearable);
}
@Test(expected = IllegalStateException.class)
public void testClearNotificationThrowsIfMissing() {
@Test
public void testClearNotificationDoesntThrowIfMissing() {
// GIVEN that enough time has passed that we're beyond the forgiveness window
mClock.advanceTime(5001);
@@ -1287,7 +1287,8 @@ public class NotifCollectionTest extends SysuiTestCase {
container.getSbn(),
new RankingMap(new Ranking[]{ container.getRanking() }));
// THEN an exception is thrown
// THEN the event is ignored
verify(mCollectionListener, never()).onEntryRemoved(any(NotificationEntry.class), anyInt());
}
@Test