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

Commit 729f0711 authored by Josh Tsuji's avatar Josh Tsuji
Browse files

Ensure we're transitioning to GONE when the going away animation starts.

WM starts the going away animation on its own if an activity requests to dismiss the lockscreen (either from the Activity code, or with activity options flags).

In this case, the app/launcher surface *will* become visible, so we should have KTF transition to GONE.

Also, add a "reason" param to startDismissKeyguardTransition to help with debugging bugreports.

Bug: 278086361
Test: atest SystemUITests
Flag: ACONFIG com.android.systemui.keyguard_wm_state_refactor DEVELOPMENT
Change-Id: Ib9e29e68d653908993042a45d75b9612f1da73b4
parent b310a0e0
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -326,7 +326,8 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
            }

            if (KeyguardWmStateRefactor.isEnabled()) {
                mKeyguardTransitionInteractor.startDismissKeyguardTransition();
                mKeyguardTransitionInteractor.startDismissKeyguardTransition(
                        "KeyguardSecurityContainerController#finish");
            }
        }

+10 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.view.RemoteAnimationTarget
import android.view.WindowManager
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor
import com.android.systemui.keyguard.ui.binder.KeyguardSurfaceBehindParamsApplier
import com.android.systemui.statusbar.policy.KeyguardStateController
import java.util.concurrent.Executor
@@ -40,6 +41,7 @@ constructor(
    private val activityTaskManagerService: IActivityTaskManager,
    private val keyguardStateController: KeyguardStateController,
    private val keyguardSurfaceBehindAnimator: KeyguardSurfaceBehindParamsApplier,
    private val keyguardTransitionInteractor: KeyguardTransitionInteractor,
) {

    /**
@@ -141,6 +143,14 @@ constructor(
        finishedCallback: IRemoteAnimationFinishedCallback
    ) {
        if (apps.isNotEmpty()) {
            // 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
            // a transition to GONE.
            keyguardTransitionInteractor.startDismissKeyguardTransition(
                reason = "Going away remote animation started"
            )

            goingAwayRemoteAnimationFinishedCallback = finishedCallback
            keyguardSurfaceBehindAnimator.applyParamsToSurface(apps[0])
        } else {
+3 −1
Original line number Diff line number Diff line
@@ -263,7 +263,9 @@ constructor(
    }

    fun dismissKeyguard() {
        scope.launch("$TAG#dismissKeyguard") { startTransitionTo(KeyguardState.GONE) }
        scope.launch("$TAG#dismissKeyguard") {
            startTransitionTo(KeyguardState.GONE, ownerReason = "#dismissKeyguard()")
        }
    }

    private fun listenForLockscreenToGone() {
+15 −6
Original line number Diff line number Diff line
@@ -377,22 +377,27 @@ constructor(
    /**
     * Called to start a transition that will ultimately dismiss the keyguard from the current
     * state.
     *
     * This is called exclusively by sources that can authoritatively say we should be unlocked,
     * including KeyguardSecurityContainerController and WindowManager.
     */
    fun startDismissKeyguardTransition() {
    fun startDismissKeyguardTransition(reason: String = "") {
        // TODO(b/336576536): Check if adaptation for scene framework is needed
        if (SceneContainerFlag.isEnabled) return
        when (val startedState = startedKeyguardState.replayCache.last()) {
        Log.d(TAG, "#startDismissKeyguardTransition(reason=$reason)")
        when (val startedState = currentTransitionInfoInternal.value.to) {
            LOCKSCREEN -> fromLockscreenTransitionInteractor.get().dismissKeyguard()
            PRIMARY_BOUNCER -> fromPrimaryBouncerTransitionInteractor.get().dismissPrimaryBouncer()
            ALTERNATE_BOUNCER ->
                fromAlternateBouncerTransitionInteractor.get().dismissAlternateBouncer()
            AOD -> fromAodTransitionInteractor.get().dismissAod()
            DOZING -> fromDozingTransitionInteractor.get().dismissFromDozing()
            else ->
                Log.e(
                    "KeyguardTransitionInteractor",
                    "We don't know how to dismiss keyguard from state $startedState."
            KeyguardState.GONE ->
                Log.i(
                    TAG,
                    "Already transitioning to GONE; ignoring startDismissKeyguardTransition."
                )
            else -> Log.e(TAG, "We don't know how to dismiss keyguard from state $startedState.")
        }
    }

@@ -529,4 +534,8 @@ constructor(
        @FloatRange(from = 0.0, to = 1.0) value: Float,
        state: TransitionState
    ) = repository.updateTransition(transitionId, value, state)

    companion object {
        private const val TAG = "KeyguardTransitionInteractor"
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -1549,7 +1549,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
        }

        if (KeyguardWmStateRefactor.isEnabled()) {
            mKeyguardTransitionInteractor.startDismissKeyguardTransition();
            mKeyguardTransitionInteractor.startDismissKeyguardTransition(
                    "SBKVM#keyguardAuthenticated");
        }
    }

Loading