Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 42df1ac1 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "[Ongoing Call] Remove the call chip when #onEntryCleanUp is called."...

Merge "[Ongoing Call] Remove the call chip when #onEntryCleanUp is called." into sc-v2-dev am: 8649b294

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15909288

Change-Id: I1a449b497ebe6c2d38aa6d029e63ff564a79a454
parents cb0d8920 8649b294
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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()
            }
+12 −0
Original line number Diff line number Diff line
@@ -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() {