diff options
| author | Ilya Matyukhin <ilyamaty@google.com> | 2021-04-27 17:50:35 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-04-27 17:50:35 +0000 |
| commit | bbddf477af4b7f10605e8f41bf56af286164fa66 (patch) | |
| tree | c8b4c3c13a2db93766b112d5c4ee2870b0d70830 /core/java | |
| parent | 909042e9a4dfe0925f21886ac8e99dcb447a1662 (diff) | |
| parent | 06f04c041cf65b19cbf736852996760b1284124c (diff) | |
Merge changes I165d67bd,I4442db15 into sc-dev
* changes:
Notify AuthController when fingerprint providers are ready
Consolidate registration of HIDL and AIDL HALs
Diffstat (limited to 'core/java')
7 files changed, 80 insertions, 36 deletions
diff --git a/core/java/android/hardware/biometrics/SensorPropertiesInternal.java b/core/java/android/hardware/biometrics/SensorPropertiesInternal.java index 17b2abf9f5d1..f365ee6066d0 100644 --- a/core/java/android/hardware/biometrics/SensorPropertiesInternal.java +++ b/core/java/android/hardware/biometrics/SensorPropertiesInternal.java @@ -44,7 +44,7 @@ public class SensorPropertiesInternal implements Parcelable { prop.resetLockoutRequiresHardwareAuthToken, prop.resetLockoutRequiresChallenge); } - protected SensorPropertiesInternal(int sensorId, @SensorProperties.Strength int sensorStrength, + public SensorPropertiesInternal(int sensorId, @SensorProperties.Strength int sensorStrength, int maxEnrollmentsPerUser, @NonNull List<ComponentInfoInternal> componentInfo, boolean resetLockoutRequiresHardwareAuthToken, boolean resetLockoutRequiresChallenge) { this.sensorId = sensorId; diff --git a/core/java/android/hardware/face/IFaceService.aidl b/core/java/android/hardware/face/IFaceService.aidl index 0b44150afa4d..270d662a02a0 100644 --- a/core/java/android/hardware/face/IFaceService.aidl +++ b/core/java/android/hardware/face/IFaceService.aidl @@ -127,6 +127,8 @@ interface IFaceService { void getFeature(IBinder token, int userId, int feature, IFaceServiceReceiver receiver, String opPackageName); - // Give FaceService its ID. See AuthService.java - void initializeConfiguration(int sensorId, int strength); + // Registers all HIDL and AIDL sensors. Only HIDL sensor properties need to be provided, because + // AIDL sensor properties are retrieved directly from the available HALs. If no HIDL HALs exist, + // hidlSensors must be non-null and empty. See AuthService.java + void registerAuthenticators(in List<FaceSensorPropertiesInternal> hidlSensors); } diff --git a/core/java/android/hardware/fingerprint/FingerprintManager.java b/core/java/android/hardware/fingerprint/FingerprintManager.java index 88d5ba8be8ab..cc1aeeb92685 100644 --- a/core/java/android/hardware/fingerprint/FingerprintManager.java +++ b/core/java/android/hardware/fingerprint/FingerprintManager.java @@ -1013,6 +1013,31 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing } /** + * Adds a callback that gets called when the service registers all of the fingerprint + * authenticators (HALs). + * + * If the fingerprint authenticators are already registered when the callback is added, the + * callback is invoked immediately. + * + * The callback is automatically removed after it's invoked. + * + * @hide + */ + @RequiresPermission(USE_BIOMETRIC_INTERNAL) + public void addAuthenticatorsRegisteredCallback( + IFingerprintAuthenticatorsRegisteredCallback callback) { + if (mService != null) { + try { + mService.addAuthenticatorsRegisteredCallback(callback); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } else { + Slog.w(TAG, "addProvidersAvailableCallback(): Service not connected!"); + } + } + + /** * @hide */ public void addLockoutResetCallback(final LockoutResetCallback callback) { diff --git a/core/java/android/hardware/fingerprint/FingerprintSensorPropertiesInternal.java b/core/java/android/hardware/fingerprint/FingerprintSensorPropertiesInternal.java index 58f6e62af320..4ffe5f189661 100644 --- a/core/java/android/hardware/fingerprint/FingerprintSensorPropertiesInternal.java +++ b/core/java/android/hardware/fingerprint/FingerprintSensorPropertiesInternal.java @@ -20,7 +20,6 @@ import static android.hardware.fingerprint.FingerprintSensorProperties.TYPE_UDFP import static android.hardware.fingerprint.FingerprintSensorProperties.TYPE_UDFPS_ULTRASONIC; import android.annotation.NonNull; -import android.content.Context; import android.hardware.biometrics.ComponentInfoInternal; import android.hardware.biometrics.SensorProperties; import android.hardware.biometrics.SensorPropertiesInternal; @@ -92,34 +91,6 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna 1636 /* sensorLocationY */, 130 /* sensorRadius */); } - /** - * Initializes SensorProperties with specified values and values obtained from resources using - * context. - */ - // TODO(b/179175438): Remove this constructor once all HALs move to AIDL. - public FingerprintSensorPropertiesInternal(@NonNull Context context, int sensorId, - @SensorProperties.Strength int strength, int maxEnrollmentsPerUser, - @NonNull List<ComponentInfoInternal> componentInfo, - @FingerprintSensorProperties.SensorType int sensorType, - boolean resetLockoutRequiresHardwareAuthToken) { - super(sensorId, strength, maxEnrollmentsPerUser, componentInfo, - resetLockoutRequiresHardwareAuthToken, false /* resetLockoutRequiresChallenge */); - this.sensorType = sensorType; - - int[] props = context.getResources().getIntArray( - com.android.internal.R.array.config_udfps_sensor_props); - if (props != null && props.length == 3) { - this.sensorLocationX = props[0]; - this.sensorLocationY = props[1]; - this.sensorRadius = props[2]; - } else { - // Fake coordinates that could be used for the fake UDFPS mode. - this.sensorLocationX = 540; - this.sensorLocationY = 1636; - this.sensorRadius = 130; - } - } - protected FingerprintSensorPropertiesInternal(Parcel in) { super(in); sensorType = in.readInt(); diff --git a/core/java/android/hardware/fingerprint/IFingerprintAuthenticatorsRegisteredCallback.aidl b/core/java/android/hardware/fingerprint/IFingerprintAuthenticatorsRegisteredCallback.aidl new file mode 100644 index 000000000000..5a2c9311eaf9 --- /dev/null +++ b/core/java/android/hardware/fingerprint/IFingerprintAuthenticatorsRegisteredCallback.aidl @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2021 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 android.hardware.fingerprint; + +import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; +import java.util.List; + +/** + * Callback to notify FingerprintManager that FingerprintService has registered all of the + * fingerprint authenticators (HALs). + * See {@link android.hardware.fingerprint.IFingerprintService#registerAuthenticators}. + * + * @hide + */ +oneway interface IFingerprintAuthenticatorsRegisteredCallback { + /** + * Notifies FingerprintManager that all of the fingerprint authenticators have been registered. + * + * @param sensors A consolidated list of sensor properties for all of the authenticators. + */ + void onAllAuthenticatorsRegistered(in List<FingerprintSensorPropertiesInternal> sensors); +} diff --git a/core/java/android/hardware/fingerprint/IFingerprintService.aidl b/core/java/android/hardware/fingerprint/IFingerprintService.aidl index 3bceacb5e479..833747f19a0c 100644 --- a/core/java/android/hardware/fingerprint/IFingerprintService.aidl +++ b/core/java/android/hardware/fingerprint/IFingerprintService.aidl @@ -21,6 +21,7 @@ import android.hardware.biometrics.IInvalidationCallback; import android.hardware.biometrics.ITestSession; import android.hardware.biometrics.ITestSessionCallback; import android.hardware.fingerprint.IFingerprintClientActiveCallback; +import android.hardware.fingerprint.IFingerprintAuthenticatorsRegisteredCallback; import android.hardware.fingerprint.IFingerprintServiceReceiver; import android.hardware.fingerprint.IFingerprintStateListener; import android.hardware.fingerprint.IUdfpsOverlayController; @@ -144,8 +145,14 @@ interface IFingerprintService { // Removes a callback set by addClientActiveCallback void removeClientActiveCallback(IFingerprintClientActiveCallback callback); - // Give FingerprintService its ID. See AuthService.java - void initializeConfiguration(int sensorId, int strength); + // Registers all HIDL and AIDL sensors. Only HIDL sensor properties need to be provided, because + // AIDL sensor properties are retrieved directly from the available HALs. If no HIDL HALs exist, + // hidlSensors must be non-null and empty. See AuthService.java + void registerAuthenticators(in List<FingerprintSensorPropertiesInternal> hidlSensors); + + // Adds a callback which gets called when the service registers all of the fingerprint + // authenticators. The callback is automatically removed after it's invoked. + void addAuthenticatorsRegisteredCallback(IFingerprintAuthenticatorsRegisteredCallback callback); // Notifies about a finger touching the sensor area. void onPointerDown(int sensorId, int x, int y, float minor, float major); diff --git a/core/java/android/hardware/iris/IIrisService.aidl b/core/java/android/hardware/iris/IIrisService.aidl index 3d26318343be..98057d548226 100644 --- a/core/java/android/hardware/iris/IIrisService.aidl +++ b/core/java/android/hardware/iris/IIrisService.aidl @@ -15,12 +15,16 @@ */ package android.hardware.iris; +import android.hardware.biometrics.SensorPropertiesInternal; + /** * Communication channel from client to the iris service. These methods are all require the * MANAGE_BIOMETRIC signature permission. * @hide */ interface IIrisService { - // Give IrisService its ID. See AuthService.java - void initializeConfiguration(int sensorId, int strength); + // Registers all HIDL and AIDL sensors. Only HIDL sensor properties need to be provided, because + // AIDL sensor properties are retrieved directly from the available HALs. If no HIDL HALs exist, + // hidlSensors must be non-null and empty. See AuthService.java + void registerAuthenticators(in List<SensorPropertiesInternal> hidlSensors); } |
