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

Commit 4f410c36 authored by Justin Weir's avatar Justin Weir
Browse files

Disallow reordering on lock screen

Fixes: 404532173
Test: manual
Flag: EXEMPT bug fix
Change-Id: I55629d6c19981b6325451646ec507eda2d0afd22
parent b1880670
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()