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

Commit f7599ba9 authored by Beverly Tai's avatar Beverly Tai Committed by Android (Google) Code Review
Browse files

Merge "Immediately stop HBM & authRipple anim onAcquire" into tm-dev

parents b9b0374d 9996e3ac
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -298,4 +298,33 @@ public interface BiometricFingerprintConstants {
     * @hide
     */
    int FINGERPRINT_ACQUIRED_VENDOR_BASE = 1000;

    /**
     * Whether the FingerprintAcquired message is a signal to turn off HBM
     */
    static boolean shouldTurnOffHbm(@FingerprintAcquired int acquiredInfo) {
        switch (acquiredInfo) {
            case FINGERPRINT_ACQUIRED_START:
                // Authentication just began
                return false;
            case FINGERPRINT_ACQUIRED_GOOD:
                // Good image captured. Turn off HBM. Success/Reject comes after, which is when
                // hideUdfpsOverlay will be called.
                return true;
            case FINGERPRINT_ACQUIRED_PARTIAL:
            case FINGERPRINT_ACQUIRED_INSUFFICIENT:
            case FINGERPRINT_ACQUIRED_IMAGER_DIRTY:
            case FINGERPRINT_ACQUIRED_TOO_SLOW:
            case FINGERPRINT_ACQUIRED_TOO_FAST:
            case FINGERPRINT_ACQUIRED_IMMOBILE:
            case FINGERPRINT_ACQUIRED_TOO_BRIGHT:
            case FINGERPRINT_ACQUIRED_VENDOR:
                // Bad image captured. Turn off HBM. Matcher will not run, so there's no need to
                // keep HBM on.
                return true;
            case FINGERPRINT_ACQUIRED_UNKNOWN:
            default:
                return false;
        }
    }
}
+4 −3
Original line number Diff line number Diff line
@@ -28,9 +28,10 @@ oneway interface IUdfpsOverlayController {
    // Hides the overlay.
    void hideUdfpsOverlay(int sensorId);

    // Good image captured. Turn off HBM. Success/Reject comes after, which is when hideUdfpsOverlay
    // will be called.
    void onAcquiredGood(int sensorId);
    // Check acquiredInfo for the acquired type (BiometricFingerprintConstants#FingerprintAcquired).
    // Check BiometricFingerprintConstants#shouldTurnOffHbm for whether the acquiredInfo
    // should turn off HBM.
    void onAcquired(int sensorId, int acquiredInfo);

    // Notifies of enrollment progress changes.
    void onEnrollmentProgress(int sensorId, int remaining);
+6 −10
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ import android.content.pm.ResolveInfo;
import android.content.pm.UserInfo;
import android.database.ContentObserver;
import android.hardware.SensorPrivacyManager;
import android.hardware.biometrics.BiometricFingerprintConstants;
import android.hardware.biometrics.BiometricManager;
import android.hardware.biometrics.BiometricSourceType;
import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback;
@@ -752,15 +753,13 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        }
    }

    private void handleFingerprintAcquired(int acquireInfo) {
    private void handleFingerprintAcquired(
            @BiometricFingerprintConstants.FingerprintAcquired int acquireInfo) {
        Assert.isMainThread();
        if (acquireInfo != FingerprintManager.FINGERPRINT_ACQUIRED_GOOD) {
            return;
        }
        for (int i = 0; i < mCallbacks.size(); i++) {
            KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
            if (cb != null) {
                cb.onBiometricAcquired(BiometricSourceType.FINGERPRINT);
                cb.onBiometricAcquired(BiometricSourceType.FINGERPRINT, acquireInfo);
            }
        }
    }
@@ -960,14 +959,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab

    private void handleFaceAcquired(int acquireInfo) {
        Assert.isMainThread();
        if (acquireInfo != FaceManager.FACE_ACQUIRED_GOOD) {
            return;
        }
        if (DEBUG_FACE) Log.d(TAG, "Face acquired");
        if (DEBUG_FACE) Log.d(TAG, "Face acquired acquireInfo=" + acquireInfo);
        for (int i = 0; i < mCallbacks.size(); i++) {
            KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
            if (cb != null) {
                cb.onBiometricAcquired(BiometricSourceType.FACE);
                cb.onBiometricAcquired(BiometricSourceType.FACE, acquireInfo);
            }
        }
    }
+3 −1
Original line number Diff line number Diff line
@@ -206,8 +206,10 @@ public class KeyguardUpdateMonitorCallback {
     * It is guaranteed that either {@link #onBiometricAuthenticated} or
     * {@link #onBiometricAuthFailed(BiometricSourceType)} is called after this method eventually.
     * @param biometricSourceType
     * @param acquireInfo see {@link android.hardware.biometrics.BiometricFaceConstants} and
     *                    {@link android.hardware.biometrics.BiometricFingerprintConstants}
     */
    public void onBiometricAcquired(BiometricSourceType biometricSourceType) { }
    public void onBiometricAcquired(BiometricSourceType biometricSourceType, int acquireInfo) { }

    /**
     * Called when a biometric couldn't be authenticated.
+3 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.hardware.biometrics.BiometricConstants;
import android.hardware.biometrics.BiometricSourceType;
import android.os.Build;

@@ -78,7 +79,8 @@ public class LatencyTester extends CoreStartable {
    }

    private void fakeWakeAndUnlock(BiometricSourceType type) {
        mBiometricUnlockController.onBiometricAcquired(type);
        mBiometricUnlockController.onBiometricAcquired(type,
                BiometricConstants.BIOMETRIC_ACQUIRED_GOOD);
        mBiometricUnlockController.onBiometricAuthenticated(
                KeyguardUpdateMonitor.getCurrentUser(), type, true /* isStrongBiometric */);
    }
Loading