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

Commit c05ce8e7 authored by Lucas Dupin's avatar Lucas Dupin Committed by android-build-merger
Browse files

Merge "Wake-and-unlock imprevements" into qt-r1-dev

am: 4a082153

Change-Id: I77ee856726f9e3ce932115c77733c405e55a2bf9
parents d0e31406 4a082153
Loading
Loading
Loading
Loading
+23 −19
Original line number Diff line number Diff line
@@ -83,16 +83,10 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
     */
    public static final int MODE_UNLOCK = 5;

    /**
     * Mode in which fingerprint brings up the bouncer because fingerprint unlocking is currently
     * not allowed.
     */
    public static final int MODE_DISMISS_BOUNCER = 6;

    /**
     * Mode in which fingerprint wakes and unlocks the device from a dream.
     */
    public static final int MODE_WAKE_AND_UNLOCK_FROM_DREAM = 7;
    public static final int MODE_WAKE_AND_UNLOCK_FROM_DREAM = 6;

    /**
     * How much faster we collapse the lockscreen when authenticating with biometric.
@@ -283,15 +277,18 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
            wakeUp.run();
        }
        switch (mMode) {
            case MODE_DISMISS_BOUNCER:
                Trace.beginSection("MODE_DISMISS");
            case MODE_UNLOCK:
                Trace.beginSection("MODE_UNLOCK");
                if (!wasDeviceInteractive) {
                    mPendingShowBouncer = true;
                } else {
                    mStatusBarKeyguardViewManager.notifyKeyguardAuthenticated(
                            false /* strongAuth */);
                }
                Trace.endSection();
                break;
            case MODE_UNLOCK:
            case MODE_SHOW_BOUNCER:
                Trace.beginSection("MODE_UNLOCK or MODE_SHOW_BOUNCER");
                Trace.beginSection("MODE_SHOW_BOUNCER");
                if (!wasDeviceInteractive) {
                    mPendingShowBouncer = true;
                } else {
@@ -381,6 +378,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
            if (!mStatusBarKeyguardViewManager.isShowing()) {
                return MODE_ONLY_WAKE;
            } else if (mDozeScrimController.isPulsing() && unlockingAllowed) {
                // Let's not wake-up to lock screen when not bypassing, otherwise the notification
                // would move as the user tried to tap it.
                return faceStayingOnKeyguard ? MODE_NONE : MODE_WAKE_AND_UNLOCK_PULSING;
            } else if (!face && (unlockingAllowed || !mUnlockMethodCache.isMethodSecure())) {
                return MODE_WAKE_AND_UNLOCK;
@@ -388,9 +387,15 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
                if (!(mDozeScrimController.isPulsing() && !unlockingAllowed)) {
                    Log.wtf(TAG, "Face somehow arrived when the device was not interactive");
                }
                if (faceStayingOnKeyguard) {
                    // We could theoretically return MODE_NONE, but this means that the device
                // would be not interactive, unlocked, and the user would not see the device state.
                    // would be not interactive, unlocked, and the user would not see the device
                    // state.
                    return MODE_ONLY_WAKE;
                } else {
                    // Wake-up fading out nicely
                    return MODE_WAKE_AND_UNLOCK_PULSING;
                }
            } else {
                return MODE_SHOW_BOUNCER;
            }
@@ -399,10 +404,9 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
            return MODE_WAKE_AND_UNLOCK_FROM_DREAM;
        }
        if (mStatusBarKeyguardViewManager.isShowing()) {
            if ((mStatusBarKeyguardViewManager.isBouncerShowing()
                    || mStatusBarKeyguardViewManager.isBouncerPartiallyVisible())
            if ((mStatusBarKeyguardViewManager.isBouncerShowing())
                    && unlockingAllowed) {
                return MODE_DISMISS_BOUNCER;
                return MODE_UNLOCK;
            } else if (unlockingAllowed) {
                return faceStayingOnKeyguard ? MODE_ONLY_WAKE : MODE_UNLOCK;
            } else if (face) {
+0 −5
Original line number Diff line number Diff line
@@ -345,11 +345,6 @@ public class KeyguardBouncer {
                && mExpansion == EXPANSION_VISIBLE && !isAnimatingAway();
    }

    public boolean isPartiallyVisible() {
        return (mShowingSoon || (mRoot != null && mRoot.getVisibility() == View.VISIBLE))
                && mExpansion != EXPANSION_HIDDEN && !isAnimatingAway();
    }

    /**
     * @return {@code true} when bouncer's pre-hide animation already started but isn't completely
     *         hidden yet, {@code false} otherwise.
+2 −1
Original line number Diff line number Diff line
@@ -452,7 +452,8 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange

    private int getState() {
        KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
        if ((mUnlockMethodCache.canSkipBouncer() || !mKeyguardShowing) && !mSimLocked) {
        if ((mUnlockMethodCache.canSkipBouncer() || !mKeyguardShowing
                || mKeyguardMonitor.isKeyguardGoingAway()) && !mSimLocked) {
            return STATE_LOCK_OPEN;
        } else if (mTransientBiometricsError) {
            return STATE_BIOMETRICS_ERROR;
+0 −4
Original line number Diff line number Diff line
@@ -677,10 +677,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
        return mBouncer.isShowing();
    }

    public boolean isBouncerPartiallyVisible() {
        return mBouncer.isPartiallyVisible();
    }

    public boolean isFullscreenBouncer() {
        return mBouncer.isFullscreenBouncer();
    }
+2 −2
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
                BiometricSourceType.FINGERPRINT);

        verify(mStatusBarKeyguardViewManager, never()).showBouncer(anyBoolean());
        verify(mStatusBarKeyguardViewManager).animateCollapsePanels(anyFloat());
        verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(eq(false));
    }

    @Test
@@ -151,7 +151,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
        mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT,
                BiometricSourceType.FACE);

        verify(mStatusBarKeyguardViewManager).animateCollapsePanels(anyFloat());
        verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(eq(false));
    }

    @Test