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

Commit 8486a28f authored by Josh Tsuji's avatar Josh Tsuji Committed by Automerger Merge Worker
Browse files

Merge "Ensure the keyguard is force-shown after a power off/on during unlock."...

Merge "Ensure the keyguard is force-shown after a power off/on during unlock." into udc-qpr-dev am: 690cde69 am: de159db9

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24719457



Change-Id: I6f21e3a413a7a0e68a056d7b2c5e717c8ec377d4
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 1e5c9556 de159db9
Loading
Loading
Loading
Loading
+33 −19
Original line number Diff line number Diff line
@@ -2208,14 +2208,21 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
        // we explicitly re-set state.
        if (mShowing && mKeyguardStateController.isShowing()) {
            if (mPM.isInteractive() && !mHiding) {
                // It's already showing, and we're not trying to show it while the screen is off.
                // We can simply reset all of the views, but don't hide the bouncer in case the user
                // is currently interacting with it.
                if (DEBUG) Log.d(TAG, "doKeyguard: not showing (instead, resetting) because it is "
                        + "already showing, we're interactive, and we were not previously hiding. "
                        + "It should be safe to short-circuit here.");
                if (mKeyguardStateController.isKeyguardGoingAway()) {
                    Log.e(TAG, "doKeyguard: we're still showing, but going away. Re-show the "
                            + "keyguard rather than short-circuiting and resetting.");
                } else {
                    // It's already showing, and we're not trying to show it while the screen is
                    // off. We can simply reset all of the views, but don't hide the bouncer in case
                    // the user is currently interacting with it.
                    if (DEBUG) Log.d(TAG,
                            "doKeyguard: not showing (instead, resetting) because it is "
                                    + "already showing, we're interactive, we were not "
                                    + "previously hiding. It should be safe to short-circuit "
                                    + "here.");
                    resetStateLocked(/* hideBouncer= */ false);
                    return;
                }
            } else {
                // We are trying to show the keyguard while the screen is off or while we were in
                // the middle of hiding - this results from race conditions involving locking while
@@ -2740,13 +2747,18 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
            setUnlockAndWakeFromDream(false, WakeAndUnlockUpdateReason.SHOW);
            setPendingLock(false);

            // Force if we we're showing in the middle of hiding, to ensure we end up in the correct
            // state.
            setShowingLocked(true, mHiding /* force */);
            if (mHiding) {
                Log.d(TAG, "Forcing setShowingLocked because mHiding=true, which means we're "
                        + "showing in the middle of hiding.");
            final boolean hidingOrGoingAway =
                    mHiding || mKeyguardStateController.isKeyguardGoingAway();
            if (hidingOrGoingAway) {
                Log.d(TAG, "Forcing setShowingLocked because one of these is true:"
                        + "mHiding=" + mHiding
                        + ", keyguardGoingAway=" + mKeyguardStateController.isKeyguardGoingAway()
                        + ", which means we're showing in the middle of hiding.");
            }

            // Force if we we're showing in the middle of unlocking, to ensure we end up in the
            // correct state.
            setShowingLocked(true, hidingOrGoingAway /* force */);
            mHiding = false;

            if (!mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) {
@@ -2954,7 +2966,6 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
        Log.d(TAG, "handleStartKeyguardExitAnimation startTime=" + startTime
                + " fadeoutDuration=" + fadeoutDuration);
        synchronized (KeyguardViewMediator.this) {

            // Tell ActivityManager that we canceled the keyguard animation if
            // handleStartKeyguardExitAnimation was called, but we're not hiding the keyguard,
            // unless we're animating the surface behind the keyguard and will be hiding the
@@ -3222,10 +3233,13 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,

        // Post layout changes to the next frame, so we don't hang at the end of the animation.
        DejankUtils.postAfterTraversal(() -> {
            if (!mPM.isInteractive()) {
                Log.e(TAG, "exitKeyguardAndFinishSurfaceBehindRemoteAnimation#postAfterTraversal" +
                        "Not interactive after traversal. Don't hide the keyguard. This means we " +
                        "re-locked the device during unlock.");
            if (!mPM.isInteractive() && !mPendingLock) {
                Log.e(TAG, "exitKeyguardAndFinishSurfaceBehindRemoteAnimation#postAfterTraversal:"
                        + "mPM.isInteractive()=" + mPM.isInteractive()
                        + "mPendingLock=" + mPendingLock + "."
                        + "One of these being false means we re-locked the device during unlock. "
                        + "Do not proceed to finish keyguard exit and unlock.");
                finishSurfaceBehindRemoteAnimation(true /* showKeyguard */);
                return;
            }