Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotifCollection.java +2 −3 Original line number Original line Diff line number Diff line Loading @@ -382,9 +382,8 @@ public class NotifCollection implements Dumpable { final NotificationEntry entry = mNotificationSet.get(sbn.getKey()); final NotificationEntry entry = mNotificationSet.get(sbn.getKey()); if (entry == null) { if (entry == null) { crashIfNotInitializing( // TODO (b/160008901): Throw an exception here new IllegalStateException("No notification to remove with key " mLogger.logNoNotificationToRemoveWithKey(sbn.getKey()); + sbn.getKey())); return; return; } } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionLogger.kt +8 −0 Original line number Original line Diff line number Diff line Loading @@ -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) { fun logRankingMissing(key: String, rankingMap: RankingMap) { buffer.log(TAG, WARNING, { str1 = key }, { "Ranking update is missing ranking for $str1" }) buffer.log(TAG, WARNING, { str1 = key }, { "Ranking update is missing ranking for $str1" }) buffer.log(TAG, DEBUG, {}, { "Ranking map contents:" }) buffer.log(TAG, DEBUG, {}, { "Ranking map contents:" }) Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifCollectionTest.java +4 −3 Original line number Original line Diff line number Diff line Loading @@ -1273,8 +1273,8 @@ public class NotifCollectionTest extends SysuiTestCase { verify(mInterceptor3, never()).shouldInterceptDismissal(clearable); verify(mInterceptor3, never()).shouldInterceptDismissal(clearable); } } @Test(expected = IllegalStateException.class) @Test public void testClearNotificationThrowsIfMissing() { public void testClearNotificationDoesntThrowIfMissing() { // GIVEN that enough time has passed that we're beyond the forgiveness window // GIVEN that enough time has passed that we're beyond the forgiveness window mClock.advanceTime(5001); mClock.advanceTime(5001); Loading @@ -1287,7 +1287,8 @@ public class NotifCollectionTest extends SysuiTestCase { container.getSbn(), container.getSbn(), new RankingMap(new Ranking[]{ container.getRanking() })); 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 @Test Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotifCollection.java +2 −3 Original line number Original line Diff line number Diff line Loading @@ -382,9 +382,8 @@ public class NotifCollection implements Dumpable { final NotificationEntry entry = mNotificationSet.get(sbn.getKey()); final NotificationEntry entry = mNotificationSet.get(sbn.getKey()); if (entry == null) { if (entry == null) { crashIfNotInitializing( // TODO (b/160008901): Throw an exception here new IllegalStateException("No notification to remove with key " mLogger.logNoNotificationToRemoveWithKey(sbn.getKey()); + sbn.getKey())); return; return; } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionLogger.kt +8 −0 Original line number Original line Diff line number Diff line Loading @@ -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) { fun logRankingMissing(key: String, rankingMap: RankingMap) { buffer.log(TAG, WARNING, { str1 = key }, { "Ranking update is missing ranking for $str1" }) buffer.log(TAG, WARNING, { str1 = key }, { "Ranking update is missing ranking for $str1" }) buffer.log(TAG, DEBUG, {}, { "Ranking map contents:" }) buffer.log(TAG, DEBUG, {}, { "Ranking map contents:" }) Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifCollectionTest.java +4 −3 Original line number Original line Diff line number Diff line Loading @@ -1273,8 +1273,8 @@ public class NotifCollectionTest extends SysuiTestCase { verify(mInterceptor3, never()).shouldInterceptDismissal(clearable); verify(mInterceptor3, never()).shouldInterceptDismissal(clearable); } } @Test(expected = IllegalStateException.class) @Test public void testClearNotificationThrowsIfMissing() { public void testClearNotificationDoesntThrowIfMissing() { // GIVEN that enough time has passed that we're beyond the forgiveness window // GIVEN that enough time has passed that we're beyond the forgiveness window mClock.advanceTime(5001); mClock.advanceTime(5001); Loading @@ -1287,7 +1287,8 @@ public class NotifCollectionTest extends SysuiTestCase { container.getSbn(), container.getSbn(), new RankingMap(new Ranking[]{ container.getRanking() })); 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 @Test Loading