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

Commit 7c09d391 authored by Ilya Matyukhin's avatar Ilya Matyukhin
Browse files

Add support for 2.2::FingerprintAcquiredInfo::START

Bug: 139317981
Test: build
Change-Id: If987a317857d9fefae675abd29ed4b822267b95a
parent d9343703
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -183,6 +183,18 @@ public interface BiometricFingerprintConstants {
     * @hide
     */
    public static final int FINGERPRINT_ACQUIRED_VENDOR = 6;

    /**
     * This message represents the earliest message sent at the beginning of the authentication
     * pipeline. It is expected to be used to measure latency. Note this should be sent whenever
     * authentication is restarted.
     * The framework will measure latency based on the time between the last START message and the
     * onAuthenticated callback.
     *
     * @hide
     */
    int FINGERPRINT_ACQUIRED_START = 7;

    /**
     * @hide
     */
+6 −1
Original line number Diff line number Diff line
@@ -918,9 +918,11 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
        if (mEnrollmentCallback != null) {
            mEnrollmentCallback.onEnrollmentHelp(clientInfo, msg);
        } else if (mAuthenticationCallback != null) {
            if (acquireInfo != BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_START) {
                mAuthenticationCallback.onAuthenticationHelp(clientInfo, msg);
            }
        }
    }

    private void sendErrorResult(long deviceId, int errMsgId, int vendorCode) {
        // emulate HAL 2.1 behavior and send real errMsgId
@@ -1050,6 +1052,9 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
                        return msgArray[vendorCode];
                    }
                }
                break;
            case FINGERPRINT_ACQUIRED_START:
                return null;
        }
        Slog.w(TAG, "Invalid acquired message: " + acquireInfo + ", " + vendorCode);
        return null;
+8 −10
Original line number Diff line number Diff line
@@ -1403,7 +1403,6 @@ public class BiometricService extends SystemService {
            return;
        }

        if (acquiredInfo != BiometricConstants.BIOMETRIC_ACQUIRED_GOOD) {
        if (message == null) {
            Slog.w(TAG, "Ignoring null message: " + acquiredInfo);
            return;
@@ -1414,7 +1413,6 @@ public class BiometricService extends SystemService {
            Slog.e(TAG, "Remote exception", e);
        }
    }
    }

    private void handleOnDismissed(int reason) {
        if (mCurrentAuthSession == null) {
+7 −2
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.content.Context;
import android.hardware.biometrics.BiometricConstants;
import android.hardware.biometrics.BiometricsProtoEnums;
import android.hardware.face.FaceManager;
import android.hardware.fingerprint.FingerprintManager;
import android.util.Slog;

import com.android.internal.util.FrameworkStatsLog;
@@ -69,8 +70,12 @@ public abstract class LoggableMonitor {

    protected final void logOnAcquired(Context context, int acquiredInfo, int vendorCode,
            int targetUserId) {
        if (statsModality() == BiometricsProtoEnums.MODALITY_FACE) {
            if (acquiredInfo == FaceManager.FACE_ACQUIRED_START) {

        final boolean isFace = statsModality() == BiometricsProtoEnums.MODALITY_FACE;
        final boolean isFingerprint = statsModality() == BiometricsProtoEnums.MODALITY_FINGERPRINT;
        if (isFace || isFingerprint) {
            if ((isFingerprint && acquiredInfo == FingerprintManager.FINGERPRINT_ACQUIRED_START)
                    || (isFace && acquiredInfo == FaceManager.FACE_ACQUIRED_START)) {
                mFirstAcquireTimeMs = System.currentTimeMillis();
            }
        } else if (acquiredInfo == BiometricConstants.BIOMETRIC_ACQUIRED_GOOD) {