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

Commit 106985e5 authored by Michael Mikhail's avatar Michael Mikhail Committed by Android (Google) Code Review
Browse files

Merge "Fix media visibility on lockscreen" into main

parents 7f95cfa2 e62378bf
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) {