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

Commit f78c7d85 authored by Josh Tsuji's avatar Josh Tsuji Committed by Android (Google) Code Review
Browse files

Merge "Fix issues with OCCLUDED -> GONE behind keyguard_wm_state_refactor." into main

parents 2b71b58f 6bc48bdc
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -2399,6 +2399,16 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
     */
    private void handleDismiss(IKeyguardDismissCallback callback, CharSequence message) {
        if (mShowing) {
            if (KeyguardWmStateRefactor.isEnabled()) {
                Log.d(TAG, "Dismissing keyguard with keyguard_wm_refactor_enabled: "
                        + "cancelDoKeyguardLaterLocked");

                // This won't get canceled in onKeyguardExitFinished() if the refactor is enabled,
                // which can lead to the keyguard re-showing. Cancel here for now; this can be
                // removed once we migrate the logic that posts doKeyguardLater in the first place.
                cancelDoKeyguardLaterLocked();
            }

            if (callback != null) {
                mDismissCallbackRegistry.addCallback(callback);
            }
+7 −0
Original line number Diff line number Diff line
@@ -157,6 +157,13 @@ constructor(
        }
    }

    /** Starts a transition to dismiss the keyguard from the OCCLUDED state. */
    fun dismissFromOccluded() {
        scope.launch {
            startTransitionTo(KeyguardState.GONE, ownerReason = "Dismiss from occluded")
        }
    }

    private fun listenForOccludedToGone() {
        if (KeyguardWmStateRefactor.isEnabled) {
            // We don't think OCCLUDED to GONE is possible. You should always have to go via a
+2 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ constructor(
    private val fromAlternateBouncerTransitionInteractor:
        dagger.Lazy<FromAlternateBouncerTransitionInteractor>,
    private val fromDozingTransitionInteractor: dagger.Lazy<FromDozingTransitionInteractor>,
    private val fromOccludedTransitionInteractor: dagger.Lazy<FromOccludedTransitionInteractor>,
    private val sceneInteractor: SceneInteractor,
) {
    private val transitionMap = mutableMapOf<Edge.StateToState, MutableSharedFlow<TransitionStep>>()
@@ -418,6 +419,7 @@ constructor(
                fromAlternateBouncerTransitionInteractor.get().dismissAlternateBouncer()
            AOD -> fromAodTransitionInteractor.get().dismissAod()
            DOZING -> fromDozingTransitionInteractor.get().dismissFromDozing()
            KeyguardState.OCCLUDED -> fromOccludedTransitionInteractor.get().dismissFromOccluded()
            KeyguardState.GONE ->
                Log.i(
                    TAG,
+20 −0
Original line number Diff line number Diff line
@@ -93,6 +93,14 @@ constructor(
                    KeyguardState.ALTERNATE_BOUNCER -> {
                        fromAlternateBouncerInteractor.surfaceBehindVisibility
                    }
                    KeyguardState.OCCLUDED -> {
                        // OCCLUDED -> GONE occurs when an app is on top of the keyguard, and then
                        // requests manual dismissal of the keyguard in the background. The app will
                        // remain visible on top of the stack throughout this transition, so we
                        // should not trigger the keyguard going away animation by returning
                        // surfaceBehindVisibility = true.
                        flowOf(false)
                    }
                    else -> flowOf(null)
                }
            }
@@ -253,6 +261,18 @@ constructor(
                    ) {
                        // Dreams dismiss keyguard and return to GONE if they can.
                        false
                    } else if (
                        startedWithPrev.newValue.from == KeyguardState.OCCLUDED &&
                            startedWithPrev.newValue.to == KeyguardState.GONE
                    ) {
                        // OCCLUDED -> GONE directly, without transiting a *_BOUNCER state, occurs
                        // when an app uses intent flags to launch over an insecure keyguard without
                        // dismissing it, and then manually requests keyguard dismissal while
                        // OCCLUDED. This transition is not user-visible; the device unlocks in the
                        // background and the app remains on top, while we're now GONE. In this case
                        // we should simply tell WM that the lockscreen is no longer visible, and
                        // *not* play the going away animation or related animations.
                        false
                    } else {
                        // Otherwise, use the visibility of the current state.
                        KeyguardState.lockscreenVisibleInState(currentState)
+1 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ val Kosmos.keyguardTransitionInteractor: KeyguardTransitionInteractor by
            fromAodTransitionInteractor = { fromAodTransitionInteractor },
            fromAlternateBouncerTransitionInteractor = { fromAlternateBouncerTransitionInteractor },
            fromDozingTransitionInteractor = { fromDozingTransitionInteractor },
            fromOccludedTransitionInteractor = { fromOccludedTransitionInteractor },
            sceneInteractor = sceneInteractor
        )
    }