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

Commit fa43d339 authored by Beverly Tai's avatar Beverly Tai Committed by Automerger Merge Worker
Browse files

Merge "Dismiss the keyguard through #notifyKeyguardAuthentiated" into udc-dev am: 8dca2f6b

parents 7a00f665 8dca2f6b
Loading
Loading
Loading
Loading
+10 −10
Original line number Original line Diff line number Diff line
@@ -257,14 +257,14 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
         * Authentication has happened and it's time to dismiss keyguard. This function
         * Authentication has happened and it's time to dismiss keyguard. This function
         * should clean up and inform KeyguardViewMediator.
         * should clean up and inform KeyguardViewMediator.
         *
         *
         * @param strongAuth whether the user has authenticated with strong authentication like
         * @param fromPrimaryAuth whether the user has authenticated with primary auth like
         *                   pattern, password or PIN but not by trust agents or fingerprint
         *                   pattern, password or PIN but not by trust agents or fingerprint
         * @param targetUserId a user that needs to be the foreground user at the dismissal
         * @param targetUserId a user that needs to be the foreground user at the dismissal
         *                    completion.
         *                    completion.
         */
         */
        @Override
        @Override
        public void finish(boolean strongAuth, int targetUserId) {
        public void finish(boolean fromPrimaryAuth, int targetUserId) {
            if (!mKeyguardStateController.canDismissLockScreen() && !strongAuth) {
            if (!mKeyguardStateController.canDismissLockScreen() && !fromPrimaryAuth) {
                Log.e(TAG,
                Log.e(TAG,
                        "Tried to dismiss keyguard when lockscreen is not dismissible and user "
                        "Tried to dismiss keyguard when lockscreen is not dismissible and user "
                                + "was not authenticated with a primary security method "
                                + "was not authenticated with a primary security method "
@@ -283,9 +283,9 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
            }
            }
            if (mViewMediatorCallback != null) {
            if (mViewMediatorCallback != null) {
                if (deferKeyguardDone) {
                if (deferKeyguardDone) {
                    mViewMediatorCallback.keyguardDonePending(strongAuth, targetUserId);
                    mViewMediatorCallback.keyguardDonePending(fromPrimaryAuth, targetUserId);
                } else {
                } else {
                    mViewMediatorCallback.keyguardDone(strongAuth, targetUserId);
                    mViewMediatorCallback.keyguardDone(fromPrimaryAuth, targetUserId);
                }
                }
            }
            }
        }
        }
@@ -603,8 +603,8 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
    /**
    /**
     * Dismiss keyguard due to a user unlock event.
     * Dismiss keyguard due to a user unlock event.
     */
     */
    public void finish(boolean strongAuth, int currentUser) {
    public void finish(boolean primaryAuth, int currentUser) {
        mKeyguardSecurityCallback.finish(strongAuth, currentUser);
        mKeyguardSecurityCallback.finish(primaryAuth, currentUser);
    }
    }


    /**
    /**
@@ -736,7 +736,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
        }
        }


        boolean finish = false;
        boolean finish = false;
        boolean strongAuth = false;
        boolean primaryAuth = false;
        int eventSubtype = -1;
        int eventSubtype = -1;
        BouncerUiEvent uiEvent = BouncerUiEvent.UNKNOWN;
        BouncerUiEvent uiEvent = BouncerUiEvent.UNKNOWN;
        if (mUpdateMonitor.getUserHasTrust(targetUserId)) {
        if (mUpdateMonitor.getUserHasTrust(targetUserId)) {
@@ -761,7 +761,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
                case Pattern:
                case Pattern:
                case Password:
                case Password:
                case PIN:
                case PIN:
                    strongAuth = true;
                    primaryAuth = true;
                    finish = true;
                    finish = true;
                    eventSubtype = BOUNCER_DISMISS_PASSWORD;
                    eventSubtype = BOUNCER_DISMISS_PASSWORD;
                    uiEvent = BouncerUiEvent.BOUNCER_DISMISS_PASSWORD;
                    uiEvent = BouncerUiEvent.BOUNCER_DISMISS_PASSWORD;
@@ -805,7 +805,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
            mUiEventLogger.log(uiEvent, getSessionId());
            mUiEventLogger.log(uiEvent, getSessionId());
        }
        }
        if (finish) {
        if (finish) {
            mKeyguardSecurityCallback.finish(strongAuth, targetUserId);
            mKeyguardSecurityCallback.finish(primaryAuth, targetUserId);
        }
        }
        return finish;
        return finish;
    }
    }
+2 −2
Original line number Original line Diff line number Diff line
@@ -893,7 +893,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
    }
    }


    @VisibleForTesting
    @VisibleForTesting
    protected void onFingerprintAuthenticated(int userId, boolean isStrongBiometric) {
    public void onFingerprintAuthenticated(int userId, boolean isStrongBiometric) {
        Assert.isMainThread();
        Assert.isMainThread();
        Trace.beginSection("KeyGuardUpdateMonitor#onFingerPrintAuthenticated");
        Trace.beginSection("KeyGuardUpdateMonitor#onFingerPrintAuthenticated");
        mUserFingerprintAuthenticated.put(userId,
        mUserFingerprintAuthenticated.put(userId,
@@ -1169,7 +1169,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
    }
    }


    @VisibleForTesting
    @VisibleForTesting
    protected void onFaceAuthenticated(int userId, boolean isStrongBiometric) {
    public void onFaceAuthenticated(int userId, boolean isStrongBiometric) {
        Trace.beginSection("KeyGuardUpdateMonitor#onFaceAuthenticated");
        Trace.beginSection("KeyGuardUpdateMonitor#onFaceAuthenticated");
        Assert.isMainThread();
        Assert.isMainThread();
        mUserFaceAuthenticated.put(userId,
        mUserFaceAuthenticated.put(userId,
+4 −4
Original line number Original line Diff line number Diff line
@@ -29,11 +29,11 @@ public interface ViewMediatorCallback {
    /**
    /**
     * Report that the keyguard is done.
     * Report that the keyguard is done.
     *
     *
     * @param strongAuth whether the user has authenticated with strong authentication like
     * @param primaryAuth whether the user has authenticated with primary authentication like
     *                   pattern, password or PIN but not by trust agents or fingerprint
     *                   pattern, password or PIN but not by trust agents or fingerprint
     * @param targetUserId a user that needs to be the foreground user at the completion.
     * @param targetUserId a user that needs to be the foreground user at the completion.
     */
     */
    void keyguardDone(boolean strongAuth, int targetUserId);
    void keyguardDone(boolean primaryAuth, int targetUserId);


    /**
    /**
     * Report that the keyguard is done drawing.
     * Report that the keyguard is done drawing.
@@ -49,11 +49,11 @@ public interface ViewMediatorCallback {
    /**
    /**
     * Report that the keyguard is dismissable, pending the next keyguardDone call.
     * Report that the keyguard is dismissable, pending the next keyguardDone call.
     *
     *
     * @param strongAuth whether the user has authenticated with strong authentication like
     * @param primaryAuth whether the user has authenticated with primary authentication like
     *                   pattern, password or PIN but not by trust agents or fingerprint
     *                   pattern, password or PIN but not by trust agents or fingerprint
     * @param targetUserId a user that needs to be the foreground user at the completion.
     * @param targetUserId a user that needs to be the foreground user at the completion.
     */
     */
    void keyguardDonePending(boolean strongAuth, int targetUserId);
    void keyguardDonePending(boolean primaryAuth, int targetUserId);


    /**
    /**
     * Report when keyguard is actually gone
     * Report when keyguard is actually gone
+11 −6
Original line number Original line Diff line number Diff line
@@ -20,7 +20,6 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentFilter;
import android.hardware.biometrics.BiometricConstants;
import android.hardware.biometrics.BiometricSourceType;
import android.hardware.biometrics.BiometricSourceType;
import android.os.Build;
import android.os.Build;
import android.provider.DeviceConfig;
import android.provider.DeviceConfig;
@@ -57,6 +56,7 @@ public class LatencyTester implements CoreStartable {
    private final BiometricUnlockController mBiometricUnlockController;
    private final BiometricUnlockController mBiometricUnlockController;
    private final BroadcastDispatcher mBroadcastDispatcher;
    private final BroadcastDispatcher mBroadcastDispatcher;
    private final DeviceConfigProxy mDeviceConfigProxy;
    private final DeviceConfigProxy mDeviceConfigProxy;
    private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;


    private boolean mEnabled;
    private boolean mEnabled;


@@ -65,11 +65,13 @@ public class LatencyTester implements CoreStartable {
            BiometricUnlockController biometricUnlockController,
            BiometricUnlockController biometricUnlockController,
            BroadcastDispatcher broadcastDispatcher,
            BroadcastDispatcher broadcastDispatcher,
            DeviceConfigProxy deviceConfigProxy,
            DeviceConfigProxy deviceConfigProxy,
            @Main DelayableExecutor mainExecutor
            @Main DelayableExecutor mainExecutor,
            KeyguardUpdateMonitor keyguardUpdateMonitor
    ) {
    ) {
        mBiometricUnlockController = biometricUnlockController;
        mBiometricUnlockController = biometricUnlockController;
        mBroadcastDispatcher = broadcastDispatcher;
        mBroadcastDispatcher = broadcastDispatcher;
        mDeviceConfigProxy = deviceConfigProxy;
        mDeviceConfigProxy = deviceConfigProxy;
        mKeyguardUpdateMonitor = keyguardUpdateMonitor;


        updateEnabled();
        updateEnabled();
        mDeviceConfigProxy.addOnPropertiesChangedListener(DeviceConfig.NAMESPACE_LATENCY_TRACKER,
        mDeviceConfigProxy.addOnPropertiesChangedListener(DeviceConfig.NAMESPACE_LATENCY_TRACKER,
@@ -85,10 +87,13 @@ public class LatencyTester implements CoreStartable {
        if (!mEnabled) {
        if (!mEnabled) {
            return;
            return;
        }
        }
        mBiometricUnlockController.onBiometricAcquired(type,
        if (type == BiometricSourceType.FACE) {
                BiometricConstants.BIOMETRIC_ACQUIRED_GOOD);
            mKeyguardUpdateMonitor.onFaceAuthenticated(KeyguardUpdateMonitor.getCurrentUser(),
        mBiometricUnlockController.onBiometricAuthenticated(
                    true);
                KeyguardUpdateMonitor.getCurrentUser(), type, true /* isStrongBiometric */);
        } else if (type == BiometricSourceType.FINGERPRINT) {
            mKeyguardUpdateMonitor.onFingerprintAuthenticated(
                    KeyguardUpdateMonitor.getCurrentUser(), true);
        }
    }
    }


    private void registerForBroadcasts(boolean register) {
    private void registerForBroadcasts(boolean register) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -466,7 +466,7 @@ public class UdfpsController implements DozeReceiver, Dumpable {
        if (!mOnFingerDown) {
        if (!mOnFingerDown) {
            playStartHaptic();
            playStartHaptic();
        }
        }
        mKeyguardViewManager.notifyKeyguardAuthenticated(false /* strongAuth */);
        mKeyguardViewManager.notifyKeyguardAuthenticated(false /* primaryAuth */);
        mAttemptedToDismissKeyguard = true;
        mAttemptedToDismissKeyguard = true;
    }
    }


Loading