diff options
2 files changed, 38 insertions, 18 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt index 37b135eaf3e9..ce6445b75fb9 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt @@ -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 @@ -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 @@ -92,6 +92,7 @@ class CommunalSceneStartableTest : SysuiTestCase() { } } + @Ignore("Ignored until custom animations are implemented in b/322787129") @Test fun deviceDocked_forceCommunalScene() = with(kosmos) { @@ -110,6 +111,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) { testScope.runTest { @@ -175,6 +193,7 @@ class CommunalSceneStartableTest : SysuiTestCase() { } } + @Ignore("Ignored until custom animations are implemented in b/322787129") @Test fun dockingOnLockscreen_forcesCommunal() = with(kosmos) { @@ -196,6 +215,7 @@ class CommunalSceneStartableTest : SysuiTestCase() { } } + @Ignore("Ignored until custom animations are implemented in b/322787129") @Test fun dockingOnLockscreen_doesNotForceCommunalIfDreamStarts() = with(kosmos) { @@ -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() } diff --git a/packages/SystemUI/src/com/android/systemui/communal/CommunalSceneStartable.kt b/packages/SystemUI/src/com/android/systemui/communal/CommunalSceneStartable.kt index d5cb4d5a6b2f..c3c7411c401d 100644 --- a/packages/SystemUI/src/com/android/systemui/communal/CommunalSceneStartable.kt +++ b/packages/SystemUI/src/com/android/systemui/communal/CommunalSceneStartable.kt @@ -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 @@ -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( @@ -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 |