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

Commit b3189e40 authored by Andreas Miko's avatar Andreas Miko
Browse files

[Scene container] Disable invalid edges in FromDozingTransitionInteractor

Set the unlock method to None: I found that KTF would start an invalid
transition to GONE, shortly after it would cancel this transition
because the wake transition on STL is triggered from somewhere else and
therefore LockscreenSceneTransitionInteractor starts a transition to
UNDEFINED instead. However, we transitions to invalid states should
not happen and we should make sure that these edges are represented in
STL instead (not just the one I described) and organize them maybe in
a similar fashion as they become hard to locate with a growing number
of edges.

Bug: 330311871
Bug: 336576536
Flag: com.android.systemui.scene_container
Test: manual smoke test
Change-Id: I937d926bb7137c8c7e6f1e90058cb0aefa8d5aa4
parent c856fdc7
Loading
Loading
Loading
Loading
+84 −33
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ 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.scene.shared.flag.SceneContainerFlag
import com.android.systemui.util.kotlin.Utils.Companion.sample
import com.android.systemui.util.kotlin.sample
import javax.inject.Inject
@@ -100,6 +101,9 @@ constructor(
                        biometricUnlockState,
                    ) ->
                    if (isWakeAndUnlock(biometricUnlockState.mode)) {
                        if (SceneContainerFlag.isEnabled) {
                            // TODO(b/336576536): Check if adaptation for scene framework is needed
                        } else {
                            startTransitionTo(
                                KeyguardState.GONE,
                                ownerReason = "biometric wake and unlock",
@@ -108,6 +112,7 @@ constructor(
                    }
                }
        }
    }

    private fun listenForDozingToAny() {
        if (KeyguardWmStateRefactor.isEnabled) {
@@ -131,21 +136,35 @@ constructor(
                        isIdleOnCommunal,
                        canTransitionToGoneOnWake,
                        primaryBouncerShowing) ->
                    startTransitionTo(
                    if (!deviceEntryRepository.isLockscreenEnabled()) {
                            KeyguardState.GONE
                        if (SceneContainerFlag.isEnabled) {
                            // TODO(b/336576536): Check if adaptation for scene framework is needed
                        } else {
                            startTransitionTo(KeyguardState.GONE)
                        }
                    } else if (canTransitionToGoneOnWake) {
                            KeyguardState.GONE
                        if (SceneContainerFlag.isEnabled) {
                            // TODO(b/336576536): Check if adaptation for scene framework is needed
                        } else {
                            startTransitionTo(KeyguardState.GONE)
                        }
                    } else if (primaryBouncerShowing) {
                            KeyguardState.PRIMARY_BOUNCER
                        if (SceneContainerFlag.isEnabled) {
                            // TODO(b/336576536): Check if adaptation for scene framework is needed
                        } else {
                            startTransitionTo(KeyguardState.PRIMARY_BOUNCER)
                        }
                    } else if (occluded) {
                            KeyguardState.OCCLUDED
                        startTransitionTo(KeyguardState.OCCLUDED)
                    } else if (isIdleOnCommunal) {
                            KeyguardState.GLANCEABLE_HUB
                        if (SceneContainerFlag.isEnabled) {
                            // TODO(b/336576536): Check if adaptation for scene framework is needed
                        } else {
                            KeyguardState.LOCKSCREEN
                            startTransitionTo(KeyguardState.GLANCEABLE_HUB)
                        }
                    } else {
                        startTransitionTo(KeyguardState.LOCKSCREEN)
                    }
                    )
                }
        }
    }
@@ -177,24 +196,56 @@ constructor(
                            // Handled by dismissFromDozing().
                            !isWakeAndUnlock(biometricUnlockState.mode)
                    ) {
                        startTransitionTo(
                        if (!KeyguardWmStateRefactor.isEnabled && canDismissLockscreen) {
                                KeyguardState.GONE
                            if (SceneContainerFlag.isEnabled) {
                                // TODO(b/336576536): Check if adaptation for scene framework is
                                // needed
                            } else {
                                startTransitionTo(
                                    KeyguardState.GONE,
                                    ownerReason = "waking from dozing"
                                )
                            }
                        } else if (
                            KeyguardWmStateRefactor.isEnabled &&
                                !deviceEntryRepository.isLockscreenEnabled()
                        ) {
                                KeyguardState.GONE
                            if (SceneContainerFlag.isEnabled) {
                                // TODO(b/336576536): Check if adaptation for scene framework is
                                // needed
                            } else {
                                startTransitionTo(
                                    KeyguardState.GONE,
                                    ownerReason = "waking from dozing"
                                )
                            }
                        } else if (primaryBouncerShowing) {
                                KeyguardState.PRIMARY_BOUNCER
                            if (SceneContainerFlag.isEnabled) {
                                // TODO(b/336576536): Check if adaptation for scene framework is
                                // needed
                            } else {
                                startTransitionTo(
                                    KeyguardState.PRIMARY_BOUNCER,
                                    ownerReason = "waking from dozing"
                                )
                            }
                        } else if (isIdleOnCommunal) {
                                KeyguardState.GLANCEABLE_HUB
                            if (SceneContainerFlag.isEnabled) {
                                // TODO(b/336576536): Check if adaptation for scene framework is
                                // needed
                            } else {
                                KeyguardState.LOCKSCREEN
                            },
                                startTransitionTo(
                                    KeyguardState.GLANCEABLE_HUB,
                                    ownerReason = "waking from dozing"
                                )
                            }
                        } else {
                            startTransitionTo(
                                KeyguardState.LOCKSCREEN,
                                ownerReason = "waking from dozing"
                            )
                        }
                    }
                }
        }
    }
