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

Commit 2a4f86be authored by Kevin Chyn's avatar Kevin Chyn
Browse files

Revert "Update face detectInteraction"

This reverts commit 5b0dd45a.

Reason for revert: b/184978217?

Change-Id: Ie92632f0373376f238eac5638aba71a1a31abdcf
parent 5b0dd45a
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -96,7 +96,6 @@ public class FaceSensorPropertiesInternal extends SensorPropertiesInternal {

    @Override
    public String toString() {
        return "ID: " + sensorId + ", Strength: " + sensorStrength + ", Type: " + sensorType
                + ", SupportsFaceDetection: " + supportsFaceDetection;
        return "ID: " + sensorId + ", Strength: " + sensorStrength + ", Type: " + sensorType;
    }
}
+2 −8
Original line number Diff line number Diff line
@@ -2131,14 +2131,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab

        // Scan even when encrypted or timeout to show a preemptive bouncer when bypassing.
        // Lock-down mode shouldn't scan, since it is more explicit.
        boolean strongAuthAllowsScanning = (!isEncryptedOrTimedOut || canBypass && !mBouncer);

        // If the device supports face detection (without authentication), allow it to happen
        // if the device is in lockdown mode. Otherwise, prevent scanning.
        boolean supportsDetectOnly = mFaceSensorProperties.get(0).supportsFaceDetection;
        if (isLockDown && !supportsDetectOnly) {
            strongAuthAllowsScanning = false;
        }
        boolean strongAuthAllowsScanning = (!isEncryptedOrTimedOut || canBypass && !mBouncer)
                && !isLockDown;

        // Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an
        // instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
+3 −15
Original line number Diff line number Diff line
@@ -19,13 +19,10 @@ package com.android.server.biometrics;
import static android.hardware.biometrics.BiometricManager.Authenticators;

import android.annotation.IntDef;
import android.annotation.NonNull;
import android.content.Context;
import android.hardware.biometrics.BiometricConstants;
import android.hardware.biometrics.BiometricManager;
import android.hardware.biometrics.IBiometricAuthenticator;
import android.hardware.biometrics.IBiometricSensorReceiver;
import android.hardware.biometrics.SensorPropertiesInternal;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Slog;
@@ -65,7 +62,6 @@ public abstract class BiometricSensor {
    @Retention(RetentionPolicy.SOURCE)
    @interface SensorState {}

    @NonNull private final Context mContext;
    public final int id;
    public final @Authenticators.Types int oemStrength; // strength as configured by the OEM
    public final int modality;
@@ -88,9 +84,8 @@ public abstract class BiometricSensor {
     */
    abstract boolean confirmationSupported();

    BiometricSensor(@NonNull Context context, int id, int modality,
            @Authenticators.Types int strength, IBiometricAuthenticator impl) {
        this.mContext = context;
    BiometricSensor(int id, int modality, @Authenticators.Types int strength,
            IBiometricAuthenticator impl) {
        this.id = id;
        this.modality = modality;
        this.oemStrength = strength;
@@ -174,19 +169,12 @@ public abstract class BiometricSensor {

    @Override
    public String toString() {
        SensorPropertiesInternal properties = null;
        try {
            properties = impl.getSensorProperties(mContext.getOpPackageName());
        } catch (RemoteException e) {
            Slog.e(TAG, "Remote exception", e);
        }

        return "ID(" + id + ")"
                + ", oemStrength: " + oemStrength
                + ", updatedStrength: " + mUpdatedStrength
                + ", modality " + modality
                + ", state: " + mSensorState
                + ", cookie: " + mCookie
                + ", props: " + properties;
                + ", authenticator: " + impl;
    }
}
+8 −3
Original line number Diff line number Diff line
@@ -725,7 +725,7 @@ public class BiometricService extends SystemService {
                }
            }

            mSensors.add(new BiometricSensor(getContext(), id, modality, strength, authenticator) {
            mSensors.add(new BiometricSensor(id, modality, strength, authenticator) {
                @Override
                boolean confirmationAlwaysRequired(int userId) {
                    return mSettingObserver.getConfirmationAlwaysRequired(modality, userId);
@@ -1351,8 +1351,13 @@ public class BiometricService extends SystemService {
        for (BiometricSensor sensor : mSensors) {
            pw.println(" " + sensor);
        }
        pw.println();
        pw.println("CurrentSession: " + mCurrentAuthSession);
        pw.println();

        final List<FingerprintSensorPropertiesInternal> fpProps =
                mInjector.getFingerprintSensorProperties(getContext());
        pw.println("FingerprintSensorProperties: " + fpProps.size());
        for (FingerprintSensorPropertiesInternal prop : fpProps) {
            pw.println(" " + prop);
        }
    }
}
+8 −14
Original line number Diff line number Diff line
@@ -559,21 +559,22 @@ public class BiometricScheduler {
    }

    /**
     * Requests to cancel authentication or detection.
     * Requests to cancel authentication.
     * @param token from the caller, should match the token passed in when requesting authentication
     */
    public void cancelAuthenticationOrDetection(IBinder token) {
    public void cancelAuthentication(IBinder token) {
        if (mCurrentOperation == null) {
            Slog.e(getTag(), "Unable to cancel authentication, null operation");
            return;
        }
        final boolean isCorrectClient = isAuthenticationOrDetectionOperation(mCurrentOperation);
        final boolean isAuthenticating =
                mCurrentOperation.mClientMonitor instanceof AuthenticationConsumer;
        final boolean tokenMatches = mCurrentOperation.mClientMonitor.getToken() == token;

        if (isCorrectClient && tokenMatches) {
            Slog.d(getTag(), "Cancelling: " + mCurrentOperation);
        if (isAuthenticating && tokenMatches) {
            Slog.d(getTag(), "Cancelling authentication: " + mCurrentOperation);
            cancelInternal(mCurrentOperation);
        } else if (!isCorrectClient) {
        } else if (!isAuthenticating) {
            // Look through the current queue for all authentication clients for the specified
            // token, and mark them as STATE_WAITING_IN_QUEUE_CANCELING. Note that we're marking
            // all of them, instead of just the first one, since the API surface currently doesn't
@@ -581,7 +582,7 @@ public class BiometricScheduler {
            // process. However, this generally does not happen anyway, and would be a class of
            // bugs on its own.
            for (Operation operation : mPendingOperations) {
                if (isAuthenticationOrDetectionOperation(operation)
                if (operation.mClientMonitor instanceof AuthenticationConsumer
                        && operation.mClientMonitor.getToken() == token) {
                    Slog.d(getTag(), "Marking " + operation
                            + " as STATE_WAITING_IN_QUEUE_CANCELING");
@@ -591,13 +592,6 @@ public class BiometricScheduler {
        }
    }

    private boolean isAuthenticationOrDetectionOperation(@NonNull Operation operation) {
        final boolean isAuthentication = operation.mClientMonitor
                instanceof AuthenticationConsumer;
        final boolean isDetection = operation.mClientMonitor instanceof DetectionConsumer;
        return isAuthentication || isDetection;
    }

    /**
     * @return the current operation
     */
Loading