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

Commit fad62f2c authored by Lucas Silva's avatar Lucas Silva
Browse files

Cleanup communal ktf refactor flag

The flag launched in 24Q4. This change removes all usages of the flag to
simplify the code, deleting old code paths.

Bug: 394915563
Test: atest SystemUiRoboTests
Flag: EXEMPT cleanup
Change-Id: I8ac4435a44e98656d8a7eefa40bd56eb01cb421a
parent b04e0f11
Loading
Loading
Loading
Loading
+0 −302
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.provider.Settings
import androidx.test.filters.SmallTest
import com.android.internal.logging.uiEventLoggerFake
import com.android.systemui.Flags.FLAG_COMMUNAL_HUB
import com.android.systemui.Flags.FLAG_COMMUNAL_SCENE_KTF_REFACTOR
import com.android.systemui.Flags.FLAG_SCENE_CONTAINER
import com.android.systemui.SysuiTestCase
import com.android.systemui.communal.domain.interactor.communalInteractor
@@ -33,26 +32,21 @@ import com.android.systemui.communal.domain.interactor.communalSettingsInteracto
import com.android.systemui.communal.domain.interactor.setCommunalAvailable
import com.android.systemui.communal.shared.log.CommunalUiEvent
import com.android.systemui.communal.shared.model.CommunalScenes
import com.android.systemui.communal.shared.model.EditModeState
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.dock.dockManager
import com.android.systemui.dock.fakeDockManager
import com.android.systemui.flags.Flags.COMMUNAL_SERVICE_ENABLED
import com.android.systemui.flags.andSceneContainer
import com.android.systemui.flags.fakeFeatureFlagsClassic
import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
import com.android.systemui.keyguard.domain.interactor.keyguardInteractor
import com.android.systemui.keyguard.domain.interactor.keyguardTransitionInteractor
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.kosmos.applicationCoroutineScope
import com.android.systemui.kosmos.testDispatcher
import com.android.systemui.kosmos.testScope
import com.android.systemui.scene.domain.interactor.sceneInteractor
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.statusbar.notificationShadeWindowController
import com.android.systemui.statusbar.phone.centralSurfaces
import com.android.systemui.statusbar.phone.centralSurfacesOptional
import com.android.systemui.testKosmos
import com.android.systemui.util.settings.fakeSettings
@@ -64,10 +58,8 @@ import kotlinx.coroutines.test.advanceTimeBy
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.whenever
import platform.test.runner.parameterized.ParameterizedAndroidJunit4
import platform.test.runner.parameterized.Parameters

