[Ongoing Call] Remove the call chip when #onEntryCleanUp is called.
See bug comment #9 for an in-depth explanation. Test: New unit tests. Test: I created a test app that sends an ongoing call notification then removes it 200ms later, and I confirmed that the bug is triggered without this CL, and is fixed with this CL. Bug: 199600334 Change-Id: I0f681ccfe55597490bee0d4b190f9fb2c38e28f2
This commit is contained in:
@@ -103,7 +103,16 @@ class OngoingCallController @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
// Fix for b/199600334
|
||||
override fun onEntryCleanUp(entry: NotificationEntry) {
|
||||
removeChipIfNeeded(entry)
|
||||
}
|
||||
|
||||
override fun onEntryRemoved(entry: NotificationEntry, reason: Int) {
|
||||
removeChipIfNeeded(entry)
|
||||
}
|
||||
|
||||
private fun removeChipIfNeeded(entry: NotificationEntry) {
|
||||
if (entry.sbn.key == callNotificationInfo?.key) {
|
||||
removeChip()
|
||||
}
|
||||
|
||||
@@ -221,6 +221,18 @@ class OngoingCallControllerTest : SysuiTestCase() {
|
||||
verify(mockOngoingCallListener).onOngoingCallStateChanged(anyBoolean())
|
||||
}
|
||||
|
||||
/** Regression test for b/201097913. */
|
||||
@Test
|
||||
fun onEntryCleanUp_callNotifAddedThenRemoved_listenerNotified() {
|
||||
val ongoingCallNotifEntry = createOngoingCallNotifEntry()
|
||||
notifCollectionListener.onEntryAdded(ongoingCallNotifEntry)
|
||||
reset(mockOngoingCallListener)
|
||||
|
||||
notifCollectionListener.onEntryCleanUp(ongoingCallNotifEntry)
|
||||
|
||||
verify(mockOngoingCallListener).onOngoingCallStateChanged(anyBoolean())
|
||||
}
|
||||
|
||||
/** Regression test for b/188491504. */
|
||||
@Test
|
||||
fun onEntryRemoved_removedNotifHasSameKeyAsAddedNotif_listenerNotified() {
|
||||
|
||||
Reference in New Issue
Block a user