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

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

Merge "Initialize AIDL biometric HALs after BiometricService is started"

parents 88dd4d99 13161747
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -22,5 +22,5 @@ package android.hardware.iris;
 */
interface IIrisService {
    // Give IrisService its ID. See AuthService.java
    void initializeConfiguration(int sensorId);
    void initializeConfiguration(int sensorId, int strength);
}
+4 −3
Original line number Diff line number Diff line
@@ -333,7 +333,7 @@ public class AuthService extends SystemService {
                // initialization from here. AIDL HALs are initialized by FingerprintService since
                // the HAL interface provides ID, strength, and other configuration information.
                fingerprintService.initializeConfiguration(config.id, config.strength);
                authenticator = new FingerprintAuthenticator(fingerprintService, config);
                authenticator = new FingerprintAuthenticator(fingerprintService, config.id);
                break;

            case TYPE_FACE:
@@ -348,7 +348,7 @@ public class AuthService extends SystemService {
                // initialization from here. AIDL HALs are initialized by FaceService since
                // the HAL interface provides ID, strength, and other configuration information.
                faceService.initializeConfiguration(config.id, config.strength);
                authenticator = new FaceAuthenticator(faceService, config);
                authenticator = new FaceAuthenticator(faceService, config.id);
                break;

            case TYPE_IRIS:
@@ -359,7 +359,8 @@ public class AuthService extends SystemService {
                    return;
                }

                authenticator = new IrisAuthenticator(irisService, config);
                irisService.initializeConfiguration(config.id, config.strength);
                authenticator = new IrisAuthenticator(irisService, config.id);
                break;

            default:
+0 −14
Original line number Diff line number Diff line
@@ -594,20 +594,6 @@ public class BiometricService extends SystemService {
                }
            }

            // This happens infrequently enough, not worth caching.
            final String[] configs = mInjector.getConfiguration(getContext());
            boolean idFound = false;
            for (int i = 0; i < configs.length; i++) {
                SensorConfig config = new SensorConfig(configs[i]);
                if (config.id == id) {
                    idFound = true;
                    break;
                }
            }
            if (!idFound) {
                throw new IllegalStateException("Cannot register unknown id");
            }

            mSensors.add(new BiometricSensor(id, modality, strength, authenticator) {
                @Override
                boolean confirmationAlwaysRequired(int userId) {
+15 −1
Original line number Diff line number Diff line
@@ -453,7 +453,7 @@ public class Utils {
     * {@link SensorPropertiesInternal} strength.
     */
    public static @SensorProperties.Strength int authenticatorStrengthToPropertyStrength(
            @BiometricManager.Authenticators.Types int strength) {
            @Authenticators.Types int strength) {
        switch (strength) {
            case BiometricManager.Authenticators.BIOMETRIC_CONVENIENCE:
                return SensorProperties.STRENGTH_CONVENIENCE;
@@ -465,4 +465,18 @@ public class Utils {
                throw new IllegalArgumentException("Unknown strength: " + strength);
        }
    }

    public static @Authenticators.Types int propertyStrengthToAuthenticatorStrength(
            @SensorProperties.Strength int strength) {
        switch (strength) {
            case SensorProperties.STRENGTH_CONVENIENCE:
                return Authenticators.BIOMETRIC_CONVENIENCE;
            case SensorProperties.STRENGTH_WEAK:
                return Authenticators.BIOMETRIC_WEAK;
            case SensorProperties.STRENGTH_STRONG:
                return Authenticators.BIOMETRIC_STRONG;
            default:
                throw new IllegalArgumentException("Unknown strength: " + strength);
        }
    }
}
+28 −0
Original line number Diff line number Diff line
/*
 * 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.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * 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.
 */

package com.android.server.biometrics.sensors;

/**
 * System_server services that require BiometricService to load before finishing initialization
 * should implement this interface.
 */
public interface BiometricServiceCallback {
    /**
     * Notifies the service that BiometricService is initialized.
     */
    void onBiometricServiceReady();
}
Loading