summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Kevin Chyn <kchyn@google.com> 2020-09-23 21:33:35 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-09-23 21:33:35 +0000
commit7545d23747f040adadc0db1d372b941c346f3c28 (patch)
tree7bc19799af6103547f58b934b20a9057a92637fa
parent0e2927e75b401dd09ec9ac17c798f34ea2db4379 (diff)
parentc1ef4186c8937860320c3d224631ee27de17519a (diff)
Merge "Match Framework and AIDL SensorProps"
-rw-r--r--core/java/android/hardware/biometrics/BiometricManager.java1
-rw-r--r--core/java/android/hardware/biometrics/SensorProperties.java82
-rw-r--r--core/java/android/hardware/face/IFaceService.aidl2
-rw-r--r--core/java/android/hardware/fingerprint/FingerprintSensorProperties.java45
-rw-r--r--core/java/android/hardware/fingerprint/IFingerprintService.aidl2
-rw-r--r--packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java2
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java8
-rw-r--r--services/core/java/com/android/server/biometrics/SensorConfig.java4
-rw-r--r--services/core/java/com/android/server/biometrics/Utils.java19
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/face/Face10.java2
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/face/FaceAuthenticator.java2
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/face/FaceService.java6
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/fingerprint/Fingerprint21.java18
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/fingerprint/Fingerprint21UdfpsMock.java13
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintAuthenticator.java2
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java6
-rw-r--r--services/tests/servicestests/src/com/android/server/biometrics/AuthServiceTest.java15
17 files changed, 180 insertions, 49 deletions
diff --git a/core/java/android/hardware/biometrics/BiometricManager.java b/core/java/android/hardware/biometrics/BiometricManager.java
index f86eb9082e01..8d0cc68056f8 100644
--- a/core/java/android/hardware/biometrics/BiometricManager.java
+++ b/core/java/android/hardware/biometrics/BiometricManager.java
@@ -103,6 +103,7 @@ public class BiometricManager {
@IntDef(flag = true, value = {
BIOMETRIC_STRONG,
BIOMETRIC_WEAK,
+ BIOMETRIC_CONVENIENCE,
DEVICE_CREDENTIAL,
})
@interface Types {}
diff --git a/core/java/android/hardware/biometrics/SensorProperties.java b/core/java/android/hardware/biometrics/SensorProperties.java
new file mode 100644
index 000000000000..0f33ac4f0568
--- /dev/null
+++ b/core/java/android/hardware/biometrics/SensorProperties.java
@@ -0,0 +1,82 @@
+/*
+ * 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 android.hardware.biometrics;
+
+import android.annotation.IntDef;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * The base class containing all sensor-agnostic information. This is a superset of the
+ * {@link android.hardware.biometrics.common.CommonProps}, and provides backwards-compatible
+ * behavior with the older generation of HIDL (non-AIDL) interfaces.
+ * @hide
+ */
+public class SensorProperties implements Parcelable {
+
+ public static final int STRENGTH_CONVENIENCE = 0;
+ public static final int STRENGTH_WEAK = 1;
+ public static final int STRENGTH_STRONG = 2;
+
+ @IntDef({STRENGTH_CONVENIENCE, STRENGTH_WEAK, STRENGTH_STRONG})
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface Strength {}
+
+ public final int sensorId;
+ @Strength public final int sensorStrength;
+ public final int maxEnrollmentsPerUser;
+
+ protected SensorProperties(int sensorId, @Strength int sensorStrength,
+ int maxEnrollmentsPerUser) {
+ this.sensorId = sensorId;
+ this.sensorStrength = sensorStrength;
+ this.maxEnrollmentsPerUser = maxEnrollmentsPerUser;
+ }
+
+ protected SensorProperties(Parcel in) {
+ sensorId = in.readInt();
+ sensorStrength = in.readInt();
+ maxEnrollmentsPerUser = in.readInt();
+ }
+
+ public static final Creator<SensorProperties> CREATOR = new Creator<SensorProperties>() {
+ @Override
+ public SensorProperties createFromParcel(Parcel in) {
+ return new SensorProperties(in);
+ }
+
+ @Override
+ public SensorProperties[] newArray(int size) {
+ return new SensorProperties[size];
+ }
+ };
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(sensorId);
+ dest.writeInt(sensorStrength);
+ dest.writeInt(maxEnrollmentsPerUser);
+ }
+}
diff --git a/core/java/android/hardware/face/IFaceService.aidl b/core/java/android/hardware/face/IFaceService.aidl
index 437feb13b845..e744c840c298 100644
--- a/core/java/android/hardware/face/IFaceService.aidl
+++ b/core/java/android/hardware/face/IFaceService.aidl
@@ -110,5 +110,5 @@ interface IFaceService {
String opPackageName);
// Give FaceService its ID. See AuthService.java
- void initializeConfiguration(int sensorId);
+ void initializeConfiguration(int sensorId, int strength);
}
diff --git a/core/java/android/hardware/fingerprint/FingerprintSensorProperties.java b/core/java/android/hardware/fingerprint/FingerprintSensorProperties.java
index 2fd006809046..718141a4845a 100644
--- a/core/java/android/hardware/fingerprint/FingerprintSensorProperties.java
+++ b/core/java/android/hardware/fingerprint/FingerprintSensorProperties.java
@@ -17,6 +17,7 @@
package android.hardware.fingerprint;
import android.annotation.IntDef;
+import android.hardware.biometrics.SensorProperties;
import android.hardware.face.FaceSensorProperties;
import android.os.Parcel;
import android.os.Parcelable;
@@ -28,45 +29,44 @@ import java.lang.annotation.RetentionPolicy;
* Container for fingerprint sensor properties.
* @hide
*/
-public class FingerprintSensorProperties implements Parcelable {
+public class FingerprintSensorProperties extends SensorProperties {
public static final int TYPE_UNKNOWN = 0;
public static final int TYPE_REAR = 1;
- public static final int TYPE_UDFPS = 2;
- public static final int TYPE_POWER_BUTTON = 3;
+ public static final int TYPE_UDFPS_ULTRASONIC = 2;
+ public static final int TYPE_UDFPS_OPTICAL = 3;
+ public static final int TYPE_POWER_BUTTON = 4;
+ public static final int TYPE_HOME_BUTTON = 5;
- @IntDef({
- TYPE_UNKNOWN,
+ @IntDef({TYPE_UNKNOWN,
TYPE_REAR,
- TYPE_UDFPS,
- TYPE_POWER_BUTTON})
+ TYPE_UDFPS_ULTRASONIC,
+ TYPE_UDFPS_OPTICAL,
+ TYPE_POWER_BUTTON,
+ TYPE_HOME_BUTTON})
@Retention(RetentionPolicy.SOURCE)
public @interface SensorType {}
- public final int sensorId;
public final @SensorType int sensorType;
// IBiometricsFingerprint@2.1 does not manage timeout below the HAL, so the Gatekeeper HAT
// cannot be checked
public final boolean resetLockoutRequiresHardwareAuthToken;
- // Maximum number of enrollments a user/profile can have.
- public final int maxTemplatesAllowed;
/**
* Initializes SensorProperties with specified values
*/
- public FingerprintSensorProperties(int sensorId, @SensorType int sensorType,
- boolean resetLockoutRequiresHardwareAuthToken, int maxTemplatesAllowed) {
- this.sensorId = sensorId;
+ public FingerprintSensorProperties(int sensorId, @Strength int strength,
+ int maxEnrollmentsPerUser, @SensorType int sensorType,
+ boolean resetLockoutRequiresHardwareAuthToken) {
+ super(sensorId, strength, maxEnrollmentsPerUser);
this.sensorType = sensorType;
this.resetLockoutRequiresHardwareAuthToken = resetLockoutRequiresHardwareAuthToken;
- this.maxTemplatesAllowed = maxTemplatesAllowed;
}
protected FingerprintSensorProperties(Parcel in) {
- sensorId = in.readInt();
+ super(in);
sensorType = in.readInt();
resetLockoutRequiresHardwareAuthToken = in.readBoolean();
- maxTemplatesAllowed = in.readInt();
}
public static final Creator<FingerprintSensorProperties> CREATOR =
@@ -89,9 +89,18 @@ public class FingerprintSensorProperties implements Parcelable {
@Override
public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(sensorId);
+ super.writeToParcel(dest, flags);
dest.writeInt(sensorType);
dest.writeBoolean(resetLockoutRequiresHardwareAuthToken);
- dest.writeInt(maxTemplatesAllowed);
+ }
+
+ public boolean isAnyUdfpsType() {
+ switch (sensorType) {
+ case TYPE_UDFPS_OPTICAL:
+ case TYPE_UDFPS_ULTRASONIC:
+ return true;
+ default:
+ return false;
+ }
}
}
diff --git a/core/java/android/hardware/fingerprint/IFingerprintService.aidl b/core/java/android/hardware/fingerprint/IFingerprintService.aidl
index 0fae15648e15..cc2b520b3152 100644
--- a/core/java/android/hardware/fingerprint/IFingerprintService.aidl
+++ b/core/java/android/hardware/fingerprint/IFingerprintService.aidl
@@ -118,7 +118,7 @@ interface IFingerprintService {
void removeClientActiveCallback(IFingerprintClientActiveCallback callback);
// Give FingerprintService its ID. See AuthService.java
- void initializeConfiguration(int sensorId);
+ void initializeConfiguration(int sensorId, int strength);
// Notifies about a finger touching the sensor area.
void onFingerDown(int x, int y, float minor, float major);
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java
index bde9a6e7c714..38a191c8fb06 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java
@@ -309,7 +309,7 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
final List<FingerprintSensorProperties> fingerprintSensorProperties =
mFingerprintManager.getSensorProperties();
for (FingerprintSensorProperties props : fingerprintSensorProperties) {
- if (props.sensorType == FingerprintSensorProperties.TYPE_UDFPS) {
+ if (props.isAnyUdfpsType()) {
mUdfpsController = mUdfpsControllerFactory.get();
break;
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java
index 66656c5d251c..f6b39c2ca38b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java
@@ -45,6 +45,7 @@ import android.hardware.biometrics.BiometricConstants;
import android.hardware.biometrics.BiometricPrompt;
import android.hardware.biometrics.IBiometricSysuiReceiver;
import android.hardware.biometrics.PromptInfo;
+import android.hardware.biometrics.SensorProperties;
import android.hardware.face.FaceManager;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintSensorProperties;
@@ -119,8 +120,11 @@ public class AuthControllerTest extends SysuiTestCase {
when(mDialog2.isAllowDeviceCredentials()).thenReturn(false);
when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
- FingerprintSensorProperties prop = new FingerprintSensorProperties(
- 1, FingerprintSensorProperties.TYPE_UDFPS, true, 1);
+ FingerprintSensorProperties prop = new FingerprintSensorProperties(1 /* sensorId */,
+ SensorProperties.STRENGTH_STRONG,
+ 1 /* maxEnrollmentsPerUser */,
+ FingerprintSensorProperties.TYPE_UDFPS_OPTICAL,
+ true /* resetLockoutRequireHardwareAuthToken */);
List<FingerprintSensorProperties> props = new ArrayList<>();
props.add(prop);
when(mFingerprintManager.getSensorProperties()).thenReturn(props);
diff --git a/services/core/java/com/android/server/biometrics/SensorConfig.java b/services/core/java/com/android/server/biometrics/SensorConfig.java
index 7743f1c91307..a83f67a5e29c 100644
--- a/services/core/java/com/android/server/biometrics/SensorConfig.java
+++ b/services/core/java/com/android/server/biometrics/SensorConfig.java
@@ -16,13 +16,15 @@
package com.android.server.biometrics;
+import android.hardware.biometrics.BiometricManager;
+
/**
* Parsed sensor config. See core/res/res/values/config.xml config_biometric_sensors
*/
public class SensorConfig {
public final int id;
final int modality;
- final int strength;
+ @BiometricManager.Authenticators.Types public final int strength;
public SensorConfig(String config) {
String[] elems = config.split(":");
diff --git a/services/core/java/com/android/server/biometrics/Utils.java b/services/core/java/com/android/server/biometrics/Utils.java
index 88fd44456ff6..c300169d0b39 100644
--- a/services/core/java/com/android/server/biometrics/Utils.java
+++ b/services/core/java/com/android/server/biometrics/Utils.java
@@ -48,6 +48,7 @@ import android.hardware.biometrics.BiometricPrompt;
import android.hardware.biometrics.BiometricPrompt.AuthenticationResultType;
import android.hardware.biometrics.IBiometricService;
import android.hardware.biometrics.PromptInfo;
+import android.hardware.biometrics.SensorProperties;
import android.os.Binder;
import android.os.Build;
import android.os.RemoteException;
@@ -444,4 +445,22 @@ public class Utils {
}
return false;
}
+
+ /**
+ * Converts from {@link BiometricManager.Authenticators} biometric strength to the internal
+ * {@link SensorProperties} strength.
+ */
+ public static @SensorProperties.Strength int authenticatorStrengthToPropertyStrength(
+ @BiometricManager.Authenticators.Types int strength) {
+ switch (strength) {
+ case BiometricManager.Authenticators.BIOMETRIC_CONVENIENCE:
+ return SensorProperties.STRENGTH_CONVENIENCE;
+ case BiometricManager.Authenticators.BIOMETRIC_WEAK:
+ return SensorProperties.STRENGTH_WEAK;
+ case BiometricManager.Authenticators.BIOMETRIC_STRONG:
+ return SensorProperties.STRENGTH_STRONG;
+ default:
+ throw new IllegalArgumentException("Unknown strength: " + strength);
+ }
+ }
}
diff --git a/services/core/java/com/android/server/biometrics/sensors/face/Face10.java b/services/core/java/com/android/server/biometrics/sensors/face/Face10.java
index 1613d3bb4e8a..6e6ec747e24e 100644
--- a/services/core/java/com/android/server/biometrics/sensors/face/Face10.java
+++ b/services/core/java/com/android/server/biometrics/sensors/face/Face10.java
@@ -26,6 +26,7 @@ import android.content.Context;
import android.content.pm.UserInfo;
import android.hardware.biometrics.BiometricConstants;
import android.hardware.biometrics.BiometricFaceConstants;
+import android.hardware.biometrics.BiometricManager;
import android.hardware.biometrics.BiometricsProtoEnums;
import android.hardware.biometrics.face.V1_0.IBiometricsFace;
import android.hardware.biometrics.face.V1_0.IBiometricsFaceClientCallback;
@@ -279,6 +280,7 @@ class Face10 implements IHwBinder.DeathRecipient {
};
Face10(@NonNull Context context, int sensorId,
+ @BiometricManager.Authenticators.Types int strength,
@NonNull LockoutResetDispatcher lockoutResetDispatcher) {
final boolean supportsSelfIllumination = context.getResources()
.getBoolean(R.bool.config_faceAuthSupportsSelfIllumination);
diff --git a/services/core/java/com/android/server/biometrics/sensors/face/FaceAuthenticator.java b/services/core/java/com/android/server/biometrics/sensors/face/FaceAuthenticator.java
index bbee6cde4603..3318bcb8d593 100644
--- a/services/core/java/com/android/server/biometrics/sensors/face/FaceAuthenticator.java
+++ b/services/core/java/com/android/server/biometrics/sensors/face/FaceAuthenticator.java
@@ -34,7 +34,7 @@ public final class FaceAuthenticator extends IBiometricAuthenticator.Stub {
public FaceAuthenticator(IFaceService faceService, SensorConfig config)
throws RemoteException {
mFaceService = faceService;
- mFaceService.initializeConfiguration(config.id);
+ mFaceService.initializeConfiguration(config.id, config.strength);
}
@Override
diff --git a/services/core/java/com/android/server/biometrics/sensors/face/FaceService.java b/services/core/java/com/android/server/biometrics/sensors/face/FaceService.java
index c6664f4d96ff..82dc0d04d8a7 100644
--- a/services/core/java/com/android/server/biometrics/sensors/face/FaceService.java
+++ b/services/core/java/com/android/server/biometrics/sensors/face/FaceService.java
@@ -21,6 +21,7 @@ import static android.Manifest.permission.USE_BIOMETRIC_INTERNAL;
import android.annotation.NonNull;
import android.content.Context;
+import android.hardware.biometrics.BiometricManager;
import android.hardware.biometrics.BiometricsProtoEnums;
import android.hardware.biometrics.IBiometricSensorReceiver;
import android.hardware.biometrics.IBiometricServiceLockoutResetCallback;
@@ -308,9 +309,10 @@ public class FaceService extends SystemService {
}
@Override // Binder call
- public void initializeConfiguration(int sensorId) {
+ public void initializeConfiguration(int sensorId,
+ @BiometricManager.Authenticators.Types int strength) {
Utils.checkPermission(getContext(), USE_BIOMETRIC_INTERNAL);
- mFace10 = new Face10(getContext(), sensorId, mLockoutResetDispatcher);
+ mFace10 = new Face10(getContext(), sensorId, strength, mLockoutResetDispatcher);
}
}
diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/Fingerprint21.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/Fingerprint21.java
index 7e62329a168a..507b5dd3f224 100644
--- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/Fingerprint21.java
+++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/Fingerprint21.java
@@ -27,6 +27,7 @@ import android.app.UserSwitchObserver;
import android.content.Context;
import android.content.pm.UserInfo;
import android.hardware.biometrics.BiometricConstants;
+import android.hardware.biometrics.BiometricManager;
import android.hardware.biometrics.BiometricsProtoEnums;
import android.hardware.biometrics.fingerprint.V2_1.IBiometricsFingerprint;
import android.hardware.biometrics.fingerprint.V2_2.IBiometricsFingerprintClientCallback;
@@ -296,6 +297,7 @@ class Fingerprint21 implements IHwBinder.DeathRecipient {
Fingerprint21(@NonNull Context context, @NonNull BiometricScheduler scheduler,
@NonNull Handler handler, int sensorId,
+ @BiometricManager.Authenticators.Types int strength,
@NonNull LockoutResetDispatcher lockoutResetDispatcher,
@NonNull HalResultController controller) {
mContext = context;
@@ -335,25 +337,27 @@ class Fingerprint21 implements IHwBinder.DeathRecipient {
}
final @FingerprintSensorProperties.SensorType int sensorType =
- isUdfps ? FingerprintSensorProperties.TYPE_UDFPS
+ isUdfps ? FingerprintSensorProperties.TYPE_UDFPS_OPTICAL
: FingerprintSensorProperties.TYPE_REAR;
// resetLockout is controlled by the framework, so hardwareAuthToken is not required
final boolean resetLockoutRequiresHardwareAuthToken = false;
- final int maxTemplatesAllowed = mContext.getResources()
+ final int maxEnrollmentsPerUser = mContext.getResources()
.getInteger(R.integer.config_fingerprintMaxTemplatesPerUser);
- mSensorProperties = new FingerprintSensorProperties(sensorId, sensorType,
- resetLockoutRequiresHardwareAuthToken, maxTemplatesAllowed);
+
+ mSensorProperties = new FingerprintSensorProperties(sensorId,
+ Utils.authenticatorStrengthToPropertyStrength(strength), maxEnrollmentsPerUser,
+ sensorType, resetLockoutRequiresHardwareAuthToken);
}
- static Fingerprint21 newInstance(@NonNull Context context, int sensorId,
+ static Fingerprint21 newInstance(@NonNull Context context, int sensorId, int strength,
@NonNull LockoutResetDispatcher lockoutResetDispatcher,
@NonNull GestureAvailabilityDispatcher gestureAvailabilityDispatcher) {
final Handler handler = new Handler(Looper.getMainLooper());
final BiometricScheduler scheduler =
new BiometricScheduler(TAG, gestureAvailabilityDispatcher);
final HalResultController controller = new HalResultController(context, handler, scheduler);
- return new Fingerprint21(context, scheduler, handler, sensorId, lockoutResetDispatcher,
- controller);
+ return new Fingerprint21(context, scheduler, handler, sensorId, strength,
+ lockoutResetDispatcher, controller);
}
@Override
diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/Fingerprint21UdfpsMock.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/Fingerprint21UdfpsMock.java
index 7cab2b889eaa..044dbe9664ed 100644
--- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/Fingerprint21UdfpsMock.java
+++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/Fingerprint21UdfpsMock.java
@@ -21,6 +21,7 @@ import android.annotation.Nullable;
import android.app.trust.TrustManager;
import android.content.ContentResolver;
import android.content.Context;
+import android.hardware.biometrics.BiometricManager;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintManager.AuthenticationCallback;
import android.hardware.fingerprint.FingerprintManager.AuthenticationResult;
@@ -36,6 +37,7 @@ import android.util.Slog;
import android.util.SparseBooleanArray;
import com.android.internal.R;
+import com.android.server.biometrics.Utils;
import com.android.server.biometrics.sensors.AuthenticationConsumer;
import com.android.server.biometrics.sensors.BiometricScheduler;
import com.android.server.biometrics.sensors.ClientMonitor;
@@ -266,6 +268,7 @@ public class Fingerprint21UdfpsMock extends Fingerprint21 implements TrustManage
}
static Fingerprint21UdfpsMock newInstance(@NonNull Context context, int sensorId,
+ @BiometricManager.Authenticators.Types int strength,
@NonNull LockoutResetDispatcher lockoutResetDispatcher,
@NonNull GestureAvailabilityDispatcher gestureAvailabilityDispatcher) {
Slog.d(TAG, "Creating Fingerprint23Mock!");
@@ -275,7 +278,7 @@ public class Fingerprint21UdfpsMock extends Fingerprint21 implements TrustManage
new TestableBiometricScheduler(TAG, gestureAvailabilityDispatcher);
final MockHalResultController controller =
new MockHalResultController(context, handler, scheduler);
- return new Fingerprint21UdfpsMock(context, scheduler, handler, sensorId,
+ return new Fingerprint21UdfpsMock(context, scheduler, handler, sensorId, strength,
lockoutResetDispatcher, controller);
}
@@ -401,9 +404,10 @@ public class Fingerprint21UdfpsMock extends Fingerprint21 implements TrustManage
private Fingerprint21UdfpsMock(@NonNull Context context,
@NonNull TestableBiometricScheduler scheduler,
@NonNull Handler handler, int sensorId,
+ @BiometricManager.Authenticators.Types int strength,
@NonNull LockoutResetDispatcher lockoutResetDispatcher,
@NonNull MockHalResultController controller) {
- super(context, scheduler, handler, sensorId, lockoutResetDispatcher, controller);
+ super(context, scheduler, handler, sensorId, strength, lockoutResetDispatcher, controller);
mScheduler = scheduler;
mScheduler.init(this);
mHandler = handler;
@@ -412,8 +416,9 @@ public class Fingerprint21UdfpsMock extends Fingerprint21 implements TrustManage
final int maxTemplatesAllowed = mContext.getResources()
.getInteger(R.integer.config_fingerprintMaxTemplatesPerUser);
mSensorProperties = new FingerprintSensorProperties(sensorId,
- FingerprintSensorProperties.TYPE_UDFPS, resetLockoutRequiresHardwareAuthToken,
- maxTemplatesAllowed);
+ Utils.authenticatorStrengthToPropertyStrength(strength), maxTemplatesAllowed,
+ FingerprintSensorProperties.TYPE_UDFPS_OPTICAL,
+ resetLockoutRequiresHardwareAuthToken);
mMockHalResultController = controller;
mUserHasTrust = new SparseBooleanArray();
mTrustManager = context.getSystemService(TrustManager.class);
diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintAuthenticator.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintAuthenticator.java
index 21a46d58a3b3..5219df4a841d 100644
--- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintAuthenticator.java
+++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintAuthenticator.java
@@ -34,7 +34,7 @@ public final class FingerprintAuthenticator extends IBiometricAuthenticator.Stub
public FingerprintAuthenticator(IFingerprintService fingerprintService, SensorConfig config)
throws RemoteException {
mFingerprintService = fingerprintService;
- mFingerprintService.initializeConfiguration(config.id);
+ mFingerprintService.initializeConfiguration(config.id, config.strength);
}
@Override
diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java
index 7c7da118df10..2f0e56447e20 100644
--- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java
+++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java
@@ -384,7 +384,7 @@ public class FingerprintService extends SystemService {
}
@Override // Binder call
- public void initializeConfiguration(int sensorId) {
+ public void initializeConfiguration(int sensorId, int strength) {
Utils.checkPermission(getContext(), USE_BIOMETRIC_INTERNAL);
if ((Build.IS_USERDEBUG || Build.IS_ENG)
@@ -393,9 +393,9 @@ public class FingerprintService extends SystemService {
Fingerprint21UdfpsMock.CONFIG_ENABLE_TEST_UDFPS, 0 /* default */,
UserHandle.USER_CURRENT) != 0) {
mFingerprint21 = Fingerprint21UdfpsMock.newInstance(getContext(), sensorId,
- mLockoutResetDispatcher, mGestureAvailabilityDispatcher);
+ strength, mLockoutResetDispatcher, mGestureAvailabilityDispatcher);
} else {
- mFingerprint21 = Fingerprint21.newInstance(getContext(), sensorId,
+ mFingerprint21 = Fingerprint21.newInstance(getContext(), sensorId, strength,
mLockoutResetDispatcher, mGestureAvailabilityDispatcher);
}
}
diff --git a/services/tests/servicestests/src/com/android/server/biometrics/AuthServiceTest.java b/services/tests/servicestests/src/com/android/server/biometrics/AuthServiceTest.java
index cc1fdab3d22a..e011c797777e 100644
--- a/services/tests/servicestests/src/com/android/server/biometrics/AuthServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/biometrics/AuthServiceTest.java
@@ -123,8 +123,7 @@ public class AuthServiceTest {
final String[] config = {
"0:2:15", // ID0:Fingerprint:Strong
- "1:4:255", // ID1:Iris:Weak
- "2:8:4095", // ID2:Face:Convenience
+ "1:8:4095", // ID2:Face:Convenience
};
when(mInjector.getConfiguration(any())).thenReturn(config);
@@ -133,12 +132,14 @@ public class AuthServiceTest {
mAuthService.onStart();
final int fingerprintId = 0;
- final int irisId = 1;
- final int faceId = 2;
+ final int faceId = 1;
- verify(mFingerprintService).initializeConfiguration(eq(fingerprintId));
- verify(mIrisService).initializeConfiguration(eq(irisId));
- verify(mFaceService).initializeConfiguration(eq(faceId));
+ final int fingerprintStrength = 15;
+ final int faceStrength = 4095;
+
+ verify(mFingerprintService).initializeConfiguration(eq(fingerprintId),
+ eq(fingerprintStrength));
+ verify(mFaceService).initializeConfiguration(eq(faceId), eq(faceStrength));
}