@@ -131,272 +123,6 @@ class CommunalSceneStartableTest(flags: FlagsParameterization) : SysuiTestCase()
        }
    }

    @Test
    @DisableFlags(FLAG_COMMUNAL_SCENE_KTF_REFACTOR, FLAG_SCENE_CONTAINER)
    fun keyguardGoesAway_whenLaunchingEditMode_doNotForceBlankScene() =
        with(kosmos) {
            testScope.runTest {
                val scene by collectLastValue(communalSceneInteractor.currentScene)

                communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")
                assertThat(scene).isEqualTo(CommunalScenes.Communal)

                communalSceneInteractor.setEditModeState(EditModeState.STARTING)
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.PRIMARY_BOUNCER,
                    to = KeyguardState.GONE,
                    testScope = this,
                )

                assertThat(scene).isEqualTo(CommunalScenes.Communal)
            }
        }

    @Test
    @DisableFlags(FLAG_COMMUNAL_SCENE_KTF_REFACTOR, FLAG_SCENE_CONTAINER)
    fun keyguardGoesAway_whenLaunchingWidget_doNotForceBlankScene() =
        with(kosmos) {
            testScope.runTest {
                val scene by collectLastValue(communalSceneInteractor.currentScene)

                communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")
                assertThat(scene).isEqualTo(CommunalScenes.Communal)

                communalSceneInteractor.setIsLaunchingWidget(true)
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.PRIMARY_BOUNCER,
                    to = KeyguardState.GONE,
                    testScope = this,
                )

                assertThat(scene).isEqualTo(CommunalScenes.Communal)
            }
        }

    @Test
    @DisableFlags(FLAG_COMMUNAL_SCENE_KTF_REFACTOR, FLAG_SCENE_CONTAINER)
    fun keyguardGoesAway_whenNotLaunchingWidget_forceBlankScene() =
        with(kosmos) {
            testScope.runTest {
                val scene by collectLastValue(communalSceneInteractor.currentScene)

                communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")
                assertThat(scene).isEqualTo(CommunalScenes.Communal)

                communalSceneInteractor.setIsLaunchingWidget(false)
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.PRIMARY_BOUNCER,
                    to = KeyguardState.GONE,
                    testScope = this,
                )

                assertThat(scene).isEqualTo(CommunalScenes.Blank)
            }
        }

    @Test
    @DisableFlags(FLAG_COMMUNAL_SCENE_KTF_REFACTOR, FLAG_SCENE_CONTAINER)
    fun keyguardGoesAway_whenInEditMode_doesNotChangeScene() =
        with(kosmos) {
            testScope.runTest {
                val scene by collectLastValue(communalSceneInteractor.currentScene)
                communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")
                assertThat(scene).isEqualTo(CommunalScenes.Communal)

                communalInteractor.setEditModeOpen(true)
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.ALTERNATE_BOUNCER,
                    to = KeyguardState.GONE,
                    testScope = this,
                )
                // Scene change will be handled in EditWidgetsActivity not here
                assertThat(scene).isEqualTo(CommunalScenes.Communal)
            }
        }

    @Ignore("Ignored until custom animations are implemented in b/322787129")
    @Test
    @DisableFlags(FLAG_SCENE_CONTAINER)
    fun deviceDocked_forceCommunalScene() =
        with(kosmos) {
            testScope.runTest {
                val scene by collectLastValue(communalSceneInteractor.currentScene)
                assertThat(scene).isEqualTo(CommunalScenes.Blank)

                updateDocked(true)
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.GONE,
                    to = KeyguardState.LOCKSCREEN,
                    testScope = this,
                )
                assertThat(scene).isEqualTo(CommunalScenes.Communal)
            }
        }

    @Test
    @DisableFlags(FLAG_COMMUNAL_SCENE_KTF_REFACTOR, FLAG_SCENE_CONTAINER)
    fun occluded_forceBlankScene() =
        with(kosmos) {
            testScope.runTest {
                whenever(centralSurfaces.isLaunchingActivityOverLockscreen).thenReturn(false)
                val scene by collectLastValue(communalSceneInteractor.currentScene)
                communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")
                assertThat(scene).isEqualTo(CommunalScenes.Communal)

                updateDocked(true)
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.GLANCEABLE_HUB,
                    to = KeyguardState.OCCLUDED,
                    testScope = this,
                )
                assertThat(scene).isEqualTo(CommunalScenes.Blank)
            }
        }

    @Test
    @DisableFlags(FLAG_COMMUNAL_SCENE_KTF_REFACTOR, FLAG_SCENE_CONTAINER)
    fun occluded_doesNotForceBlankSceneIfLaunchingActivityOverLockscreen() =
        with(kosmos) {
            testScope.runTest {
                whenever(centralSurfaces.isLaunchingActivityOverLockscreen).thenReturn(true)
                val scene by collectLastValue(communalSceneInteractor.currentScene)
                communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")
                assertThat(scene).isEqualTo(CommunalScenes.Communal)

                updateDocked(true)
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.GLANCEABLE_HUB,
                    to = KeyguardState.OCCLUDED,
                    testScope = this,
                )
                assertThat(scene).isEqualTo(CommunalScenes.Communal)
            }
        }

    @Test
    @DisableFlags(FLAG_COMMUNAL_SCENE_KTF_REFACTOR, FLAG_SCENE_CONTAINER)
    fun deviceDocked_doesNotForceCommunalIfTransitioningFromCommunal() =
        with(kosmos) {
            testScope.runTest {
                val scene by collectLastValue(communalSceneInteractor.currentScene)
                assertThat(scene).isEqualTo(CommunalScenes.Blank)

                updateDocked(true)
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.GLANCEABLE_HUB,
                    to = KeyguardState.LOCKSCREEN,
                    testScope = this,
                )
                assertThat(scene).isEqualTo(CommunalScenes.Blank)
            }
        }

    @Test
    @DisableFlags(FLAG_COMMUNAL_SCENE_KTF_REFACTOR, FLAG_SCENE_CONTAINER)
    fun deviceAsleep_forceBlankSceneAfterTimeout() =
        with(kosmos) {
            testScope.runTest {
                val scene by collectLastValue(communalSceneInteractor.currentScene)
                communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")
                assertThat(scene).isEqualTo(CommunalScenes.Communal)

                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.GLANCEABLE_HUB,
                    to = KeyguardState.OFF,
                    testScope = this,
                )
                assertThat(scene).isEqualTo(CommunalScenes.Communal)

                advanceTimeBy(CommunalSceneStartable.AWAKE_DEBOUNCE_DELAY)

                assertThat(scene).isEqualTo(CommunalScenes.Blank)
            }
        }

    @Test
    @DisableFlags(FLAG_COMMUNAL_SCENE_KTF_REFACTOR, FLAG_SCENE_CONTAINER)
    fun deviceAsleep_wakesUpBeforeTimeout_noChangeInScene() =
        with(kosmos) {
            testScope.runTest {
                val scene by collectLastValue(communalSceneInteractor.currentScene)
                communalSceneInteractor.changeScene(CommunalScenes.Communal, "test")
                assertThat(scene).isEqualTo(CommunalScenes.Communal)

                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.GLANCEABLE_HUB,
                    to = KeyguardState.OFF,
                    testScope = this,
                )
                assertThat(scene).isEqualTo(CommunalScenes.Communal)
                advanceTimeBy(CommunalSceneStartable.AWAKE_DEBOUNCE_DELAY / 2)
                assertThat(scene).isEqualTo(CommunalScenes.Communal)

                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.OFF,
                    to = KeyguardState.GLANCEABLE_HUB,
                    testScope = this,
                )

                advanceTimeBy(CommunalSceneStartable.AWAKE_DEBOUNCE_DELAY)
                assertThat(scene).isEqualTo(CommunalScenes.Communal)
            }
        }

    @Ignore("Ignored until custom animations are implemented in b/322787129")
    @Test
    @DisableFlags(FLAG_SCENE_CONTAINER)
    fun dockingOnLockscreen_forcesCommunal() =
        with(kosmos) {
            testScope.runTest {
                communalSceneInteractor.changeScene(CommunalScenes.Blank, "test")
                val scene by collectLastValue(communalSceneInteractor.currentScene)

                // device is docked while on the lockscreen
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.GLANCEABLE_HUB,
                    to = KeyguardState.LOCKSCREEN,
                    testScope = this,
                )
                updateDocked(true)

                assertThat(scene).isEqualTo(CommunalScenes.Blank)
                advanceTimeBy(CommunalSceneStartable.DOCK_DEBOUNCE_DELAY)
                assertThat(scene).isEqualTo(CommunalScenes.Communal)
            }
        }

    @Ignore("Ignored until custom animations are implemented in b/322787129")
    @Test
    @DisableFlags(FLAG_SCENE_CONTAINER)
    fun dockingOnLockscreen_doesNotForceCommunalIfDreamStarts() =
        with(kosmos) {
            testScope.runTest {
                communalSceneInteractor.changeScene(CommunalScenes.Blank, "test")
                val scene by collectLastValue(communalSceneInteractor.currentScene)

                // device is docked while on the lockscreen
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.GLANCEABLE_HUB,
                    to = KeyguardState.LOCKSCREEN,
                    testScope = this,
                )
                updateDocked(true)

                assertThat(scene).isEqualTo(CommunalScenes.Blank)
                advanceTimeBy(CommunalSceneStartable.DOCK_DEBOUNCE_DELAY / 2)
                assertThat(scene).isEqualTo(CommunalScenes.Blank)

                // dream starts shortly after docking
                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.LOCKSCREEN,
                    to = KeyguardState.DREAMING,
                    testScope = this,
                )
                advanceTimeBy(CommunalSceneStartable.DOCK_DEBOUNCE_DELAY)
                assertThat(scene).isEqualTo(CommunalScenes.Blank)
            }
        }

    @Test
    @DisableFlags(FLAG_SCENE_CONTAINER)
    fun hubTimeout_whenDreaming_goesToBlank() =
