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

Commit 8f3faacb authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Face interrupt polish

Let's try to authenticate more often, especifically when the user
pulls down quick settings.

Transient messages on the keyguard also be cleared if there's a
new authentication attempt.

Fixes: 128034459
Fixes: 128037051
Bug: 111414690
Test: manual with multiple biometrics on multiple device types
Change-Id: I4b231579565e6cce4604caebefc45ce20a19e903
parent 7c8b1541
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -105,11 +105,6 @@ import java.util.function.Consumer;
 * Watches for updates that may be interesting to the keyguard, and provides
 * the up to date information as well as a registration for callbacks that care
 * to be updated.
 *
 * Note: under time crunch, this has been extended to include some stuff that
 * doesn't really belong here.  see {@link #handleBatteryUpdate} where it shutdowns
 * the device, and {@link #getFailedUnlockAttempts()}, {@link #reportFailedAttempt()}
 * and {@link #clearFailedUnlockAttempts()}.  Maybe we should rename this 'KeyguardContext'...
 */
public class KeyguardUpdateMonitor implements TrustManager.TrustListener {

@@ -1568,6 +1563,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
        updateFaceListeningState();
    }

    /**
     * Requests face authentication if we're on a state where it's allowed.
     * This will re-trigger auth in case it fails.
     */
    public void requestFaceAuth() {
        if (DEBUG) Log.d(TAG, "requestFaceAuth()");
        updateFaceListeningState();
    }

    private void updateFaceListeningState() {
        // If this message exists, we should not authenticate again until this message is
        // consumed by the handler
@@ -1629,7 +1633,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
            return;
        }
        if (DEBUG) Log.v(TAG, "startListeningForFingerprint()");
        int userId = ActivityManager.getCurrentUser();
        int userId = getCurrentUser();
        if (isUnlockWithFingerprintPossible(userId)) {
            if (mFingerprintCancelSignal != null) {
                mFingerprintCancelSignal.cancel();
@@ -1647,7 +1651,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
            return;
        }
        if (DEBUG) Log.v(TAG, "startListeningForFace()");
        int userId = ActivityManager.getCurrentUser();
        int userId = getCurrentUser();
        if (isUnlockWithFacePossible(userId)) {
            if (mFaceCancelSignal != null) {
                mFaceCancelSignal.cancel();
+3 −0
Original line number Diff line number Diff line
@@ -664,6 +664,9 @@ public class KeyguardIndicationController implements StateListener {
        public void onBiometricRunningStateChanged(boolean running,
                BiometricSourceType biometricSourceType) {
            if (running) {
                // Let's hide any previous messages when authentication starts, otherwise
                // multiple auth attempts would overlap.
                hideTransientIndication();
                mMessageToShowOnScreenOn = null;
            }
        }
+6 −0
Original line number Diff line number Diff line
@@ -1217,6 +1217,12 @@ public class NotificationPanelView extends PanelView implements
        setQsExpansion(height);
        requestPanelHeightUpdate();
        mNotificationStackScroller.checkSnoozeLeavebehind();

        // When expanding QS, let's authenticate the user if possible,
        // this will speed up notification actions.
        if (height == 0) {
            mStatusBar.requestFaceAuth();
        }
    }

    private void setQsExpanded(boolean expanded) {
+9 −0
Original line number Diff line number Diff line
@@ -1315,6 +1315,15 @@ public class StatusBar extends SystemUI implements DemoMode,
        mEntryManager.updateNotifications();
    }

    /**
     * Asks {@link KeyguardUpdateMonitor} to run face auth.
     */
    public void requestFaceAuth() {
        if (!mUnlockMethodCache.canSkipBouncer()) {
            mKeyguardUpdateMonitor.requestFaceAuth();
        }
    }

    public void updateAreThereNotifications() {
        if (SPEW) {
            final boolean clearable = hasActiveNotifications() &&