commit | 83f1718952dc2567fd8d7e561eae97ae1e870024 | [log] [tgz] |
---|---|---|
author | Caitlin Cassidy <ccassidy@google.com> | Fri Sep 24 20:46:26 2021 +0000 |
committer | Caitlin Cassidy <ccassidy@google.com> | Mon Sep 27 19:40:13 2021 +0000 |
tree | 2e7a3306e7794986177acacdf867c12412cc9189 | |
parent | 3a8df63e40a9d45e098d644d9f08b7047ce3accd [diff] |
[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 (cherry picked from commit cd755525c4f172862d27466f06f5d4230b57ade5) Merged-In: I0f681ccfe55597490bee0d4b190f9fb2c38e28f2
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt index 6982631..80a0a98 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt
@@ -104,7 +104,16 @@ } } + // 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() }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerTest.kt index d26db4c..b7c4d0a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerTest.kt
@@ -221,6 +221,18 @@ 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() {