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

Commit f067faec authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Disallow reordering on lock screen" into main

parents e85d1ed4 4f410c36
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -321,7 +321,7 @@ constructor(
        }

    private val isReorderingAllowed: Boolean
        get() = visualStabilityProvider.isReorderingAllowed
        get() = visualStabilityProvider.isReorderingAllowed && !isOnLockscreen()

    /** Size provided by the scene framework container */
    private var widthInSceneContainerPx = 0
@@ -731,14 +731,15 @@ constructor(

    /** Return true if the carousel should be hidden because device is locked. */
    fun isLockedAndHidden(): Boolean {
        val isOnLockscreen =
        return !allowMediaPlayerOnLockScreen && isOnLockscreen()
    }

    private fun isOnLockscreen() =
        if (SceneContainerFlag.isEnabled) {
            !deviceEntryInteractor.isDeviceEntered.value
        } else {
            !isOnGone.value || isGoingToDozing.value
        }
        return !allowMediaPlayerOnLockScreen && isOnLockscreen
    }

    private fun reorderAllPlayers(
        previousVisiblePlayerKey: MediaPlayerData.MediaSortKey?,
+29 −19
Original line number Diff line number Diff line
@@ -879,11 +879,21 @@ class MediaCarouselControllerTest : SysuiTestCase() {

    @DisableSceneContainer
    @Test
    fun swipeToDismiss_pausedAndResumeOff_userInitiated() {
    fun swipeToDismiss_pausedAndResumeOff_userInitiated() =
        kosmos.testScope.runTest {
            verify(mediaDataManager).addListener(capture(listener))
            transitionRepository.sendTransitionSteps(
                from = KeyguardState.LOCKSCREEN,
                to = KeyguardState.GONE,
                this,
            )

            // When resumption is disabled, paused media should be dismissed after being swiped away
        Settings.Secure.putInt(context.contentResolver, Settings.Secure.MEDIA_CONTROLS_RESUME, 0)
            Settings.Secure.putInt(
                context.contentResolver,
                Settings.Secure.MEDIA_CONTROLS_RESUME,
                0,
            )
            val pausedMedia = DATA.copy(isPlaying = false)
            listener.value.onMediaDataLoaded(PAUSED_LOCAL, PAUSED_LOCAL, pausedMedia)
            runAllReady()