Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractorTest.kt +32 −3 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.systemui.keyguard.domain.interactor import android.app.ActivityManager import android.app.WindowConfiguration import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import androidx.test.ext.junit.runners.AndroidJUnit4 Loading @@ -29,7 +27,6 @@ import com.android.systemui.flags.DisableSceneContainer import com.android.systemui.keyguard.data.repository.FakeKeyguardTransitionRepository import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository import com.android.systemui.keyguard.data.repository.keyguardOcclusionRepository import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.StatusBarState import com.android.systemui.keyguard.shared.model.StatusBarState.KEYGUARD Loading Loading @@ -69,6 +66,38 @@ class FromLockscreenTransitionInteractorTest : SysuiTestCase() { transitionRepository = kosmos.fakeKeyguardTransitionRepository } @Test @DisableSceneContainer fun testOccludedFailsafe() = testScope.runTest { underTest.start() transitionRepository.sendTransitionSteps( from = KeyguardState.OFF, to = KeyguardState.AOD, testScope, ) // Simulate the device being put into OCCLUDED state, but was somehow missed by the // FromAodTransitionInteractor keyguardRepository.setKeyguardOccluded(true) runCurrent() reset(transitionRepository) transitionRepository.sendTransitionStep( TransitionStep( transitionState = TransitionState.STARTED, from = KeyguardState.AOD, to = KeyguardState.LOCKSCREEN, ) ) runCurrent() // After the above step was STARTED, the transition should be corrected to go to // OCCLUDED assertThatRepository(transitionRepository) .startedTransition(from = KeyguardState.LOCKSCREEN, to = KeyguardState.OCCLUDED) } @Test @DisableSceneContainer fun testSurfaceBehindVisibility() = Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractor.kt +20 −0 Original line number Diff line number Diff line Loading @@ -332,6 +332,26 @@ constructor( .filterRelevantKeyguardStateAnd { isOccluded -> isOccluded } .collect { startTransitionTo(KeyguardState.OCCLUDED) } } // Safety check added for incoming phone calls while on AOD/DOZING. If a transition has // begun to LOCKSCREEN but keyguard is occluded then make sure we change the transition // to go to OCCLUDED. This intentionally uses the [startedKeyguardTransitionStep] to // ensure that the transition has really begun scope.launch("$TAG#listenForLockscreenToOccludedOrDreamingFailSafe") { transitionInteractor.startedKeyguardTransitionStep .filter { it.from != KeyguardState.OCCLUDED && it.from != KeyguardState.DREAMING && it.to == KeyguardState.LOCKSCREEN } .collect { if (keyguardInteractor.isKeyguardOccluded.value) { startTransitionTo( KeyguardState.OCCLUDED, ownerReason = "occluded failsafe", ) } } } } } Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractorTest.kt +32 −3 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.systemui.keyguard.domain.interactor import android.app.ActivityManager import android.app.WindowConfiguration import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import androidx.test.ext.junit.runners.AndroidJUnit4 Loading @@ -29,7 +27,6 @@ import com.android.systemui.flags.DisableSceneContainer import com.android.systemui.keyguard.data.repository.FakeKeyguardTransitionRepository import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository import com.android.systemui.keyguard.data.repository.keyguardOcclusionRepository import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.StatusBarState import com.android.systemui.keyguard.shared.model.StatusBarState.KEYGUARD Loading Loading @@ -69,6 +66,38 @@ class FromLockscreenTransitionInteractorTest : SysuiTestCase() { transitionRepository = kosmos.fakeKeyguardTransitionRepository } @Test @DisableSceneContainer fun testOccludedFailsafe() = testScope.runTest { underTest.start() transitionRepository.sendTransitionSteps( from = KeyguardState.OFF, to = KeyguardState.AOD, testScope, ) // Simulate the device being put into OCCLUDED state, but was somehow missed by the // FromAodTransitionInteractor keyguardRepository.setKeyguardOccluded(true) runCurrent() reset(transitionRepository) transitionRepository.sendTransitionStep( TransitionStep( transitionState = TransitionState.STARTED, from = KeyguardState.AOD, to = KeyguardState.LOCKSCREEN, ) ) runCurrent() // After the above step was STARTED, the transition should be corrected to go to // OCCLUDED assertThatRepository(transitionRepository) .startedTransition(from = KeyguardState.LOCKSCREEN, to = KeyguardState.OCCLUDED) } @Test @DisableSceneContainer fun testSurfaceBehindVisibility() = Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractor.kt +20 −0 Original line number Diff line number Diff line Loading @@ -332,6 +332,26 @@ constructor( .filterRelevantKeyguardStateAnd { isOccluded -> isOccluded } .collect { startTransitionTo(KeyguardState.OCCLUDED) } } // Safety check added for incoming phone calls while on AOD/DOZING. If a transition has // begun to LOCKSCREEN but keyguard is occluded then make sure we change the transition // to go to OCCLUDED. This intentionally uses the [startedKeyguardTransitionStep] to // ensure that the transition has really begun scope.launch("$TAG#listenForLockscreenToOccludedOrDreamingFailSafe") { transitionInteractor.startedKeyguardTransitionStep .filter { it.from != KeyguardState.OCCLUDED && it.from != KeyguardState.DREAMING && it.to == KeyguardState.LOCKSCREEN } .collect { if (keyguardInteractor.isKeyguardOccluded.value) { startTransitionTo( KeyguardState.OCCLUDED, ownerReason = "occluded failsafe", ) } } } } } Loading