diff options
6 files changed, 9 insertions, 121 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 fbe2c2e97a9c..cf145471e55f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt @@ -451,24 +451,6 @@ class CommunalSceneStartableTest : SysuiTestCase() { } } - @Test - fun transitionFromDozingToGlanceableHub_forcesCommunal() = - with(kosmos) { - testScope.runTest { - val scene by collectLastValue(communalSceneInteractor.currentScene) - communalSceneInteractor.changeScene(CommunalScenes.Blank) - 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() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorTest.kt index 0792a50f7108..612f2e73e4bb 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorTest.kt @@ -34,14 +34,12 @@ package com.android.systemui.keyguard.domain.interactor import android.os.PowerManager import android.platform.test.annotations.EnableFlags -import android.service.dream.dreamManager 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.SysuiTestCase import com.android.systemui.communal.data.repository.fakeCommunalSceneRepository -import com.android.systemui.communal.domain.interactor.setCommunalAvailable import com.android.systemui.communal.shared.model.CommunalScenes import com.android.systemui.keyguard.data.repository.FakeKeyguardTransitionRepository import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository @@ -66,10 +64,8 @@ import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -import org.mockito.Mockito.anyBoolean import org.mockito.Mockito.reset import org.mockito.Mockito.spy -import org.mockito.kotlin.whenever @OptIn(ExperimentalCoroutinesApi::class) @SmallTest @@ -124,66 +120,6 @@ class FromDozingTransitionInteractorTest : SysuiTestCase() { @Test @EnableFlags(Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR) - fun testTransitionToLockscreen_onWakeup_canDream_glanceableHubAvailable() = - testScope.runTest { - whenever(kosmos.dreamManager.canStartDreaming(anyBoolean())).thenReturn(true) - kosmos.setCommunalAvailable(true) - runCurrent() - - powerInteractor.setAwakeForTest() - runCurrent() - - // If dreaming is possible and communal is available, then we should transition to - // GLANCEABLE_HUB when waking up. - assertThat(transitionRepository) - .startedTransition( - from = KeyguardState.DOZING, - to = KeyguardState.GLANCEABLE_HUB, - ) - } - - @Test - @EnableFlags(Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR) - fun testTransitionToLockscreen_onWakeup_canNotDream_glanceableHubAvailable() = - testScope.runTest { - whenever(kosmos.dreamManager.canStartDreaming(anyBoolean())).thenReturn(false) - kosmos.setCommunalAvailable(true) - runCurrent() - - powerInteractor.setAwakeForTest() - runCurrent() - - // If dreaming is NOT possible but communal is available, then we should transition to - // LOCKSCREEN when waking up. - assertThat(transitionRepository) - .startedTransition( - from = KeyguardState.DOZING, - to = KeyguardState.LOCKSCREEN, - ) - } - - @Test - @EnableFlags(Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR) - fun testTransitionToLockscreen_onWakeup_canNDream_glanceableHubNotAvailable() = - testScope.runTest { - whenever(kosmos.dreamManager.canStartDreaming(anyBoolean())).thenReturn(true) - kosmos.setCommunalAvailable(false) - runCurrent() - - powerInteractor.setAwakeForTest() - runCurrent() - - // If dreaming is possible but communal is NOT available, then we should transition to - // LOCKSCREEN when waking up. - assertThat(transitionRepository) - .startedTransition( - from = KeyguardState.DOZING, - to = KeyguardState.LOCKSCREEN, - ) - } - - @Test - @EnableFlags(Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR) fun testTransitionToGlanceableHub_onWakeup_ifIdleOnCommunal_noOccludingActivity() = testScope.runTest { kosmos.fakeCommunalSceneRepository.setTransitionState( diff --git a/packages/SystemUI/src/com/android/systemui/communal/CommunalSceneStartable.kt b/packages/SystemUI/src/com/android/systemui/communal/CommunalSceneStartable.kt index e31f1adb4921..88c3f9f6af2e 100644 --- a/packages/SystemUI/src/com/android/systemui/communal/CommunalSceneStartable.kt +++ b/packages/SystemUI/src/com/android/systemui/communal/CommunalSceneStartable.kt @@ -18,7 +18,6 @@ package com.android.systemui.communal import android.provider.Settings import com.android.compose.animation.scene.SceneKey -import com.android.compose.animation.scene.TransitionKey import com.android.systemui.CoreStartable import com.android.systemui.communal.domain.interactor.CommunalInteractor import com.android.systemui.communal.domain.interactor.CommunalSceneInteractor @@ -92,8 +91,8 @@ constructor( keyguardTransitionInteractor.startedKeyguardTransitionStep .mapLatest(::determineSceneAfterTransition) .filterNotNull() - .onEach { (nextScene, nextTransition) -> - communalSceneInteractor.changeScene(nextScene, nextTransition) + .onEach { nextScene -> + communalSceneInteractor.changeScene(nextScene, CommunalTransitionKeys.SimpleFade) } .launchIn(applicationScope) @@ -189,7 +188,7 @@ constructor( private suspend fun determineSceneAfterTransition( lastStartedTransition: TransitionStep, - ): Pair<SceneKey, TransitionKey>? { + ): SceneKey? { val to = lastStartedTransition.to val from = lastStartedTransition.from val docked = dockManager.isDocked @@ -202,27 +201,22 @@ constructor( // underneath the hub is shown. When launching activities over lockscreen, we only // change scenes once the activity launch animation is finished, so avoid // changing the scene here. - Pair(CommunalScenes.Blank, CommunalTransitionKeys.SimpleFade) + CommunalScenes.Blank } to == KeyguardState.GLANCEABLE_HUB && from == KeyguardState.OCCLUDED -> { // When transitioning to the hub from an occluded state, fade out the hub without // doing any translation. - Pair(CommunalScenes.Communal, CommunalTransitionKeys.SimpleFade) + CommunalScenes.Communal } // Transitioning to Blank scene when entering the edit mode will be handled separately // with custom animations. to == KeyguardState.GONE && !communalInteractor.editModeOpen.value -> - Pair(CommunalScenes.Blank, CommunalTransitionKeys.SimpleFade) + CommunalScenes.Blank !docked && !KeyguardState.deviceIsAwakeInState(to) -> { // If the user taps the screen and wakes the device within this timeout, we don't // want to dismiss the hub delay(AWAKE_DEBOUNCE_DELAY) - Pair(CommunalScenes.Blank, CommunalTransitionKeys.SimpleFade) - } - from == KeyguardState.DOZING && to == KeyguardState.GLANCEABLE_HUB -> { - // Make sure the communal hub is showing (immediately, not fading in) when - // transitioning from dozing to hub. - Pair(CommunalScenes.Communal, CommunalTransitionKeys.Immediately) + CommunalScenes.Blank } else -> null } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractor.kt index 2f40c99c69f9..f3692bdd3a4a 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractor.kt @@ -17,10 +17,8 @@ package com.android.systemui.keyguard.domain.interactor import android.animation.ValueAnimator -import android.app.DreamManager import com.android.app.animation.Interpolators import com.android.systemui.communal.domain.interactor.CommunalInteractor -import com.android.systemui.communal.domain.interactor.CommunalSceneInteractor import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.dagger.qualifiers.Main @@ -53,10 +51,8 @@ constructor( keyguardInteractor: KeyguardInteractor, powerInteractor: PowerInteractor, private val communalInteractor: CommunalInteractor, - private val communalSceneInteractor: CommunalSceneInteractor, keyguardOcclusionInteractor: KeyguardOcclusionInteractor, val deviceEntryRepository: DeviceEntryRepository, - private val dreamManager: DreamManager, ) : TransitionInteractor( fromState = KeyguardState.DOZING, @@ -123,8 +119,7 @@ constructor( .filterRelevantKeyguardStateAnd { isAwake -> isAwake } .sample( keyguardInteractor.isKeyguardOccluded, - communalInteractor.isCommunalAvailable, - communalSceneInteractor.isIdleOnCommunal, + communalInteractor.isIdleOnCommunal, canTransitionToGoneOnWake, keyguardInteractor.primaryBouncerShowing, ) @@ -132,7 +127,6 @@ constructor( ( _, occluded, - isCommunalAvailable, isIdleOnCommunal, canTransitionToGoneOnWake, primaryBouncerShowing) -> @@ -147,10 +141,6 @@ constructor( KeyguardState.OCCLUDED } else if (isIdleOnCommunal) { KeyguardState.GLANCEABLE_HUB - } else if (isCommunalAvailable && dreamManager.canStartDreaming(true)) { - // This case handles tapping the power button to transition through - // dream -> off -> hub. - KeyguardState.GLANCEABLE_HUB } else { KeyguardState.LOCKSCREEN } @@ -169,8 +159,7 @@ constructor( powerInteractor.detailedWakefulness .filterRelevantKeyguardStateAnd { it.isAwake() } .sample( - communalInteractor.isCommunalAvailable, - communalSceneInteractor.isIdleOnCommunal, + communalInteractor.isIdleOnCommunal, keyguardInteractor.biometricUnlockState, canTransitionToGoneOnWake, keyguardInteractor.primaryBouncerShowing, @@ -178,7 +167,6 @@ constructor( .collect { ( _, - isCommunalAvailable, isIdleOnCommunal, biometricUnlockState, canDismissLockscreen, @@ -200,10 +188,6 @@ constructor( KeyguardState.PRIMARY_BOUNCER } else if (isIdleOnCommunal) { KeyguardState.GLANCEABLE_HUB - } else if (isCommunalAvailable && dreamManager.canStartDreaming(true)) { - // This case handles tapping the power button to transition through - // dream -> off -> hub. - KeyguardState.GLANCEABLE_HUB } else { KeyguardState.LOCKSCREEN }, diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/TestMocksModule.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/TestMocksModule.kt index 5db9d3106b8a..9dae44dc8053 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/TestMocksModule.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/TestMocksModule.kt @@ -16,7 +16,6 @@ package com.android.systemui import android.app.ActivityManager -import android.app.DreamManager import android.app.admin.DevicePolicyManager import android.app.trust.TrustManager import android.os.UserManager @@ -33,7 +32,6 @@ import com.android.systemui.animation.DialogTransitionAnimator import com.android.systemui.biometrics.AuthController import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerInteractor import com.android.systemui.communal.domain.interactor.CommunalInteractor -import com.android.systemui.communal.domain.interactor.CommunalSceneInteractor import com.android.systemui.demomode.DemoModeController import com.android.systemui.dump.DumpManager import com.android.systemui.keyguard.ScreenLifecycle @@ -95,7 +93,6 @@ data class TestMocksModule( @get:Provides val demoModeController: DemoModeController = mock(), @get:Provides val deviceProvisionedController: DeviceProvisionedController = mock(), @get:Provides val dozeParameters: DozeParameters = mock(), - @get:Provides val dreamManager: DreamManager = mock(), @get:Provides val dumpManager: DumpManager = mock(), @get:Provides val headsUpManager: HeadsUpManager = mock(), @get:Provides val guestResumeSessionReceiver: GuestResumeSessionReceiver = mock(), @@ -133,7 +130,6 @@ data class TestMocksModule( @get:Provides val systemUIDialogManager: SystemUIDialogManager = mock(), @get:Provides val deviceEntryIconTransitions: Set<DeviceEntryIconTransition> = emptySet(), @get:Provides val communalInteractor: CommunalInteractor = mock(), - @get:Provides val communalSceneInteractor: CommunalSceneInteractor = mock(), @get:Provides val sceneLogger: SceneLogger = mock(), @get:Provides val trustManager: TrustManager = mock(), @get:Provides val primaryBouncerInteractor: PrimaryBouncerInteractor = mock(), diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorKosmos.kt index 744b1275d672..edf77a007efd 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorKosmos.kt @@ -16,9 +16,7 @@ package com.android.systemui.keyguard.domain.interactor -import android.service.dream.dreamManager import com.android.systemui.communal.domain.interactor.communalInteractor -import com.android.systemui.communal.domain.interactor.communalSceneInteractor import com.android.systemui.deviceentry.data.repository.deviceEntryRepository import com.android.systemui.keyguard.data.repository.keyguardTransitionRepository import com.android.systemui.kosmos.Kosmos @@ -37,10 +35,8 @@ var Kosmos.fromDozingTransitionInteractor by mainDispatcher = testDispatcher, keyguardInteractor = keyguardInteractor, communalInteractor = communalInteractor, - communalSceneInteractor = communalSceneInteractor, powerInteractor = powerInteractor, keyguardOcclusionInteractor = keyguardOcclusionInteractor, deviceEntryRepository = deviceEntryRepository, - dreamManager = dreamManager ) } |