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

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

Merge "Revert "Allow UMO to show over the dream"" into main

parents 15e35cfd 7669ab8e
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -586,7 +586,7 @@ constructor(
        coroutineScope.launch {
            communalInteractor.isCommunalShowing.collect { value ->
                isCommunalShowing = value
                updateDesiredLocation()
                updateDesiredLocation(forceNoAnimation = true)
            }
        }
    }
@@ -1149,17 +1149,13 @@ constructor(
            when {
                mediaFlags.isSceneContainerEnabled() -> desiredLocation
                dreamOverlayActive && dreamMediaComplicationActive -> LOCATION_DREAM_OVERLAY

                // UMO should show in communal unless the shade is expanding or visible.
                isCommunalShowing && qsExpansion == 0.0f -> LOCATION_COMMUNAL_HUB
                (qsExpansion > 0.0f || inSplitShade) && !onLockscreen -> LOCATION_QS
                qsExpansion > 0.4f && onLockscreen -> LOCATION_QS
                onLockscreen && isSplitShadeExpanding() -> LOCATION_QS
                onLockscreen && isTransformingToFullShadeAndInQQS() -> LOCATION_QQS

                // Communal does not have its own StatusBarState so it should always have higher
                // priority for the UMO over the lockscreen.
                isCommunalShowing -> LOCATION_COMMUNAL_HUB
                // TODO(b/311234666): revisit logic once interactions between the hub and
                //  shade/keyguard state are finalized
                isCommunalShowing && communalInteractor.isCommunalEnabled -> LOCATION_COMMUNAL_HUB
                onLockscreen && allowMediaPlayerOnLockScreen -> LOCATION_LOCKSCREEN
                else -> LOCATION_QQS
            }
+0 −52
Original line number Diff line number Diff line
@@ -529,58 +529,6 @@ class MediaHierarchyManagerTest : SysuiTestCase() {
                )
        }

    @Test
    fun testCommunalLocation_showsOverLockscreen() =
        testScope.runTest {
            // Device is on lock screen.
            whenever(statusBarStateController.state).thenReturn(StatusBarState.KEYGUARD)

            // UMO goes to communal even over the lock screen.
            communalInteractor.onSceneChanged(CommunalSceneKey.Communal)
            runCurrent()
            verify(mediaCarouselController)
                .onDesiredLocationChanged(
                    eq(MediaHierarchyManager.LOCATION_COMMUNAL_HUB),
                    nullable(),
                    eq(false),
                    anyLong(),
                    anyLong()
                )
        }

    @Test
    fun testCommunalLocation_showsUntilQsExpands() =
        testScope.runTest {
            // Device is on lock screen.
            whenever(statusBarStateController.state).thenReturn(StatusBarState.KEYGUARD)

            communalInteractor.onSceneChanged(CommunalSceneKey.Communal)
            runCurrent()
            verify(mediaCarouselController)
                .onDesiredLocationChanged(
                    eq(MediaHierarchyManager.LOCATION_COMMUNAL_HUB),
                    nullable(),
                    eq(false),
                    anyLong(),
                    anyLong()
                )
            clearInvocations(mediaCarouselController)

            // Start opening the shade.
            mediaHierarchyManager.qsExpansion = 0.1f
            runCurrent()

            // UMO goes to the shade instead.
            verify(mediaCarouselController)
                .onDesiredLocationChanged(
                    eq(MediaHierarchyManager.LOCATION_QS),
                    any(MediaHostState::class.java),
                    eq(false),
                    anyLong(),
                    anyLong()
                )
        }

    @Test
    fun testQsExpandedChanged_noQqsMedia() {
        // When we are looking at QQS with active media