Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinator.kt +1 −1 Original line number Diff line number Diff line Loading @@ -393,7 +393,7 @@ class HeadsUpCoordinator @Inject constructor( val posted = mPostedEntries.compute(entry.key) { _, value -> value?.also { update -> update.wasUpdated = true update.shouldHeadsUpEver = update.shouldHeadsUpEver || shouldHeadsUpEver update.shouldHeadsUpEver = shouldHeadsUpEver update.shouldHeadsUpAgain = update.shouldHeadsUpAgain || shouldHeadsUpAgain update.isAlerting = isAlerting update.isBinding = isBinding Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinatorTest.kt +34 −0 Original line number Diff line number Diff line Loading @@ -336,6 +336,40 @@ class HeadsUpCoordinatorTest : SysuiTestCase() { verify(mHeadsUpManager, never()).showNotification(mEntry) } @Test fun testOnEntryUpdated_toAlert() { // GIVEN that an entry is posted that should not heads up setShouldHeadsUp(mEntry, false) mCollectionListener.onEntryAdded(mEntry) // WHEN it's updated to heads up setShouldHeadsUp(mEntry) mCollectionListener.onEntryUpdated(mEntry) mBeforeTransformGroupsListener.onBeforeTransformGroups(listOf(mEntry)) mBeforeFinalizeFilterListener.onBeforeFinalizeFilter(listOf(mEntry)) // THEN the notification alerts finishBind(mEntry) verify(mHeadsUpManager).showNotification(mEntry) } @Test fun testOnEntryUpdated_toNotAlert() { // GIVEN that an entry is posted that should heads up setShouldHeadsUp(mEntry) mCollectionListener.onEntryAdded(mEntry) // WHEN it's updated to not heads up setShouldHeadsUp(mEntry, false) mCollectionListener.onEntryUpdated(mEntry) mBeforeTransformGroupsListener.onBeforeTransformGroups(listOf(mEntry)) mBeforeFinalizeFilterListener.onBeforeFinalizeFilter(listOf(mEntry)) // THEN the notification is never bound or shown verify(mHeadsUpViewBinder, never()).bindHeadsUpView(any(), any()) verify(mHeadsUpManager, never()).showNotification(any()) } @Test fun testOnEntryRemovedRemovesHeadsUpNotification() { // GIVEN the current HUN is mEntry Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinator.kt +1 −1 Original line number Diff line number Diff line Loading @@ -393,7 +393,7 @@ class HeadsUpCoordinator @Inject constructor( val posted = mPostedEntries.compute(entry.key) { _, value -> value?.also { update -> update.wasUpdated = true update.shouldHeadsUpEver = update.shouldHeadsUpEver || shouldHeadsUpEver update.shouldHeadsUpEver = shouldHeadsUpEver update.shouldHeadsUpAgain = update.shouldHeadsUpAgain || shouldHeadsUpAgain update.isAlerting = isAlerting update.isBinding = isBinding Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinatorTest.kt +34 −0 Original line number Diff line number Diff line Loading @@ -336,6 +336,40 @@ class HeadsUpCoordinatorTest : SysuiTestCase() { verify(mHeadsUpManager, never()).showNotification(mEntry) } @Test fun testOnEntryUpdated_toAlert() { // GIVEN that an entry is posted that should not heads up setShouldHeadsUp(mEntry, false) mCollectionListener.onEntryAdded(mEntry) // WHEN it's updated to heads up setShouldHeadsUp(mEntry) mCollectionListener.onEntryUpdated(mEntry) mBeforeTransformGroupsListener.onBeforeTransformGroups(listOf(mEntry)) mBeforeFinalizeFilterListener.onBeforeFinalizeFilter(listOf(mEntry)) // THEN the notification alerts finishBind(mEntry) verify(mHeadsUpManager).showNotification(mEntry) } @Test fun testOnEntryUpdated_toNotAlert() { // GIVEN that an entry is posted that should heads up setShouldHeadsUp(mEntry) mCollectionListener.onEntryAdded(mEntry) // WHEN it's updated to not heads up setShouldHeadsUp(mEntry, false) mCollectionListener.onEntryUpdated(mEntry) mBeforeTransformGroupsListener.onBeforeTransformGroups(listOf(mEntry)) mBeforeFinalizeFilterListener.onBeforeFinalizeFilter(listOf(mEntry)) // THEN the notification is never bound or shown verify(mHeadsUpViewBinder, never()).bindHeadsUpView(any(), any()) verify(mHeadsUpManager, never()).showNotification(any()) } @Test fun testOnEntryRemovedRemovesHeadsUpNotification() { // GIVEN the current HUN is mEntry Loading