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

Commit 27939fa0 authored by Ibrahim Yilmaz's avatar Ibrahim Yilmaz Committed by Android (Google) Code Review
Browse files

Merge changes I7d75fe57,I6c5c869e into main

* changes:
  KeyguardMediaController: Invalidate NSSL only for MediaContainerView
  KeyguardMediaController: Log Active Container on refreshMedia
parents 77c6fd2c 6d1324c7
Loading
Loading
Loading
Loading
+18 −10
Original line number Diff line number Diff line
@@ -230,18 +230,12 @@ constructor(
        val currentAllowMediaPlayerOnLockScreen = allowMediaPlayerOnLockScreen
        val useSplitShade = useSplitShade
        val shouldBeVisibleForSplitShade = shouldBeVisibleForSplitShade()

        visible =
            isMediaHostVisible &&
                isBypassNotEnabled &&
                keyguardOrUserSwitcher &&
                currentAllowMediaPlayerOnLockScreen &&
                shouldBeVisibleForSplitShade
        if (visible) {
            showMediaPlayer()
        } else {
            hideMediaPlayer()
        }
        logger.logRefreshMediaPosition(
            reason = reason,
            visible = visible,
@@ -251,8 +245,17 @@ constructor(
            mediaHostVisible = isMediaHostVisible,
            bypassNotEnabled = isBypassNotEnabled,
            currentAllowMediaPlayerOnLockScreen = currentAllowMediaPlayerOnLockScreen,
            shouldBeVisibleForSplitShade = shouldBeVisibleForSplitShade
            shouldBeVisibleForSplitShade = shouldBeVisibleForSplitShade,
        )
        val currActiveContainer = activeContainer

        logger.logActiveMediaContainer("before refreshMediaPosition", currActiveContainer)
        if (visible) {
            showMediaPlayer()
        } else {
            hideMediaPlayer()
        }
        logger.logActiveMediaContainer("after refreshMediaPosition", currActiveContainer)

        lastUsedStatusBarState = currentState
    }
@@ -293,9 +296,11 @@ constructor(
    }

    private fun setVisibility(view: ViewGroup?, newVisibility: Int) {
        val previousVisibility = view?.visibility
        view?.visibility = newVisibility
        if (previousVisibility != newVisibility) {
        val currentMediaContainer = view ?: return

        val previousVisibility = currentMediaContainer.visibility
        currentMediaContainer.visibility = newVisibility
        if (previousVisibility != newVisibility && currentMediaContainer is MediaContainerView) {
            visibilityChangedListener?.invoke(newVisibility == View.VISIBLE)
        }
    }
@@ -325,4 +330,7 @@ constructor(
            }
        }
    }

    private val activeContainer: ViewGroup? =
        if (useSplitShade) splitShadeContainer else singlePaneContainer
}
+16 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.media.controls.ui

import android.view.ViewGroup
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.core.LogLevel.DEBUG
import com.android.systemui.log.dagger.KeyguardMediaControllerLog
@@ -36,8 +37,8 @@ constructor(@KeyguardMediaControllerLog private val logBuffer: LogBuffer) {
        mediaHostVisible: Boolean,
        bypassNotEnabled: Boolean,
        currentAllowMediaPlayerOnLockScreen: Boolean,
        shouldBeVisibleForSplitShade: Boolean
    ) =
        shouldBeVisibleForSplitShade: Boolean,
    ) {
        logBuffer.log(
            TAG,
            DEBUG,
@@ -63,6 +64,19 @@ constructor(@KeyguardMediaControllerLog private val logBuffer: LogBuffer) {
                    "shouldBeVisibleForSplitShade=$str3)"
            }
        )
    }

    fun logActiveMediaContainer(reason: String, activeContainer: ViewGroup?) {
        logBuffer.log(
            TAG,
            DEBUG,
            {
                str1 = reason
                str2 = activeContainer.toString()
            },
            { "activeMediaContainerVisibility(reason=$str1, activeContainer=$str2)" }
        )
    }

    private companion object {
        private const val TAG = "KeyguardMediaControllerLog"