@@ -711,34 +437,6 @@ class CommunalSceneStartableTest(flags: FlagsParameterization) : SysuiTestCase()
            }
        }

    @Test
    @DisableFlags(FLAG_COMMUNAL_SCENE_KTF_REFACTOR, FLAG_SCENE_CONTAINER)
    fun transitionFromDozingToGlanceableHub_forcesCommunal() =
        with(kosmos) {
            testScope.runTest {
                val scene by collectLastValue(communalSceneInteractor.currentScene)
                communalSceneInteractor.changeScene(CommunalScenes.Blank, "test")
                assertThat(scene).isEqualTo(CommunalScenes.Blank)

                fakeKeyguardTransitionRepository.sendTransitionSteps(
                    from = KeyguardState.DOZING,
                    to = KeyguardState.GLANCEABLE_HUB,
                    testScope = this,
                )

                assertThat(scene).isEqualTo(CommunalScenes.Communal)
            }
        }

    private fun TestScope.updateDocked(docked: Boolean) =
        with(kosmos) {
            runCurrent()
            fakeDockManager.setIsDocked(docked)
            // TODO(b/322787129): uncomment once custom animations are in place
            // fakeDockManager.setDockEvent(DockManager.STATE_DOCKED)
            runCurrent()
        }

    private fun TestScope.updateDreaming(dreaming: Boolean) =
        with(kosmos) {
            fakeKeyguardRepository.setDreaming(dreaming)
+1 −2
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import androidx.test.filters.SmallTest
import com.android.compose.animation.scene.ObservableTransitionState
import com.android.compose.animation.scene.ObservableTransitionState.Idle
import com.android.systemui.Flags.FLAG_COMMUNAL_HUB
import com.android.systemui.Flags.FLAG_COMMUNAL_SCENE_KTF_REFACTOR
import com.android.systemui.SysuiTestCase
import com.android.systemui.communal.data.repository.communalSceneRepository
import com.android.systemui.communal.shared.model.CommunalScenes
@@ -64,7 +63,7 @@ import org.junit.runner.RunWith

@SmallTest
@RunWith(AndroidJUnit4::class)
@EnableFlags(FLAG_COMMUNAL_HUB, FLAG_COMMUNAL_SCENE_KTF_REFACTOR)
@EnableFlags(FLAG_COMMUNAL_HUB)
@DisableSceneContainer
class CommunalSceneTransitionInteractorTest : SysuiTestCase() {

+1 −40
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import android.service.dream.dreamManager
import androidx.test.filters.SmallTest
import com.android.compose.animation.scene.ObservableTransitionState
import com.android.systemui.Flags.FLAG_COMMUNAL_HUB
import com.android.systemui.Flags.FLAG_COMMUNAL_SCENE_KTF_REFACTOR
import com.android.systemui.Flags.FLAG_GLANCEABLE_HUB_V2
import com.android.systemui.Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR
import com.android.systemui.Flags.FLAG_SCENE_CONTAINER
@@ -39,7 +38,6 @@ import com.android.systemui.communal.data.repository.fakeCommunalSceneRepository
import com.android.systemui.communal.domain.interactor.setCommunalAvailable
import com.android.systemui.communal.domain.interactor.setCommunalV2ConfigEnabled
import com.android.systemui.communal.shared.model.CommunalScenes
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepositorySpy
import com.android.systemui.keyguard.data.repository.keyguardOcclusionRepository
@@ -70,7 +68,6 @@ import junit.framework.Assert.assertEquals
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.test.advanceTimeBy
import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@@ -103,10 +100,7 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT
        @JvmStatic
        @Parameters(name = "{0}")
        fun getParams(): List<FlagsParameterization> {
            return FlagsParameterization.allCombinationsOf(
                FLAG_COMMUNAL_SCENE_KTF_REFACTOR,
                FLAG_GLANCEABLE_HUB_V2,
            )
            return FlagsParameterization.allCombinationsOf(FLAG_GLANCEABLE_HUB_V2)
        }
    }

@@ -174,22 +168,6 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT

    @Test
    @EnableFlags(FLAG_KEYGUARD_WM_STATE_REFACTOR)
    @DisableFlags(FLAG_COMMUNAL_SCENE_KTF_REFACTOR, FLAG_GLANCEABLE_HUB_V2)
    fun testTransitionToLockscreen_onWake_canDream_glanceableHubAvailable() =
        kosmos.runTest {
            whenever(dreamManager.canStartDreaming(anyBoolean())).thenReturn(true)
            setCommunalAvailable(true)

            powerInteractor.setAwakeForTest()

            // If dreaming is possible and communal is available, then we should transition to
            // GLANCEABLE_HUB when waking up due to power button press.
            assertThat(transitionRepository)
                .startedTransition(from = KeyguardState.DOZING, to = KeyguardState.GLANCEABLE_HUB)
        }

    @Test
    @EnableFlags(FLAG_KEYGUARD_WM_STATE_REFACTOR, FLAG_COMMUNAL_SCENE_KTF_REFACTOR)
    fun testTransitionToLockscreen_onWake_canDream_ktfRefactor() =
        kosmos.runTest {
            setCommunalAvailable(true)
@@ -242,25 +220,8 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT
                .startedTransition(from = KeyguardState.DOZING, to = KeyguardState.LOCKSCREEN)
        }

    @Test
    @EnableFlags(FLAG_KEYGUARD_WM_STATE_REFACTOR)
    @DisableFlags(FLAG_COMMUNAL_SCENE_KTF_REFACTOR)
    fun testTransitionToGlanceableHub_onWakeup_ifIdleOnCommunal_noOccludingActivity() =
        kosmos.runTest {
            fakeCommunalSceneRepository.setTransitionState(
                flowOf(ObservableTransitionState.Idle(CommunalScenes.Communal))
            )

            powerInteractor.setAwakeForTest()

            // Under default conditions, we should transition to LOCKSCREEN when waking up.
            assertThat(transitionRepository)
                .startedTransition(from = KeyguardState.DOZING, to = KeyguardState.GLANCEABLE_HUB)
        }

    @Test
    @DisableFlags(FLAG_KEYGUARD_WM_STATE_REFACTOR, FLAG_SCENE_CONTAINER)
    @EnableFlags(FLAG_COMMUNAL_SCENE_KTF_REFACTOR)
    fun testTransitionToGlanceableHub_onWakeup_ifAvailable() =
        kosmos.runTest {
            setCommunalAvailable(true)
+1 −6
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import android.provider.Settings
import android.service.dream.dreamManager
import androidx.test.filters.SmallTest
import com.android.systemui.Flags
import com.android.systemui.Flags.FLAG_COMMUNAL_SCENE_KTF_REFACTOR
import com.android.systemui.Flags.FLAG_GLANCEABLE_HUB_V2
import com.android.systemui.Flags.glanceableHubV2
import com.android.systemui.SysuiTestCase
@@ -74,10 +73,7 @@ class FromDreamingTransitionInteractorTest(flags: FlagsParameterization?) : Sysu
        @JvmStatic
        @Parameters(name = "{0}")
        fun getParams(): List<FlagsParameterization> {
            return FlagsParameterization.allCombinationsOf(
                    FLAG_COMMUNAL_SCENE_KTF_REFACTOR,
                    FLAG_GLANCEABLE_HUB_V2,
                )
            return FlagsParameterization.allCombinationsOf(FLAG_GLANCEABLE_HUB_V2)
                .andSceneContainer()
        }
    }
@@ -202,7 +198,6 @@ class FromDreamingTransitionInteractorTest(flags: FlagsParameterization?) : Sysu
        }

    @Test
    @EnableFlags(FLAG_COMMUNAL_SCENE_KTF_REFACTOR)
    @DisableFlags(Flags.FLAG_SCENE_CONTAINER)
    fun testTransitionToGlanceableHubOnWake() =
        kosmos.runTest {
+0 −23
Original line number Diff line number Diff line
@@ -32,16 +32,11 @@

package com.android.systemui.keyguard.domain.interactor

import android.platform.test.annotations.DisableFlags
import android.platform.test.annotations.EnableFlags
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.compose.animation.scene.ObservableTransitionState
import com.android.systemui.Flags
import com.android.systemui.Flags.FLAG_COMMUNAL_SCENE_KTF_REFACTOR
import com.android.systemui.SysuiTestCase
import com.android.systemui.communal.data.repository.fakeCommunalSceneRepository
import com.android.systemui.communal.shared.model.CommunalScenes
import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepositorySpy
import com.android.systemui.keyguard.data.repository.keyguardOcclusionRepository
import com.android.systemui.keyguard.data.repository.keyguardTransitionRepository
@@ -51,7 +46,6 @@ import com.android.systemui.kosmos.testScope
import com.android.systemui.power.domain.interactor.PowerInteractor.Companion.setAwakeForTest
import com.android.systemui.power.domain.interactor.powerInteractor
import com.android.systemui.testKosmos
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
@@ -101,21 +95,4 @@ class FromOccludedTransitionInteractorTest : SysuiTestCase() {
            assertThat(transitionRepository)
                .startedTransition(from = KeyguardState.OCCLUDED, to = KeyguardState.LOCKSCREEN)
        }

    @Test
    @EnableFlags(Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR)
    @DisableFlags(FLAG_COMMUNAL_SCENE_KTF_REFACTOR)
    fun testShowWhenLockedActivity_noLongerOnTop_transitionsToGlanceableHub_ifIdleOnCommunal() =
        testScope.runTest {
            kosmos.fakeCommunalSceneRepository.setTransitionState(
                flowOf(ObservableTransitionState.Idle(CommunalScenes.Communal))
            )
            runCurrent()

            kosmos.keyguardOcclusionRepository.setShowWhenLockedActivityInfo(onTop = false)
            runCurrent()

            assertThat(transitionRepository)
                .startedTransition(from = KeyguardState.OCCLUDED, to = KeyguardState.GLANCEABLE_HUB)
        }
}
Loading