Loading packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt +23 −2 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import com.android.systemui.communal.domain.interactor.communalInteractor import com.android.systemui.communal.domain.interactor.setCommunalAvailable import com.android.systemui.communal.shared.model.CommunalScenes import com.android.systemui.coroutines.collectLastValue import com.android.systemui.dock.DockManager import com.android.systemui.dock.dockManager import com.android.systemui.dock.fakeDockManager import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository Loading @@ -40,6 +39,7 @@ 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 Loading Loading @@ -92,6 +92,7 @@ class CommunalSceneStartableTest : SysuiTestCase() { } } @Ignore("Ignored until custom animations are implemented in b/322787129") @Test fun deviceDocked_forceCommunalScene() = with(kosmos) { Loading @@ -109,6 +110,23 @@ class CommunalSceneStartableTest : SysuiTestCase() { } } @Test fun exitingDream_forceCommunalScene() = with(kosmos) { testScope.runTest { val scene by collectLastValue(communalInteractor.desiredScene) assertThat(scene).isEqualTo(CommunalScenes.Blank) updateDocked(true) fakeKeyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.DREAMING, to = KeyguardState.LOCKSCREEN, testScope = this ) assertThat(scene).isEqualTo(CommunalScenes.Communal) } } @Test fun deviceDocked_doesNotForceCommunalIfTransitioningFromCommunal() = with(kosmos) { Loading Loading @@ -175,6 +193,7 @@ class CommunalSceneStartableTest : SysuiTestCase() { } } @Ignore("Ignored until custom animations are implemented in b/322787129") @Test fun dockingOnLockscreen_forcesCommunal() = with(kosmos) { Loading @@ -196,6 +215,7 @@ class CommunalSceneStartableTest : SysuiTestCase() { } } @Ignore("Ignored until custom animations are implemented in b/322787129") @Test fun dockingOnLockscreen_doesNotForceCommunalIfDreamStarts() = with(kosmos) { Loading Loading @@ -230,7 +250,8 @@ class CommunalSceneStartableTest : SysuiTestCase() { with(kosmos) { runCurrent() fakeDockManager.setIsDocked(docked) fakeDockManager.setDockEvent(DockManager.STATE_DOCKED) // TODO(b/322787129): uncomment once custom animations are in place // fakeDockManager.setDockEvent(DockManager.STATE_DOCKED) runCurrent() } Loading packages/SystemUI/src/com/android/systemui/communal/CommunalSceneStartable.kt +15 −16 Original line number Diff line number Diff line Loading @@ -24,18 +24,15 @@ import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.dock.DockManager import com.android.systemui.dock.retrieveIsDocked import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.TransitionStep import com.android.systemui.util.kotlin.sample import javax.inject.Inject import kotlin.time.Duration.Companion.seconds import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.delay import kotlinx.coroutines.flow.debounce import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.mapLatest Loading Loading @@ -66,19 +63,21 @@ constructor( .onEach { nextScene -> communalInteractor.onSceneChanged(nextScene) } .launchIn(applicationScope) // TODO(b/322787129): re-enable once custom animations are in place // Handle automatically switching to communal when docked. dockManager .retrieveIsDocked() // Allow some time after docking to ensure the dream doesn't start. If the dream // starts, then we don't want to automatically transition to glanceable hub. .debounce(DOCK_DEBOUNCE_DELAY) .sample(keyguardTransitionInteractor.startedKeyguardState, ::Pair) .onEach { (docked, lastStartedState) -> if (docked && lastStartedState == KeyguardState.LOCKSCREEN) { communalInteractor.onSceneChanged(CommunalScenes.Communal) } } .launchIn(bgScope) // dockManager // .retrieveIsDocked() // // Allow some time after docking to ensure the dream doesn't start. If the // dream // // starts, then we don't want to automatically transition to glanceable hub. // .debounce(DOCK_DEBOUNCE_DELAY) // .sample(keyguardTransitionInteractor.startedKeyguardState, ::Pair) // .onEach { (docked, lastStartedState) -> // if (docked && lastStartedState == KeyguardState.LOCKSCREEN) { // communalInteractor.onSceneChanged(CommunalScenes.Communal) // } // } // .launchIn(bgScope) } private suspend fun determineSceneAfterTransition( Loading @@ -89,7 +88,7 @@ constructor( val docked = dockManager.isDocked return when { docked && to == KeyguardState.LOCKSCREEN && from != KeyguardState.GLANCEABLE_HUB -> { docked && to == KeyguardState.LOCKSCREEN && from == KeyguardState.DREAMING -> { CommunalScenes.Communal } to == KeyguardState.GONE -> CommunalScenes.Blank Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt +23 −2 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import com.android.systemui.communal.domain.interactor.communalInteractor import com.android.systemui.communal.domain.interactor.setCommunalAvailable import com.android.systemui.communal.shared.model.CommunalScenes import com.android.systemui.coroutines.collectLastValue import com.android.systemui.dock.DockManager import com.android.systemui.dock.dockManager import com.android.systemui.dock.fakeDockManager import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository Loading @@ -40,6 +39,7 @@ 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 Loading Loading @@ -92,6 +92,7 @@ class CommunalSceneStartableTest : SysuiTestCase() { } } @Ignore("Ignored until custom animations are implemented in b/322787129") @Test fun deviceDocked_forceCommunalScene() = with(kosmos) { Loading @@ -109,6 +110,23 @@ class CommunalSceneStartableTest : SysuiTestCase() { } } @Test fun exitingDream_forceCommunalScene() = with(kosmos) { testScope.runTest { val scene by collectLastValue(communalInteractor.desiredScene) assertThat(scene).isEqualTo(CommunalScenes.Blank) updateDocked(true) fakeKeyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.DREAMING, to = KeyguardState.LOCKSCREEN, testScope = this ) assertThat(scene).isEqualTo(CommunalScenes.Communal) } } @Test fun deviceDocked_doesNotForceCommunalIfTransitioningFromCommunal() = with(kosmos) { Loading Loading @@ -175,6 +193,7 @@ class CommunalSceneStartableTest : SysuiTestCase() { } } @Ignore("Ignored until custom animations are implemented in b/322787129") @Test fun dockingOnLockscreen_forcesCommunal() = with(kosmos) { Loading @@ -196,6 +215,7 @@ class CommunalSceneStartableTest : SysuiTestCase() { } } @Ignore("Ignored until custom animations are implemented in b/322787129") @Test fun dockingOnLockscreen_doesNotForceCommunalIfDreamStarts() = with(kosmos) { Loading Loading @@ -230,7 +250,8 @@ class CommunalSceneStartableTest : SysuiTestCase() { with(kosmos) { runCurrent() fakeDockManager.setIsDocked(docked) fakeDockManager.setDockEvent(DockManager.STATE_DOCKED) // TODO(b/322787129): uncomment once custom animations are in place // fakeDockManager.setDockEvent(DockManager.STATE_DOCKED) runCurrent() } Loading
packages/SystemUI/src/com/android/systemui/communal/CommunalSceneStartable.kt +15 −16 Original line number Diff line number Diff line Loading @@ -24,18 +24,15 @@ import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.dock.DockManager import com.android.systemui.dock.retrieveIsDocked import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.TransitionStep import com.android.systemui.util.kotlin.sample import javax.inject.Inject import kotlin.time.Duration.Companion.seconds import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.delay import kotlinx.coroutines.flow.debounce import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.mapLatest Loading Loading @@ -66,19 +63,21 @@ constructor( .onEach { nextScene -> communalInteractor.onSceneChanged(nextScene) } .launchIn(applicationScope) // TODO(b/322787129): re-enable once custom animations are in place // Handle automatically switching to communal when docked. dockManager .retrieveIsDocked() // Allow some time after docking to ensure the dream doesn't start. If the dream // starts, then we don't want to automatically transition to glanceable hub. .debounce(DOCK_DEBOUNCE_DELAY) .sample(keyguardTransitionInteractor.startedKeyguardState, ::Pair) .onEach { (docked, lastStartedState) -> if (docked && lastStartedState == KeyguardState.LOCKSCREEN) { communalInteractor.onSceneChanged(CommunalScenes.Communal) } } .launchIn(bgScope) // dockManager // .retrieveIsDocked() // // Allow some time after docking to ensure the dream doesn't start. If the // dream // // starts, then we don't want to automatically transition to glanceable hub. // .debounce(DOCK_DEBOUNCE_DELAY) // .sample(keyguardTransitionInteractor.startedKeyguardState, ::Pair) // .onEach { (docked, lastStartedState) -> // if (docked && lastStartedState == KeyguardState.LOCKSCREEN) { // communalInteractor.onSceneChanged(CommunalScenes.Communal) // } // } // .launchIn(bgScope) } private suspend fun determineSceneAfterTransition( Loading @@ -89,7 +88,7 @@ constructor( val docked = dockManager.isDocked return when { docked && to == KeyguardState.LOCKSCREEN && from != KeyguardState.GLANCEABLE_HUB -> { docked && to == KeyguardState.LOCKSCREEN && from == KeyguardState.DREAMING -> { CommunalScenes.Communal } to == KeyguardState.GONE -> CommunalScenes.Blank Loading