Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardWakeDirectlyToGoneInteractorTest.kt +3 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ class KeyguardWakeDirectlyToGoneInteractorTest : SysuiTestCase() { repository.setKeyguardEnabled(true) runCurrent() assertEquals(listOf(false, true, false), canWake) assertEquals(listOf(false, true), canWake) } @Test Loading Loading @@ -374,6 +374,8 @@ class KeyguardWakeDirectlyToGoneInteractorTest : SysuiTestCase() { // Should be canceled by the wakeup, but there would still be an // alarm in flight that should be canceled. false, // True once we're actually GONE. true, ), canWake, ) Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/binder/WindowManagerLockscreenVisibilityManagerTest.kt +6 −0 Original line number Diff line number Diff line Loading @@ -206,6 +206,9 @@ class WindowManagerLockscreenVisibilityManagerTest : SysuiTestCase() { @Test @RequiresFlagsDisabled(Flags.FLAG_ENSURE_KEYGUARD_DOES_TRANSITION_STARTING) fun setSurfaceBehindVisibility_falseSetsLockscreenVisibility_without_keyguard_shell_transitions() { // Show the surface behind, then hide it. underTest.setLockscreenShown(true) underTest.setSurfaceBehindVisibility(true) underTest.setSurfaceBehindVisibility(false) verify(activityTaskManagerService).setLockScreenShown(eq(true), any()) } Loading @@ -213,6 +216,9 @@ class WindowManagerLockscreenVisibilityManagerTest : SysuiTestCase() { @Test @RequiresFlagsEnabled(Flags.FLAG_ENSURE_KEYGUARD_DOES_TRANSITION_STARTING) fun setSurfaceBehindVisibility_falseSetsLockscreenVisibility_with_keyguard_shell_transitions() { // Show the surface behind, then hide it. underTest.setLockscreenShown(true) underTest.setSurfaceBehindVisibility(true) underTest.setSurfaceBehindVisibility(false) verify(keyguardTransitions).startKeyguardTransition(eq(true), any()) } Loading packages/SystemUI/src/com/android/systemui/keyguard/WindowManagerLockscreenVisibilityManager.kt +16 −2 Original line number Diff line number Diff line Loading @@ -131,8 +131,18 @@ constructor( Log.d(TAG, "ActivityTaskManagerService#keyguardGoingAway()") activityTaskManagerService.keyguardGoingAway(0) isKeyguardGoingAway = true } else { // Hide the surface by setting the lockscreen showing. } else if (isLockscreenShowing == true) { // Re-show the lockscreen if the surface was visible and we want to make it invisible, // and the lockscreen is currently showing (this is the usual case of the going away // animation). Re-showing the lockscreen will cancel the going away animation. If we // want to hide the surface, but the lockscreen is not currently showing, do nothing and // wait for lockscreenVisibility to emit if it's appropriate to show the lockscreen (it // might be disabled/suppressed). Log.d( TAG, "setLockscreenShown(true) because we're setting the surface invisible " + "and lockscreen is already showing.", ) setLockscreenShown(true) } } Loading @@ -153,6 +163,10 @@ constructor( nonApps: Array<RemoteAnimationTarget>, finishedCallback: IRemoteAnimationFinishedCallback, ) { // Make sure this is true - we set it true when requesting keyguardGoingAway, but there are // cases where WM starts this transition on its own. isKeyguardGoingAway = true // Ensure that we've started a dismiss keyguard transition. WindowManager can start the // going away animation on its own, if an activity launches and then requests dismissing the // keyguard. In this case, this is the first and only signal we'll receive to start Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardWakeDirectlyToGoneInteractor.kt +14 −3 Original line number Diff line number Diff line Loading @@ -90,6 +90,7 @@ constructor( private val selectedUserInteractor: SelectedUserInteractor, keyguardEnabledInteractor: KeyguardEnabledInteractor, keyguardServiceLockNowInteractor: KeyguardServiceLockNowInteractor, keyguardInteractor: KeyguardInteractor, ) { /** Loading @@ -106,13 +107,18 @@ constructor( .onStart { emit(false) } /** * Whether we can wake from AOD/DOZING directly to GONE, bypassing LOCKSCREEN/BOUNCER states. * Whether we can wake from AOD/DOZING or DREAMING directly to GONE, bypassing * LOCKSCREEN/BOUNCER states. * * This is possible in the following cases: * - Keyguard is disabled, either from an app request or from security being set to "None". * - Keyguard is suppressed, via adb locksettings. * - We're wake and unlocking (fingerprint auth occurred while asleep). * - We're allowed to ignore auth and return to GONE, due to timeouts not elapsing. * - We're DREAMING and dismissible. * - We're already GONE. Technically you're already awake when GONE, but this makes it easier to * reason about this state (for example, if canWakeDirectlyToGone, don't tell WM to pause the * top activity - something you should never do while GONE as well). */ val canWakeDirectlyToGone = combine( Loading @@ -120,14 +126,19 @@ constructor( shouldSuppressKeyguard, repository.biometricUnlockState, repository.canIgnoreAuthAndReturnToGone, transitionInteractor.currentKeyguardState, ) { keyguardEnabled, shouldSuppressKeyguard, biometricUnlockState, canIgnoreAuthAndReturnToGone -> canIgnoreAuthAndReturnToGone, currentState -> (!keyguardEnabled || shouldSuppressKeyguard) || BiometricUnlockMode.isWakeAndUnlock(biometricUnlockState.mode) || canIgnoreAuthAndReturnToGone canIgnoreAuthAndReturnToGone || (currentState == KeyguardState.DREAMING && keyguardInteractor.isKeyguardDismissible.value) || currentState == KeyguardState.GONE } .distinctUntilChanged() Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt +10 −4 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.statusbar.notification.domain.interactor.NotificationLaunchAnimationInteractor import com.android.systemui.util.kotlin.Utils.Companion.toTriple import com.android.systemui.util.kotlin.Utils.Companion.toQuad import com.android.systemui.util.kotlin.sample import com.android.systemui.utils.coroutines.flow.flatMapLatestConflated import dagger.Lazy Loading Loading @@ -240,10 +240,11 @@ constructor( combine( transitionInteractor.currentKeyguardState, wakeToGoneInteractor.canWakeDirectlyToGone, ::Pair, surfaceBehindVisibility, ::Triple, ) .sample(transitionInteractor.startedStepWithPrecedingStep, ::toTriple) .map { (currentState, canWakeDirectlyToGone, startedWithPrev) -> .sample(transitionInteractor.startedStepWithPrecedingStep, ::toQuad) .map { (currentState, canWakeDirectlyToGone, surfaceBehindVis, startedWithPrev) -> val startedFromStep = startedWithPrev.previousValue val startedStep = startedWithPrev.newValue val returningToGoneAfterCancellation = Loading Loading @@ -296,6 +297,11 @@ constructor( // we should simply tell WM that the lockscreen is no longer visible, and // *not* play the going away animation or related animations. false } else if (!surfaceBehindVis) { // If the surface behind is not visible, then the lockscreen has to be visible // since there's nothing to show. The surface behind will never be invisible if // the lockscreen is disabled or suppressed. true } else { currentState != KeyguardState.GONE } Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardWakeDirectlyToGoneInteractorTest.kt +3 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ class KeyguardWakeDirectlyToGoneInteractorTest : SysuiTestCase() { repository.setKeyguardEnabled(true) runCurrent() assertEquals(listOf(false, true, false), canWake) assertEquals(listOf(false, true), canWake) } @Test Loading Loading @@ -374,6 +374,8 @@ class KeyguardWakeDirectlyToGoneInteractorTest : SysuiTestCase() { // Should be canceled by the wakeup, but there would still be an // alarm in flight that should be canceled. false, // True once we're actually GONE. true, ), canWake, ) Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/binder/WindowManagerLockscreenVisibilityManagerTest.kt +6 −0 Original line number Diff line number Diff line Loading @@ -206,6 +206,9 @@ class WindowManagerLockscreenVisibilityManagerTest : SysuiTestCase() { @Test @RequiresFlagsDisabled(Flags.FLAG_ENSURE_KEYGUARD_DOES_TRANSITION_STARTING) fun setSurfaceBehindVisibility_falseSetsLockscreenVisibility_without_keyguard_shell_transitions() { // Show the surface behind, then hide it. underTest.setLockscreenShown(true) underTest.setSurfaceBehindVisibility(true) underTest.setSurfaceBehindVisibility(false) verify(activityTaskManagerService).setLockScreenShown(eq(true), any()) } Loading @@ -213,6 +216,9 @@ class WindowManagerLockscreenVisibilityManagerTest : SysuiTestCase() { @Test @RequiresFlagsEnabled(Flags.FLAG_ENSURE_KEYGUARD_DOES_TRANSITION_STARTING) fun setSurfaceBehindVisibility_falseSetsLockscreenVisibility_with_keyguard_shell_transitions() { // Show the surface behind, then hide it. underTest.setLockscreenShown(true) underTest.setSurfaceBehindVisibility(true) underTest.setSurfaceBehindVisibility(false) verify(keyguardTransitions).startKeyguardTransition(eq(true), any()) } Loading
packages/SystemUI/src/com/android/systemui/keyguard/WindowManagerLockscreenVisibilityManager.kt +16 −2 Original line number Diff line number Diff line Loading @@ -131,8 +131,18 @@ constructor( Log.d(TAG, "ActivityTaskManagerService#keyguardGoingAway()") activityTaskManagerService.keyguardGoingAway(0) isKeyguardGoingAway = true } else { // Hide the surface by setting the lockscreen showing. } else if (isLockscreenShowing == true) { // Re-show the lockscreen if the surface was visible and we want to make it invisible, // and the lockscreen is currently showing (this is the usual case of the going away // animation). Re-showing the lockscreen will cancel the going away animation. If we // want to hide the surface, but the lockscreen is not currently showing, do nothing and // wait for lockscreenVisibility to emit if it's appropriate to show the lockscreen (it // might be disabled/suppressed). Log.d( TAG, "setLockscreenShown(true) because we're setting the surface invisible " + "and lockscreen is already showing.", ) setLockscreenShown(true) } } Loading @@ -153,6 +163,10 @@ constructor( nonApps: Array<RemoteAnimationTarget>, finishedCallback: IRemoteAnimationFinishedCallback, ) { // Make sure this is true - we set it true when requesting keyguardGoingAway, but there are // cases where WM starts this transition on its own. isKeyguardGoingAway = true // Ensure that we've started a dismiss keyguard transition. WindowManager can start the // going away animation on its own, if an activity launches and then requests dismissing the // keyguard. In this case, this is the first and only signal we'll receive to start Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardWakeDirectlyToGoneInteractor.kt +14 −3 Original line number Diff line number Diff line Loading @@ -90,6 +90,7 @@ constructor( private val selectedUserInteractor: SelectedUserInteractor, keyguardEnabledInteractor: KeyguardEnabledInteractor, keyguardServiceLockNowInteractor: KeyguardServiceLockNowInteractor, keyguardInteractor: KeyguardInteractor, ) { /** Loading @@ -106,13 +107,18 @@ constructor( .onStart { emit(false) } /** * Whether we can wake from AOD/DOZING directly to GONE, bypassing LOCKSCREEN/BOUNCER states. * Whether we can wake from AOD/DOZING or DREAMING directly to GONE, bypassing * LOCKSCREEN/BOUNCER states. * * This is possible in the following cases: * - Keyguard is disabled, either from an app request or from security being set to "None". * - Keyguard is suppressed, via adb locksettings. * - We're wake and unlocking (fingerprint auth occurred while asleep). * - We're allowed to ignore auth and return to GONE, due to timeouts not elapsing. * - We're DREAMING and dismissible. * - We're already GONE. Technically you're already awake when GONE, but this makes it easier to * reason about this state (for example, if canWakeDirectlyToGone, don't tell WM to pause the * top activity - something you should never do while GONE as well). */ val canWakeDirectlyToGone = combine( Loading @@ -120,14 +126,19 @@ constructor( shouldSuppressKeyguard, repository.biometricUnlockState, repository.canIgnoreAuthAndReturnToGone, transitionInteractor.currentKeyguardState, ) { keyguardEnabled, shouldSuppressKeyguard, biometricUnlockState, canIgnoreAuthAndReturnToGone -> canIgnoreAuthAndReturnToGone, currentState -> (!keyguardEnabled || shouldSuppressKeyguard) || BiometricUnlockMode.isWakeAndUnlock(biometricUnlockState.mode) || canIgnoreAuthAndReturnToGone canIgnoreAuthAndReturnToGone || (currentState == KeyguardState.DREAMING && keyguardInteractor.isKeyguardDismissible.value) || currentState == KeyguardState.GONE } .distinctUntilChanged() Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt +10 −4 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.statusbar.notification.domain.interactor.NotificationLaunchAnimationInteractor import com.android.systemui.util.kotlin.Utils.Companion.toTriple import com.android.systemui.util.kotlin.Utils.Companion.toQuad import com.android.systemui.util.kotlin.sample import com.android.systemui.utils.coroutines.flow.flatMapLatestConflated import dagger.Lazy Loading Loading @@ -240,10 +240,11 @@ constructor( combine( transitionInteractor.currentKeyguardState, wakeToGoneInteractor.canWakeDirectlyToGone, ::Pair, surfaceBehindVisibility, ::Triple, ) .sample(transitionInteractor.startedStepWithPrecedingStep, ::toTriple) .map { (currentState, canWakeDirectlyToGone, startedWithPrev) -> .sample(transitionInteractor.startedStepWithPrecedingStep, ::toQuad) .map { (currentState, canWakeDirectlyToGone, surfaceBehindVis, startedWithPrev) -> val startedFromStep = startedWithPrev.previousValue val startedStep = startedWithPrev.newValue val returningToGoneAfterCancellation = Loading Loading @@ -296,6 +297,11 @@ constructor( // we should simply tell WM that the lockscreen is no longer visible, and // *not* play the going away animation or related animations. false } else if (!surfaceBehindVis) { // If the surface behind is not visible, then the lockscreen has to be visible // since there's nothing to show. The surface behind will never be invisible if // the lockscreen is disabled or suppressed. true } else { currentState != KeyguardState.GONE } Loading