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

Commit f3d44cbe authored by Matt Pietal's avatar Matt Pietal
Browse files

Remove bad AOD->OCCLUDED transition

If a race condition occurs, such as launching navigation
in maps then immediately hitting the power button,
AOD->GONE was getting canceled incorrectly for OCCLUDED,
even though the device is asleep.

Fixes: 348583197
Flag: EXEMPT bugfix
Test: manual - this is a bad race condition when the
occluded signal comes in from WM. Steps to repro are
in the bug

Change-Id: Ic85e16faeb7b00257e5e617528255c7f90b8ded6
parent 1d3f49a3
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.keyguard.domain.interactor

import android.animation.ValueAnimator
import android.util.Log
import com.android.app.animation.Interpolators
import com.android.app.tracing.coroutines.launch
import com.android.systemui.dagger.SysUISingleton
@@ -184,11 +185,7 @@ constructor(
                .filterRelevantKeyguardStateAnd { isOccluded -> isOccluded }
                .collect {
                    if (!maybeHandleInsecurePowerGesture()) {
                        startTransitionTo(
                            toState = KeyguardState.OCCLUDED,
                            modeOnCanceled = TransitionModeOnCanceled.RESET,
                            ownerReason = "isOccluded = true",
                        )
                        Log.i(TAG, "Ignoring change to isOccluded to prevent errant AOD->OCCLUDED")
                    }
                }
        }
+0 −24
Original line number Diff line number Diff line
@@ -1573,30 +1573,6 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest
            coroutineContext.cancelChildren()
        }

    @Test
    @BrokenWithSceneContainer(339465026)
    fun aodToOccluded() =
        testScope.runTest {
            // GIVEN a prior transition has run to AOD
            runTransitionAndSetWakefulness(KeyguardState.LOCKSCREEN, KeyguardState.AOD)
            runCurrent()

            // WHEN the keyguard is occluded
            keyguardRepository.setKeyguardOccluded(true)
            runCurrent()

            // THEN a transition to OCCLUDED should occur
            assertThat(transitionRepository)
                .startedTransition(
                    ownerName = "FromAodTransitionInteractor(isOccluded = true)",
                    from = KeyguardState.AOD,
                    to = KeyguardState.OCCLUDED,
                    animatorAssertion = { it.isNotNull() },
                )

            coroutineContext.cancelChildren()
        }

    @Test
    @DisableSceneContainer
    fun aodToPrimaryBouncer() =