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

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

Merge "[flexiglass] SUW visible again." into main

parents e31637b6 1b20f607
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -338,6 +338,22 @@ class WindowManagerLockscreenVisibilityInteractorTest : SysuiTestCase() {
            }
        }

    @Test
    @EnableSceneContainer
    fun surfaceBehindVisibility_whileSceneContainerNotVisible_alwaysTrue() =
        testScope.runTest {
            val isSurfaceBehindVisible by collectLastValue(underTest.value.surfaceBehindVisibility)
            val currentScene by collectLastValue(kosmos.sceneInteractor.currentScene)
            assertThat(currentScene).isEqualTo(Scenes.Lockscreen)
            assertThat(isSurfaceBehindVisible).isFalse()

            kosmos.sceneInteractor.setVisible(false, "test")
            runCurrent()

            assertThat(currentScene).isEqualTo(Scenes.Lockscreen)
            assertThat(isSurfaceBehindVisible).isTrue()
        }

    @Test
    @EnableSceneContainer
    fun surfaceBehindVisibility_idleWhileLocked_alwaysFalse() =
+41 −30
Original line number Diff line number Diff line
@@ -196,23 +196,30 @@ constructor(
                .distinctUntilChanged()
        }

    private val lockscreenVisibilityWithScenes =
    private val lockscreenVisibilityWithScenes: Flow<Boolean> =
        // The scene container visibility into account as that will be forced to false when the
        // device isn't yet provisioned (e.g. still in the setup wizard).
        sceneInteractor.get().isVisible.flatMapLatestConflated { isVisible ->
            if (isVisible) {
                combine(
                        sceneInteractor.get().transitionState.flatMapLatestConflated {
                            when (it) {
                        is Idle -> {
                                is Idle ->
                                    when (it.currentScene) {
                                        in keyguardContent -> flowOf(true)
                                        in nonKeyguardContent -> flowOf(false)
                                        in keyguardAgnosticContent -> isDeviceNotEnteredDirectly
                                        else ->
                                    throw IllegalStateException("Unknown scene: ${it.currentScene}")
                            }
                                            throw IllegalStateException(
                                                "Unknown scene: ${it.currentScene}"
                                            )
                                    }
                        is Transition -> {
                                is Transition ->
                                    when {
                                it.isTransitioningSets(from = keyguardContent) -> flowOf(true)
                                it.isTransitioningSets(from = nonKeyguardContent) -> flowOf(false)
                                        it.isTransitioningSets(from = keyguardContent) ->
                                            flowOf(true)
                                        it.isTransitioningSets(from = nonKeyguardContent) ->
                                            flowOf(false)
                                        it.isTransitioningSets(from = keyguardAgnosticContent) ->
                                            isDeviceNotEnteredDirectly
                                        else ->
@@ -221,7 +228,6 @@ constructor(
                                            )
                                    }
                            }
                    }
                        },
                        wakeToGoneInteractor.canWakeDirectlyToGone,
                        ::Pair,
@@ -229,6 +235,11 @@ constructor(
                    .map { (lockscreenVisibilityByTransitionState, canWakeDirectlyToGone) ->
                        lockscreenVisibilityByTransitionState && !canWakeDirectlyToGone
                    }
            } else {
                // Lockscreen is never visible when the scene container is invisible.
                flowOf(false)
            }
        }

    private val lockscreenVisibilityLegacy =
        combine(
+2 −1
Original line number Diff line number Diff line
@@ -195,7 +195,8 @@ constructor(
                    return
                }

                printSection("Scene state") {
                printSection("Framework state") {
                    println("isVisible", sceneInteractor.isVisible.value)
                    println("currentScene", sceneInteractor.currentScene.value.debugName)
                    println(
                        "currentOverlays",