+6 −4
Original line number Diff line number Diff line
@@ -91,8 +91,8 @@ constructor(

    private fun listenForDreamingToGlanceableHub() {
        if (!communalHub()) return
        if (SceneContainerFlag.isEnabled)
            return // TODO(b/336576536): Check if adaptation for scene framework is needed
        // TODO(b/336576536): Check if adaptation for scene framework is needed
        if (SceneContainerFlag.isEnabled) return
        scope.launch("$TAG#listenForDreamingToGlanceableHub", mainDispatcher) {
            glanceableHubTransitions.listenForGlanceableHubTransition(
                transitionOwnerName = TAG,
@@ -103,6 +103,8 @@ constructor(
    }

    private fun listenForDreamingToPrimaryBouncer() {
        // TODO(b/336576536): Check if adaptation for scene framework is needed
        if (SceneContainerFlag.isEnabled) return
        scope.launch {
            keyguardInteractor.primaryBouncerShowing
                .sample(startedKeyguardTransitionStep, ::Pair)
@@ -179,8 +181,8 @@ constructor(
    }

    private fun listenForDreamingToGoneWhenDismissable() {
        if (SceneContainerFlag.isEnabled)
            return // TODO(b/336576536): Check if adaptation for scene framework is needed
        // TODO(b/336576536): Check if adaptation for scene framework is needed
        if (SceneContainerFlag.isEnabled) return
        scope.launch {
            keyguardInteractor.isAbleToDream
                .sampleCombine(
+4 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import com.android.systemui.keyguard.shared.model.TransitionInfo
import com.android.systemui.keyguard.shared.model.TransitionModeOnCanceled
import com.android.systemui.keyguard.shared.model.TransitionStep
import com.android.systemui.power.domain.interactor.PowerInteractor
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.util.kotlin.sample
import java.util.UUID
import kotlinx.coroutines.CoroutineDispatcher
@@ -81,6 +82,7 @@ sealed class TransitionInteractor(
        // a bugreport.
        ownerReason: String = "",
    ): UUID? {
        toState.checkValidState()
        if (fromState != internalTransitionInteractor.currentTransitionInfoInternal.value.to) {
            Log.e(
                name,
@@ -166,6 +168,8 @@ sealed class TransitionInteractor(
     */
    @Deprecated("Will be merged into maybeStartTransitionToOccludedOrInsecureCamera")
    suspend fun maybeHandleInsecurePowerGesture(): Boolean {
        // TODO(b/336576536): Check if adaptation for scene framework is needed
        if (SceneContainerFlag.isEnabled) return true
        if (keyguardOcclusionInteractor.shouldTransitionFromPowerButtonGesture()) {
            if (keyguardInteractor.isKeyguardDismissible.value) {
                startTransitionTo(
+5 −4
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ import com.android.systemui.bouncer.data.repository.fakeKeyguardBouncerRepositor
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.dock.fakeDockManager
import com.android.systemui.flags.BrokenWithSceneContainer
import com.android.systemui.flags.DisableSceneContainer
import com.android.systemui.flags.FakeFeatureFlags
@@ -124,7 +123,6 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest

    private val powerInteractor by lazy { kosmos.powerInteractor }
    private val communalInteractor by lazy { kosmos.communalInteractor }
    private val dockManager by lazy { kosmos.fakeDockManager }

    companion object {
        @JvmStatic
@@ -583,6 +581,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest
        }

    @Test
    @DisableSceneContainer
    fun dozingToPrimaryBouncer() =
        testScope.runTest {
            // GIVEN a prior transition has run to DOZING
@@ -597,8 +596,8 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest

            assertThat(transitionRepository)
                .startedTransition(
                    to = KeyguardState.PRIMARY_BOUNCER,
                    from = KeyguardState.DOZING,
                    to = KeyguardState.PRIMARY_BOUNCER,
                    animatorAssertion = { it.isNotNull() }
                )

@@ -633,6 +632,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest
        }

    @Test
    @DisableSceneContainer
    fun dozingToGlanceableHub() =
        testScope.runTest {
            // GIVEN a prior transition has run to DOZING
@@ -654,8 +654,8 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest

            assertThat(transitionRepository)
                .startedTransition(
                    to = KeyguardState.GLANCEABLE_HUB,
                    from = KeyguardState.DOZING,
                    to = KeyguardState.GLANCEABLE_HUB,
                    animatorAssertion = { it.isNotNull() }
                )

@@ -1452,6 +1452,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest
        }

    @Test
    @DisableSceneContainer
    fun dreamingToPrimaryBouncer() =
        testScope.runTest {
            // GIVEN a prior transition has run to DREAMING