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

Commit e62378bf authored by Michael Mikhail's avatar Michael Mikhail
Browse files

Fix media visibility on lockscreen

Flag: EXEMPT BUGFIX
Fixes: 345995072
Test: atest KeyguardMediaControllerTest
Change-Id: I9f5b5cd2e2eebd0ef915149eddad483e9a97fde0
parent cd66423b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -126,6 +126,8 @@ class KeyguardMediaControllerTest : SysuiTestCase() {
            kosmos.setHasMedia(visible = true, active = true)
        } else {
            verify(mediaHost).expansion = MediaHostState.EXPANDED
            verify(mediaHost)
                .addVisibilityChangeListener(keyguardMediaController::onMediaHostVisibilityChanged)
        }
    }

+4 −2
Original line number Diff line number Diff line
@@ -200,12 +200,13 @@ constructor(
     * Attaches media container in single pane mode, situated at the top of the notifications list
     */
    fun attachSinglePaneContainer(mediaView: MediaContainerView?) {
        singlePaneContainer = mediaView
        if (MediaControlsInComposeFlag.isEnabled) {
            singlePaneContainer = mediaView
            reattachHostView()
            onMediaHostVisibilityChanged(isMediaVisibleOnLockscreen)
        } else {
            val needsListener = singlePaneContainer == null
            singlePaneContainer = mediaView
            if (needsListener) {
                // On reinflation we don't want to add another listener
                mediaHost.addVisibilityChangeListener(this::onMediaHostVisibilityChanged)
@@ -218,7 +219,8 @@ constructor(
    }

    /** Called whenever the media hosts visibility changes */
    private fun onMediaHostVisibilityChanged(visible: Boolean) {
    @VisibleForTesting
    fun onMediaHostVisibilityChanged(visible: Boolean) {
        refreshMediaPosition(reason = "onMediaHostVisibilityChanged")

        if (visible) {