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

Commit e42d180a authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Prevent UnlockAnimationController from dismissing keyguard..." into main

parents 50b843da b8c444b9
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -3428,6 +3428,12 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
            return;
        }

        if (mIsKeyguardExitAnimationCanceled) {
            Log.d(TAG, "Ignoring exitKeyguardAndFinishSurfaceBehindRemoteAnimation. "
                    + "mIsKeyguardExitAnimationCanceled==true");
            return;
        }

        // Block the panel from expanding, in case we were doing a swipe to dismiss gesture.
        mKeyguardViewControllerLazy.get().blockPanelExpansionFromCurrentTouch();
        final boolean wasShowing = mShowing;
+28 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STR
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_NON_STRONG_BIOMETRICS_TIMEOUT;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN;
import static com.android.systemui.Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR;
import static com.android.systemui.Flags.FLAG_RELOCK_WITH_POWER_BUTTON_IMMEDIATELY;
import static com.android.systemui.Flags.FLAG_SIM_PIN_BOUNCER_RESET;
import static com.android.systemui.keyguard.KeyguardViewMediator.DELAYED_KEYGUARD_ACTION;
import static com.android.systemui.keyguard.KeyguardViewMediator.KEYGUARD_LOCK_AFTER_DELAY_DEFAULT;
@@ -63,6 +64,7 @@ import android.content.Context;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.os.RemoteException;
import android.platform.test.annotations.DisableFlags;
import android.platform.test.annotations.EnableFlags;
import android.telephony.TelephonyManager;
import android.testing.AndroidTestingRunner;
@@ -841,6 +843,32 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {

    @Test
    @TestableLooper.RunWithLooper(setAsMainLooper = true)
    @EnableFlags(FLAG_RELOCK_WITH_POWER_BUTTON_IMMEDIATELY)
    public void testCancelKeyguardExitAnimationDueToSleep_withPendingLockAndRelockFlag_keyguardWillBeShowing() {
        startMockKeyguardExitAnimation();

        mViewMediator.onStartedGoingToSleep(PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON);
        mViewMediator.onFinishedGoingToSleep(PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, false);

        cancelMockKeyguardExitAnimation();

        mViewMediator.maybeHandlePendingLock();
        TestableLooper.get(this).processAllMessages();

        assertTrue(mViewMediator.isShowingAndNotOccluded());

        verify(mKeyguardUnlockAnimationController).notifyFinishedKeyguardExitAnimation(true);

        // Unlock animators call `exitKeyguardAndFinishSurfaceBehindRemoteAnimation` when canceled
        mViewMediator.exitKeyguardAndFinishSurfaceBehindRemoteAnimation(false);
        TestableLooper.get(this).processAllMessages();

        verify(mUpdateMonitor, never()).dispatchKeyguardDismissAnimationFinished();
    }

    @Test
    @TestableLooper.RunWithLooper(setAsMainLooper = true)
    @DisableFlags(FLAG_RELOCK_WITH_POWER_BUTTON_IMMEDIATELY)
    public void testCancelKeyguardExitAnimationDueToSleep_withPendingLock_keyguardWillBeShowing() {
        startMockKeyguardExitAnimation();