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

Commit f6056566 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add logging for biometric authentication."

parents 3b1056d2 e442acfa
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.phone;

import android.content.Context;
import android.hardware.biometrics.BiometricSourceType;
import android.metrics.LogMaker;
import android.os.Handler;
import android.os.PowerManager;
import android.os.SystemClock;
@@ -26,6 +27,8 @@ import android.provider.Settings;
import android.util.Log;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.util.LatencyTracker;
import com.android.keyguard.KeyguardConstants;
import com.android.keyguard.KeyguardUpdateMonitor;
@@ -140,6 +143,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
        }
    };

    private final MetricsLogger mMetricsLogger = Dependency.get(MetricsLogger.class);

    public BiometricUnlockController(Context context,
            DozeScrimController dozeScrimController,
            KeyguardViewMediator keyguardViewMediator,
@@ -253,6 +258,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
            Trace.endSection();
            return;
        }
        mMetricsLogger.write(new LogMaker(MetricsEvent.BIOMETRIC_AUTH)
                .setType(MetricsEvent.TYPE_SUCCESS).setSubtype(toSubtype(biometricSourceType)));
        startWakeAndUnlock(calculateMode(biometricSourceType));
    }

@@ -420,12 +427,16 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {

    @Override
    public void onBiometricAuthFailed(BiometricSourceType biometricSourceType) {
        mMetricsLogger.write(new LogMaker(MetricsEvent.BIOMETRIC_AUTH)
                .setType(MetricsEvent.TYPE_FAILURE).setSubtype(toSubtype(biometricSourceType)));
        cleanup();
    }

    @Override
    public void onBiometricError(int msgId, String errString,
            BiometricSourceType biometricSourceType) {
        mMetricsLogger.write(new LogMaker(MetricsEvent.BIOMETRIC_AUTH)
                .setType(MetricsEvent.TYPE_ERROR).setSubtype(toSubtype(biometricSourceType)));
        cleanup();
    }

@@ -501,4 +512,20 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
    public boolean isBiometricUnlock() {
        return isWakeAndUnlock() || mMode == MODE_UNLOCK;
    }

    /**
     * Translates biometric source type for logging purpose.
     */
    private int toSubtype(BiometricSourceType biometricSourceType) {
        switch (biometricSourceType) {
            case FINGERPRINT:
                return 0;
            case FACE:
                return 1;
            case IRIS:
                return 2;
            default:
                return 3;
        }
    }
}
+9 −0
Original line number Diff line number Diff line
@@ -74,6 +74,9 @@ message MetricsEvent {
    // The view switched to summary mode (most relevant for notifications)
    TYPE_COLLAPSE = 14;

    // The action results an error.
    TYPE_ERROR = 15;

    // The notification was adjusted by the assistant. Enum value is
    // out of sequence due to b/122737498.
    TYPE_NOTIFICATION_ASSISTANT_ADJUSTMENT = 1573;
@@ -7138,6 +7141,12 @@ message MetricsEvent {
    // OS: Q
    DISPLAY_POLICY = 1696;

    // Biometric authentication.
    //    TYPE: SUCCESS, FAILURE or ERROR
    //    SUBTYPE: 0 is fingerprint, 1 is face, 2 is iris and 3 is unknown.
    // OS: Q
    BIOMETRIC_AUTH = 1697;

    // ---- End Q Constants, all Q constants go above this line ----
    // Add new aosp constants above this line.
    // END OF AOSP CONSTANTS