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

Commit 77f92351 authored by Kevin Chyn's avatar Kevin Chyn
Browse files

1/n: Move modality-specific files into new subdirectory

It's easier to read/maintain if we separate sensor-specific code
from BiometricPrompt/BiometricManager code

Bug: 157790417

Test: Enroll/auth fingerprint/face on respective devices
Test: atest com.android.server.biometrics

Change-Id: I472c206743482bbea75498051c6f81e1fbd351ad
parent 84f162af
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -49,9 +49,9 @@ import android.util.Slog;
import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.server.SystemService;
import com.android.server.biometrics.face.FaceAuthenticator;
import com.android.server.biometrics.fingerprint.FingerprintAuthenticator;
import com.android.server.biometrics.iris.IrisAuthenticator;
import com.android.server.biometrics.sensors.face.FaceAuthenticator;
import com.android.server.biometrics.sensors.fingerprint.FingerprintAuthenticator;
import com.android.server.biometrics.sensors.iris.IrisAuthenticator;

/**
 * System service that provides an interface for authenticating with biometrics and
+6 −5
Original line number Diff line number Diff line
@@ -51,8 +51,9 @@ import java.util.Random;
 * {@link android.hardware.biometrics.BiometricPrompt}, as well as all of the necessary
 * state information for such a session.
 */
final class AuthSession implements IBinder.DeathRecipient {
public final class AuthSession implements IBinder.DeathRecipient {
    private static final String TAG = "BiometricService/AuthSession";
    private static final boolean DEBUG = false;

    /**
     * Authentication either just called and we have not transitioned to the CALLED state, or
@@ -554,8 +555,8 @@ final class AuthSession implements IBinder.DeathRecipient {
            // should have the first half (first acquired -> authenticated).
            final long latency = System.currentTimeMillis() - mAuthenticatedTimeMs;

            if (LoggableMonitor.DEBUG) {
                Slog.v(LoggableMonitor.TAG, "Confirmed! Modality: " + statsModality()
            if (DEBUG) {
                Slog.v(TAG, "Confirmed! Modality: " + statsModality()
                        + ", User: " + mUserId
                        + ", IsCrypto: " + isCrypto()
                        + ", Client: " + BiometricsProtoEnums.CLIENT_BIOMETRIC_PROMPT
@@ -581,8 +582,8 @@ final class AuthSession implements IBinder.DeathRecipient {
                    : reason == BiometricPrompt.DISMISSED_REASON_USER_CANCEL
                            ? BiometricConstants.BIOMETRIC_ERROR_USER_CANCELED
                            : 0;
            if (LoggableMonitor.DEBUG) {
                Slog.v(LoggableMonitor.TAG, "Dismissed! Modality: " + statsModality()
            if (DEBUG) {
                Slog.v(TAG, "Dismissed! Modality: " + statsModality()
                        + ", User: " + mUserId
                        + ", IsCrypto: " + isCrypto()
                        + ", Action: " + BiometricsProtoEnums.ACTION_AUTHENTICATE
+2 −2
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ import android.provider.Settings;
import android.util.Slog;

public class Utils {
    static boolean isDebugEnabled(Context context, int targetUserId) {
    public static boolean isDebugEnabled(Context context, int targetUserId) {
        if (targetUserId == UserHandle.USER_NULL) {
            return false;
        }
@@ -136,7 +136,7 @@ public class Utils {
     * @param requestedStrength the strength that it must meet
     * @return true only if the sensor is at least as strong as the requested strength
     */
    static boolean isAtLeastStrength(int sensorStrength, int requestedStrength) {
    public static boolean isAtLeastStrength(int sensorStrength, int requestedStrength) {
        // Clear out any bits that are not reserved for biometric
        sensorStrength &= Authenticators.BIOMETRIC_MIN_STRENGTH;

+3 −3
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -11,10 +11,10 @@
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License
 * limitations under the License.
 */

package com.android.server.biometrics;
package com.android.server.biometrics.sensors;

import android.content.Context;
import android.hardware.biometrics.BiometricAuthenticator;
+3 −2
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

package com.android.server.biometrics;
package com.android.server.biometrics.sensors;

import static android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND_SERVICE;
import static android.hardware.biometrics.BiometricConstants.BIOMETRIC_ERROR_HW_UNAVAILABLE;
@@ -60,6 +60,7 @@ import com.android.internal.logging.MetricsLogger;
import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.util.FrameworkStatsLog;
import com.android.server.SystemService;
import com.android.server.biometrics.Utils;

import java.util.ArrayList;
import java.util.Collections;
Loading