Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorTest.kt +38 −4 Original line number Diff line number Diff line Loading @@ -20,19 +20,26 @@ import android.os.PowerManager import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import android.platform.test.flag.junit.FlagsParameterization import android.provider.Settings 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 import com.android.systemui.Flags.glanceableHubV2 import com.android.systemui.SysuiTestCase import com.android.systemui.common.data.repository.batteryRepository import com.android.systemui.common.data.repository.fake import com.android.systemui.communal.data.repository.FakeCommunalSceneRepository import com.android.systemui.communal.data.repository.communalSceneRepository 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 Loading @@ -56,11 +63,14 @@ import com.android.systemui.power.domain.interactor.PowerInteractor.Companion.se import com.android.systemui.power.domain.interactor.powerInteractor import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.testKosmos import com.android.systemui.user.data.repository.fakeUserRepository import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth 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 Loading Loading @@ -93,7 +103,10 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT @JvmStatic @Parameters(name = "{0}") fun getParams(): List<FlagsParameterization> { return FlagsParameterization.allCombinationsOf(FLAG_COMMUNAL_SCENE_KTF_REFACTOR) return FlagsParameterization.allCombinationsOf( FLAG_COMMUNAL_SCENE_KTF_REFACTOR, FLAG_GLANCEABLE_HUB_V2, ) } } Loading @@ -107,6 +120,7 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT // Transition to DOZING and set the power interactor asleep. kosmos.powerInteractor.setAsleepForTest() kosmos.setCommunalV2ConfigEnabled(true) runBlocking { kosmos.transitionRepository.sendTransitionSteps( from = KeyguardState.LOCKSCREEN, Loading Loading @@ -160,7 +174,7 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT @Test @EnableFlags(FLAG_KEYGUARD_WM_STATE_REFACTOR) @DisableFlags(FLAG_COMMUNAL_SCENE_KTF_REFACTOR) @DisableFlags(FLAG_COMMUNAL_SCENE_KTF_REFACTOR, FLAG_GLANCEABLE_HUB_V2) fun testTransitionToLockscreen_onWake_canDream_glanceableHubAvailable() = kosmos.runTest { whenever(dreamManager.canStartDreaming(anyBoolean())).thenReturn(true) Loading @@ -179,7 +193,17 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT fun testTransitionToLockscreen_onWake_canDream_ktfRefactor() = kosmos.runTest { setCommunalAvailable(true) if (glanceableHubV2()) { val user = fakeUserRepository.asMainUser() fakeSettings.putIntForUser( Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP, 1, user.id, ) batteryRepository.fake.setDevicePluggedIn(true) } else { whenever(dreamManager.canStartDreaming(anyBoolean())).thenReturn(true) } clearInvocations(fakeCommunalSceneRepository) powerInteractor.setAwakeForTest() Loading Loading @@ -240,7 +264,17 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT fun testTransitionToGlanceableHub_onWakeup_ifAvailable() = kosmos.runTest { setCommunalAvailable(true) if (glanceableHubV2()) { val user = fakeUserRepository.asMainUser() fakeSettings.putIntForUser( Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP, 1, user.id, ) batteryRepository.fake.setDevicePluggedIn(true) } else { whenever(dreamManager.canStartDreaming(anyBoolean())).thenReturn(true) } // Device turns on. powerInteractor.setAwakeForTest() Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromDreamingTransitionInteractorTest.kt +24 −2 Original line number Diff line number Diff line Loading @@ -19,14 +19,20 @@ package com.android.systemui.keyguard.domain.interactor import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import android.platform.test.flag.junit.FlagsParameterization 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 import com.android.systemui.bouncer.data.repository.fakeKeyguardBouncerRepository import com.android.systemui.common.data.repository.batteryRepository import com.android.systemui.common.data.repository.fake import com.android.systemui.communal.data.repository.communalSceneRepository 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.flags.andSceneContainer import com.android.systemui.keyguard.data.repository.FakeKeyguardTransitionRepository Loading @@ -46,6 +52,8 @@ import com.android.systemui.power.domain.interactor.PowerInteractor.Companion.se import com.android.systemui.power.domain.interactor.powerInteractor import com.android.systemui.statusbar.domain.interactor.keyguardOcclusionInteractor import com.android.systemui.testKosmos import com.android.systemui.user.data.repository.fakeUserRepository import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.runBlocking import kotlinx.coroutines.test.advanceTimeBy Loading @@ -66,7 +74,10 @@ class FromDreamingTransitionInteractorTest(flags: FlagsParameterization?) : Sysu @JvmStatic @Parameters(name = "{0}") fun getParams(): List<FlagsParameterization> { return FlagsParameterization.allCombinationsOf(FLAG_COMMUNAL_SCENE_KTF_REFACTOR) return FlagsParameterization.allCombinationsOf( FLAG_COMMUNAL_SCENE_KTF_REFACTOR, FLAG_GLANCEABLE_HUB_V2, ) .andSceneContainer() } } Loading Loading @@ -101,6 +112,7 @@ class FromDreamingTransitionInteractorTest(flags: FlagsParameterization?) : Sysu ) reset(kosmos.transitionRepository) kosmos.setCommunalAvailable(true) kosmos.setCommunalV2ConfigEnabled(true) } kosmos.underTest.start() } Loading Loading @@ -202,7 +214,17 @@ class FromDreamingTransitionInteractorTest(flags: FlagsParameterization?) : Sysu reset(transitionRepository) setCommunalAvailable(true) if (glanceableHubV2()) { val user = fakeUserRepository.asMainUser() fakeSettings.putIntForUser( Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP, 1, user.id, ) batteryRepository.fake.setDevicePluggedIn(true) } else { whenever(dreamManager.canStartDreaming(anyBoolean())).thenReturn(true) } // Device wakes up. powerInteractor.setAwakeForTest() Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractor.kt +23 −7 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import com.android.app.tracing.coroutines.launchTraced as launch import com.android.systemui.Flags.communalSceneKtfRefactor import com.android.systemui.communal.domain.interactor.CommunalInteractor import com.android.systemui.communal.domain.interactor.CommunalSceneInteractor import com.android.systemui.communal.domain.interactor.CommunalSettingsInteractor import com.android.systemui.communal.shared.model.CommunalScenes import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Background Loading Loading @@ -57,6 +58,7 @@ constructor( keyguardInteractor: KeyguardInteractor, powerInteractor: PowerInteractor, private val communalInteractor: CommunalInteractor, private val communalSettingsInteractor: CommunalSettingsInteractor, private val communalSceneInteractor: CommunalSceneInteractor, keyguardOcclusionInteractor: KeyguardOcclusionInteractor, val deviceEntryInteractor: DeviceEntryInteractor, Loading Loading @@ -116,6 +118,17 @@ constructor( } } @SuppressLint("MissingPermission") private fun shouldTransitionToCommunal( shouldShowCommunal: Boolean, isCommunalAvailable: Boolean, ) = if (communalSettingsInteractor.isV2FlagEnabled()) { shouldShowCommunal } else { isCommunalAvailable && dreamManager.canStartDreaming(false) } @OptIn(FlowPreview::class) @SuppressLint("MissingPermission") private fun listenForDozingToDreaming() { Loading @@ -141,9 +154,10 @@ constructor( .filterRelevantKeyguardStateAnd { isAwake -> isAwake } .sample( communalInteractor.isCommunalAvailable, communalInteractor.shouldShowCommunal, communalSceneInteractor.isIdleOnCommunal, ) .collect { (_, isCommunalAvailable, isIdleOnCommunal) -> .collect { (_, isCommunalAvailable, shouldShowCommunal, isIdleOnCommunal) -> val isKeyguardOccludedLegacy = keyguardInteractor.isKeyguardOccluded.value val primaryBouncerShowing = keyguardInteractor.primaryBouncerShowing.value val isKeyguardGoingAway = keyguardInteractor.isKeyguardGoingAway.value Loading Loading @@ -177,11 +191,9 @@ constructor( if (!SceneContainerFlag.isEnabled) { startTransitionTo(KeyguardState.GLANCEABLE_HUB) } } else if (isCommunalAvailable && dreamManager.canStartDreaming(false)) { // Using false for isScreenOn as canStartDreaming returns false if any // dream, including doze, is active. // This case handles tapping the power button to transition through // dream -> off -> hub. } else if ( shouldTransitionToCommunal(shouldShowCommunal, isCommunalAvailable) ) { if (!SceneContainerFlag.isEnabled) { transitionToGlanceableHub() } Loading @@ -203,6 +215,7 @@ constructor( powerInteractor.detailedWakefulness .filterRelevantKeyguardStateAnd { it.isAwake() } .sample( communalInteractor.shouldShowCommunal, communalInteractor.isCommunalAvailable, communalSceneInteractor.isIdleOnCommunal, keyguardInteractor.biometricUnlockState, Loading @@ -212,6 +225,7 @@ constructor( .collect { ( _, shouldShowCommunal, isCommunalAvailable, isIdleOnCommunal, biometricUnlockState, Loading Loading @@ -245,7 +259,9 @@ constructor( ownerReason = "waking from dozing", ) } } else if (isCommunalAvailable && dreamManager.canStartDreaming(true)) { } else if ( shouldTransitionToCommunal(shouldShowCommunal, isCommunalAvailable) ) { if (!SceneContainerFlag.isEnabled) { transitionToGlanceableHub() } Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDreamingTransitionInteractor.kt +30 −13 Original line number Diff line number Diff line Loading @@ -129,6 +129,22 @@ constructor( if (!communalSettingsInteractor.isCommunalFlagEnabled()) return if (SceneContainerFlag.isEnabled) return scope.launch { if (communalSettingsInteractor.isV2FlagEnabled()) { powerInteractor.isAwake .debounce(50L) .filterRelevantKeyguardStateAnd { isAwake -> isAwake } .sample(communalInteractor.shouldShowCommunal) .collect { shouldShowCommunal -> if (shouldShowCommunal) { // This case handles tapping the power button to transition through // dream -> off -> hub. communalSceneInteractor.snapToScene( newScene = CommunalScenes.Communal, loggingReason = "from dreaming to hub", ) } } } else { powerInteractor.isAwake .debounce(50L) .filterRelevantKeyguardStateAnd { isAwake -> isAwake } Loading @@ -145,6 +161,7 @@ constructor( } } } } private fun listenForDreamingToPrimaryBouncer() { // TODO(b/336576536): Check if adaptation for scene framework is needed Loading packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorKosmos.kt +2 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,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.communal.domain.interactor.communalSettingsInteractor import com.android.systemui.deviceentry.domain.interactor.deviceEntryInteractor import com.android.systemui.keyguard.data.repository.keyguardTransitionRepository import com.android.systemui.kosmos.Kosmos Loading @@ -44,5 +45,6 @@ var Kosmos.fromDozingTransitionInteractor by deviceEntryInteractor = deviceEntryInteractor, wakeToGoneInteractor = keyguardWakeDirectlyToGoneInteractor, dreamManager = dreamManager, communalSettingsInteractor = communalSettingsInteractor, ) } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorTest.kt +38 −4 Original line number Diff line number Diff line Loading @@ -20,19 +20,26 @@ import android.os.PowerManager import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import android.platform.test.flag.junit.FlagsParameterization import android.provider.Settings 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 import com.android.systemui.Flags.glanceableHubV2 import com.android.systemui.SysuiTestCase import com.android.systemui.common.data.repository.batteryRepository import com.android.systemui.common.data.repository.fake import com.android.systemui.communal.data.repository.FakeCommunalSceneRepository import com.android.systemui.communal.data.repository.communalSceneRepository 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 Loading @@ -56,11 +63,14 @@ import com.android.systemui.power.domain.interactor.PowerInteractor.Companion.se import com.android.systemui.power.domain.interactor.powerInteractor import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.testKosmos import com.android.systemui.user.data.repository.fakeUserRepository import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth 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 Loading Loading @@ -93,7 +103,10 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT @JvmStatic @Parameters(name = "{0}") fun getParams(): List<FlagsParameterization> { return FlagsParameterization.allCombinationsOf(FLAG_COMMUNAL_SCENE_KTF_REFACTOR) return FlagsParameterization.allCombinationsOf( FLAG_COMMUNAL_SCENE_KTF_REFACTOR, FLAG_GLANCEABLE_HUB_V2, ) } } Loading @@ -107,6 +120,7 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT // Transition to DOZING and set the power interactor asleep. kosmos.powerInteractor.setAsleepForTest() kosmos.setCommunalV2ConfigEnabled(true) runBlocking { kosmos.transitionRepository.sendTransitionSteps( from = KeyguardState.LOCKSCREEN, Loading Loading @@ -160,7 +174,7 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT @Test @EnableFlags(FLAG_KEYGUARD_WM_STATE_REFACTOR) @DisableFlags(FLAG_COMMUNAL_SCENE_KTF_REFACTOR) @DisableFlags(FLAG_COMMUNAL_SCENE_KTF_REFACTOR, FLAG_GLANCEABLE_HUB_V2) fun testTransitionToLockscreen_onWake_canDream_glanceableHubAvailable() = kosmos.runTest { whenever(dreamManager.canStartDreaming(anyBoolean())).thenReturn(true) Loading @@ -179,7 +193,17 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT fun testTransitionToLockscreen_onWake_canDream_ktfRefactor() = kosmos.runTest { setCommunalAvailable(true) if (glanceableHubV2()) { val user = fakeUserRepository.asMainUser() fakeSettings.putIntForUser( Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP, 1, user.id, ) batteryRepository.fake.setDevicePluggedIn(true) } else { whenever(dreamManager.canStartDreaming(anyBoolean())).thenReturn(true) } clearInvocations(fakeCommunalSceneRepository) powerInteractor.setAwakeForTest() Loading Loading @@ -240,7 +264,17 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT fun testTransitionToGlanceableHub_onWakeup_ifAvailable() = kosmos.runTest { setCommunalAvailable(true) if (glanceableHubV2()) { val user = fakeUserRepository.asMainUser() fakeSettings.putIntForUser( Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP, 1, user.id, ) batteryRepository.fake.setDevicePluggedIn(true) } else { whenever(dreamManager.canStartDreaming(anyBoolean())).thenReturn(true) } // Device turns on. powerInteractor.setAwakeForTest() Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromDreamingTransitionInteractorTest.kt +24 −2 Original line number Diff line number Diff line Loading @@ -19,14 +19,20 @@ package com.android.systemui.keyguard.domain.interactor import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import android.platform.test.flag.junit.FlagsParameterization 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 import com.android.systemui.bouncer.data.repository.fakeKeyguardBouncerRepository import com.android.systemui.common.data.repository.batteryRepository import com.android.systemui.common.data.repository.fake import com.android.systemui.communal.data.repository.communalSceneRepository 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.flags.andSceneContainer import com.android.systemui.keyguard.data.repository.FakeKeyguardTransitionRepository Loading @@ -46,6 +52,8 @@ import com.android.systemui.power.domain.interactor.PowerInteractor.Companion.se import com.android.systemui.power.domain.interactor.powerInteractor import com.android.systemui.statusbar.domain.interactor.keyguardOcclusionInteractor import com.android.systemui.testKosmos import com.android.systemui.user.data.repository.fakeUserRepository import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.runBlocking import kotlinx.coroutines.test.advanceTimeBy Loading @@ -66,7 +74,10 @@ class FromDreamingTransitionInteractorTest(flags: FlagsParameterization?) : Sysu @JvmStatic @Parameters(name = "{0}") fun getParams(): List<FlagsParameterization> { return FlagsParameterization.allCombinationsOf(FLAG_COMMUNAL_SCENE_KTF_REFACTOR) return FlagsParameterization.allCombinationsOf( FLAG_COMMUNAL_SCENE_KTF_REFACTOR, FLAG_GLANCEABLE_HUB_V2, ) .andSceneContainer() } } Loading Loading @@ -101,6 +112,7 @@ class FromDreamingTransitionInteractorTest(flags: FlagsParameterization?) : Sysu ) reset(kosmos.transitionRepository) kosmos.setCommunalAvailable(true) kosmos.setCommunalV2ConfigEnabled(true) } kosmos.underTest.start() } Loading Loading @@ -202,7 +214,17 @@ class FromDreamingTransitionInteractorTest(flags: FlagsParameterization?) : Sysu reset(transitionRepository) setCommunalAvailable(true) if (glanceableHubV2()) { val user = fakeUserRepository.asMainUser() fakeSettings.putIntForUser( Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP, 1, user.id, ) batteryRepository.fake.setDevicePluggedIn(true) } else { whenever(dreamManager.canStartDreaming(anyBoolean())).thenReturn(true) } // Device wakes up. powerInteractor.setAwakeForTest() Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractor.kt +23 −7 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import com.android.app.tracing.coroutines.launchTraced as launch import com.android.systemui.Flags.communalSceneKtfRefactor import com.android.systemui.communal.domain.interactor.CommunalInteractor import com.android.systemui.communal.domain.interactor.CommunalSceneInteractor import com.android.systemui.communal.domain.interactor.CommunalSettingsInteractor import com.android.systemui.communal.shared.model.CommunalScenes import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Background Loading Loading @@ -57,6 +58,7 @@ constructor( keyguardInteractor: KeyguardInteractor, powerInteractor: PowerInteractor, private val communalInteractor: CommunalInteractor, private val communalSettingsInteractor: CommunalSettingsInteractor, private val communalSceneInteractor: CommunalSceneInteractor, keyguardOcclusionInteractor: KeyguardOcclusionInteractor, val deviceEntryInteractor: DeviceEntryInteractor, Loading Loading @@ -116,6 +118,17 @@ constructor( } } @SuppressLint("MissingPermission") private fun shouldTransitionToCommunal( shouldShowCommunal: Boolean, isCommunalAvailable: Boolean, ) = if (communalSettingsInteractor.isV2FlagEnabled()) { shouldShowCommunal } else { isCommunalAvailable && dreamManager.canStartDreaming(false) } @OptIn(FlowPreview::class) @SuppressLint("MissingPermission") private fun listenForDozingToDreaming() { Loading @@ -141,9 +154,10 @@ constructor( .filterRelevantKeyguardStateAnd { isAwake -> isAwake } .sample( communalInteractor.isCommunalAvailable, communalInteractor.shouldShowCommunal, communalSceneInteractor.isIdleOnCommunal, ) .collect { (_, isCommunalAvailable, isIdleOnCommunal) -> .collect { (_, isCommunalAvailable, shouldShowCommunal, isIdleOnCommunal) -> val isKeyguardOccludedLegacy = keyguardInteractor.isKeyguardOccluded.value val primaryBouncerShowing = keyguardInteractor.primaryBouncerShowing.value val isKeyguardGoingAway = keyguardInteractor.isKeyguardGoingAway.value Loading Loading @@ -177,11 +191,9 @@ constructor( if (!SceneContainerFlag.isEnabled) { startTransitionTo(KeyguardState.GLANCEABLE_HUB) } } else if (isCommunalAvailable && dreamManager.canStartDreaming(false)) { // Using false for isScreenOn as canStartDreaming returns false if any // dream, including doze, is active. // This case handles tapping the power button to transition through // dream -> off -> hub. } else if ( shouldTransitionToCommunal(shouldShowCommunal, isCommunalAvailable) ) { if (!SceneContainerFlag.isEnabled) { transitionToGlanceableHub() } Loading @@ -203,6 +215,7 @@ constructor( powerInteractor.detailedWakefulness .filterRelevantKeyguardStateAnd { it.isAwake() } .sample( communalInteractor.shouldShowCommunal, communalInteractor.isCommunalAvailable, communalSceneInteractor.isIdleOnCommunal, keyguardInteractor.biometricUnlockState, Loading @@ -212,6 +225,7 @@ constructor( .collect { ( _, shouldShowCommunal, isCommunalAvailable, isIdleOnCommunal, biometricUnlockState, Loading Loading @@ -245,7 +259,9 @@ constructor( ownerReason = "waking from dozing", ) } } else if (isCommunalAvailable && dreamManager.canStartDreaming(true)) { } else if ( shouldTransitionToCommunal(shouldShowCommunal, isCommunalAvailable) ) { if (!SceneContainerFlag.isEnabled) { transitionToGlanceableHub() } Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDreamingTransitionInteractor.kt +30 −13 Original line number Diff line number Diff line Loading @@ -129,6 +129,22 @@ constructor( if (!communalSettingsInteractor.isCommunalFlagEnabled()) return if (SceneContainerFlag.isEnabled) return scope.launch { if (communalSettingsInteractor.isV2FlagEnabled()) { powerInteractor.isAwake .debounce(50L) .filterRelevantKeyguardStateAnd { isAwake -> isAwake } .sample(communalInteractor.shouldShowCommunal) .collect { shouldShowCommunal -> if (shouldShowCommunal) { // This case handles tapping the power button to transition through // dream -> off -> hub. communalSceneInteractor.snapToScene( newScene = CommunalScenes.Communal, loggingReason = "from dreaming to hub", ) } } } else { powerInteractor.isAwake .debounce(50L) .filterRelevantKeyguardStateAnd { isAwake -> isAwake } Loading @@ -145,6 +161,7 @@ constructor( } } } } private fun listenForDreamingToPrimaryBouncer() { // TODO(b/336576536): Check if adaptation for scene framework is needed Loading
packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractorKosmos.kt +2 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,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.communal.domain.interactor.communalSettingsInteractor import com.android.systemui.deviceentry.domain.interactor.deviceEntryInteractor import com.android.systemui.keyguard.data.repository.keyguardTransitionRepository import com.android.systemui.kosmos.Kosmos Loading @@ -44,5 +45,6 @@ var Kosmos.fromDozingTransitionInteractor by deviceEntryInteractor = deviceEntryInteractor, wakeToGoneInteractor = keyguardWakeDirectlyToGoneInteractor, dreamManager = dreamManager, communalSettingsInteractor = communalSettingsInteractor, ) }