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

Commit d4d63483 authored by Lucas Silva's avatar Lucas Silva Committed by Android (Google) Code Review
Browse files

Merge "Transition to GH from doze for all wake reasons" into main

parents 7707c243 6aad7f91
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -150,13 +150,13 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT
    @Test
    @EnableFlags(FLAG_KEYGUARD_WM_STATE_REFACTOR)
    @DisableFlags(FLAG_COMMUNAL_SCENE_KTF_REFACTOR)
    fun testTransitionToLockscreen_onPowerButtonPress_canDream_glanceableHubAvailable() =
    fun testTransitionToLockscreen_onWake_canDream_glanceableHubAvailable() =
        testScope.runTest {
            whenever(kosmos.dreamManager.canStartDreaming(anyBoolean())).thenReturn(true)
            kosmos.setCommunalAvailable(true)
            runCurrent()

            powerInteractor.setAwakeForTest(reason = PowerManager.WAKE_REASON_POWER_BUTTON)
            powerInteractor.setAwakeForTest()
            runCurrent()

            // If dreaming is possible and communal is available, then we should transition to
@@ -170,14 +170,14 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT

    @Test
    @EnableFlags(FLAG_KEYGUARD_WM_STATE_REFACTOR, FLAG_COMMUNAL_SCENE_KTF_REFACTOR)
    fun testTransitionToLockscreen_onPowerButtonPress_canDream_ktfRefactor() =
    fun testTransitionToLockscreen_onWake_canDream_ktfRefactor() =
        testScope.runTest {
            whenever(kosmos.dreamManager.canStartDreaming(anyBoolean())).thenReturn(true)
            kosmos.setCommunalAvailable(true)
            runCurrent()
            clearInvocations(kosmos.fakeCommunalSceneRepository)

            powerInteractor.setAwakeForTest(reason = PowerManager.WAKE_REASON_POWER_BUTTON)
            powerInteractor.setAwakeForTest()
            runCurrent()

            // If dreaming is possible and communal is available, then we should transition to
@@ -188,13 +188,13 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT

    @Test
    @EnableFlags(FLAG_KEYGUARD_WM_STATE_REFACTOR)
    fun testTransitionToLockscreen_onPowerButtonPress_canNotDream_glanceableHubAvailable() =
    fun testTransitionToLockscreen_onWake_canNotDream_glanceableHubAvailable() =
        testScope.runTest {
            whenever(kosmos.dreamManager.canStartDreaming(anyBoolean())).thenReturn(false)
            kosmos.setCommunalAvailable(true)
            runCurrent()

            powerInteractor.setAwakeForTest(reason = PowerManager.WAKE_REASON_POWER_BUTTON)
            powerInteractor.setAwakeForTest()
            runCurrent()

            // If dreaming is NOT possible but communal is available, then we should transition to
@@ -208,13 +208,13 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT

    @Test
    @EnableFlags(FLAG_KEYGUARD_WM_STATE_REFACTOR)
    fun testTransitionToLockscreen_onPowerButtonPress_canNDream_glanceableHubNotAvailable() =
    fun testTransitionToLockscreen_onWake_canNDream_glanceableHubNotAvailable() =
        testScope.runTest {
            whenever(kosmos.dreamManager.canStartDreaming(anyBoolean())).thenReturn(true)
            kosmos.setCommunalAvailable(false)
            runCurrent()

            powerInteractor.setAwakeForTest(reason = PowerManager.WAKE_REASON_POWER_BUTTON)
            powerInteractor.setAwakeForTest()
            runCurrent()

            // If dreaming is possible but communal is NOT available, then we should transition to
+2 −15
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@ import com.android.systemui.keyguard.data.repository.KeyguardTransitionRepositor
import com.android.systemui.keyguard.shared.model.BiometricUnlockMode.Companion.isWakeAndUnlock
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.power.domain.interactor.PowerInteractor
import com.android.systemui.power.shared.model.WakeSleepReason
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.util.kotlin.Utils.Companion.sample
import com.android.systemui.util.kotlin.sample
@@ -155,12 +154,7 @@ constructor(
                        if (!SceneContainerFlag.isEnabled) {
                            startTransitionTo(KeyguardState.GLANCEABLE_HUB)
                        }
                    } else if (
                        powerInteractor.detailedWakefulness.value.lastWakeReason ==
                            WakeSleepReason.POWER_BUTTON &&
                            isCommunalAvailable &&
                            dreamManager.canStartDreaming(true)
                    ) {
                    } else if (isCommunalAvailable && dreamManager.canStartDreaming(true)) {
                        // This case handles tapping the power button to transition through
                        // dream -> off -> hub.
                        if (!SceneContainerFlag.isEnabled) {
@@ -226,14 +220,7 @@ constructor(
                                    ownerReason = "waking from dozing"
                                )
                            }
                        } else if (
                            powerInteractor.detailedWakefulness.value.lastWakeReason ==
                                WakeSleepReason.POWER_BUTTON &&
                                isCommunalAvailable &&
                                dreamManager.canStartDreaming(true)
                        ) {
                            // This case handles tapping the power button to transition through
                            // dream -> off -> hub.
                        } else if (isCommunalAvailable && dreamManager.canStartDreaming(true)) {
                            if (!SceneContainerFlag.isEnabled) {
                                transitionToGlanceableHub()
                            }