Rename existing getSensorProperties, prepare for TestApi
Parcelables cannot easily become TestApi, since CREATOR, etc all come as extra baggage. So, rename internal usage to *SensorPropertiesInternal, and add a new class that exposes only specific parts of the properties for future TestApi Bug: 169459906 Test: Enroll, Auth on existing devices Test: atest com.android.systemui.biometrics Test: atest com.android.server.biometrics Change-Id: I59ae6bd30bef0eccbbcb58ddd7fa443be8a42ccf
This commit is contained in:
@@ -17,66 +17,71 @@
|
||||
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.
|
||||
* The base class containing all modality-agnostic information.
|
||||
* @hide
|
||||
*/
|
||||
public class SensorProperties implements Parcelable {
|
||||
|
||||
public class SensorProperties {
|
||||
/**
|
||||
* A sensor that meets the requirements for Class 1 biometrics as defined in the CDD. This does
|
||||
* not correspond to a public BiometricManager.Authenticators constant. Sensors of this strength
|
||||
* are not available to applications via the public API surface.
|
||||
* @hide
|
||||
*/
|
||||
public static final int STRENGTH_CONVENIENCE = 0;
|
||||
|
||||
/**
|
||||
* A sensor that meets the requirements for Class 2 biometrics as defined in the CDD.
|
||||
* Corresponds to BiometricManager.Authenticators.BIOMETRIC_WEAK.
|
||||
* @hide
|
||||
*/
|
||||
public static final int STRENGTH_WEAK = 1;
|
||||
|
||||
/**
|
||||
* A sensor that meets the requirements for Class 3 biometrics as defined in the CDD.
|
||||
* Corresponds to BiometricManager.Authenticators.BIOMETRIC_STRONG.
|
||||
*
|
||||
* Notably, this is the only strength that allows generation of HardwareAuthToken(s).
|
||||
* @hide
|
||||
*/
|
||||
public static final int STRENGTH_STRONG = 2;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
@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;
|
||||
private final int mSensorId;
|
||||
@Strength private final int mSensorStrength;
|
||||
|
||||
protected SensorProperties(int sensorId, @Strength int sensorStrength,
|
||||
int maxEnrollmentsPerUser) {
|
||||
this.sensorId = sensorId;
|
||||
this.sensorStrength = sensorStrength;
|
||||
this.maxEnrollmentsPerUser = maxEnrollmentsPerUser;
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public SensorProperties(int sensorId, @Strength int sensorStrength) {
|
||||
mSensorId = sensorId;
|
||||
mSensorStrength = sensorStrength;
|
||||
}
|
||||
|
||||
protected SensorProperties(Parcel in) {
|
||||
sensorId = in.readInt();
|
||||
sensorStrength = in.readInt();
|
||||
maxEnrollmentsPerUser = in.readInt();
|
||||
/**
|
||||
* @return The sensor's unique identifier.
|
||||
* @hide
|
||||
*/
|
||||
public int getSensorId() {
|
||||
return mSensorId;
|
||||
}
|
||||
|
||||
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);
|
||||
/**
|
||||
* @return The sensor's strength.
|
||||
* @hide
|
||||
*/
|
||||
@Strength
|
||||
public int getSensorStrength() {
|
||||
return mSensorStrength;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* 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 modality-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 SensorPropertiesInternal implements Parcelable {
|
||||
|
||||
public final int sensorId;
|
||||
@SensorProperties.Strength public final int sensorStrength;
|
||||
public final int maxEnrollmentsPerUser;
|
||||
|
||||
protected SensorPropertiesInternal(int sensorId, @SensorProperties.Strength int sensorStrength,
|
||||
int maxEnrollmentsPerUser) {
|
||||
this.sensorId = sensorId;
|
||||
this.sensorStrength = sensorStrength;
|
||||
this.maxEnrollmentsPerUser = maxEnrollmentsPerUser;
|
||||
}
|
||||
|
||||
protected SensorPropertiesInternal(Parcel in) {
|
||||
sensorId = in.readInt();
|
||||
sensorStrength = in.readInt();
|
||||
maxEnrollmentsPerUser = in.readInt();
|
||||
}
|
||||
|
||||
public static final Creator<SensorPropertiesInternal> CREATOR =
|
||||
new Creator<SensorPropertiesInternal>() {
|
||||
@Override
|
||||
public SensorPropertiesInternal createFromParcel(Parcel in) {
|
||||
return new SensorPropertiesInternal(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SensorPropertiesInternal[] newArray(int size) {
|
||||
return new SensorPropertiesInternal[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(sensorId);
|
||||
dest.writeInt(sensorStrength);
|
||||
dest.writeInt(maxEnrollmentsPerUser);
|
||||
}
|
||||
}
|
||||
@@ -49,9 +49,6 @@ import com.android.internal.os.SomeArgs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/**
|
||||
* A class that coordinates access to the face authentication hardware.
|
||||
@@ -299,6 +296,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
|
||||
* int[], Surface)} with {@code surface} set to null.
|
||||
*
|
||||
* @see FaceManager#enroll(int, byte[], CancellationSignal, EnrollmentCallback, int[], Surface)
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(MANAGE_BIOMETRIC)
|
||||
public void enroll(int userId, byte[] hardwareAuthToken, CancellationSignal cancel,
|
||||
@@ -443,7 +441,8 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
|
||||
*/
|
||||
@RequiresPermission(MANAGE_BIOMETRIC)
|
||||
public void generateChallenge(GenerateChallengeCallback callback) {
|
||||
final List<FaceSensorProperties> faceSensorProperties = getSensorProperties();
|
||||
final List<FaceSensorPropertiesInternal> faceSensorProperties =
|
||||
getSensorPropertiesInternal();
|
||||
if (faceSensorProperties.isEmpty()) {
|
||||
Slog.e(TAG, "No sensors");
|
||||
return;
|
||||
@@ -460,7 +459,8 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
|
||||
*/
|
||||
@RequiresPermission(MANAGE_BIOMETRIC)
|
||||
public void revokeChallenge() {
|
||||
final List<FaceSensorProperties> faceSensorProperties = getSensorProperties();
|
||||
final List<FaceSensorPropertiesInternal> faceSensorProperties =
|
||||
getSensorPropertiesInternal();
|
||||
if (faceSensorProperties.isEmpty()) {
|
||||
Slog.e(TAG, "No sensors during revokeChallenge");
|
||||
}
|
||||
@@ -597,6 +597,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
|
||||
* Determine if there is a face enrolled.
|
||||
*
|
||||
* @return true if a face is enrolled, false otherwise
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(USE_BIOMETRIC_INTERNAL)
|
||||
public boolean hasEnrolledTemplates() {
|
||||
@@ -632,6 +633,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
|
||||
* Determine if face authentication sensor hardware is present and functional.
|
||||
*
|
||||
* @return true if hardware is present and functional, false otherwise.
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(USE_BIOMETRIC_INTERNAL)
|
||||
public boolean isHardwareDetected() {
|
||||
@@ -647,18 +649,33 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a list of properties for all face authentication sensors on the device.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public List<FaceSensorProperties> getSensorProperties() {
|
||||
final List<FaceSensorProperties> properties = new ArrayList<>();
|
||||
final List<FaceSensorPropertiesInternal> internalProperties
|
||||
= getSensorPropertiesInternal();
|
||||
for (FaceSensorPropertiesInternal internalProp : internalProperties) {
|
||||
properties.add(FaceSensorProperties.from(internalProp));
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get statically configured sensor properties.
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(USE_BIOMETRIC_INTERNAL)
|
||||
@NonNull
|
||||
public List<FaceSensorProperties> getSensorProperties() {
|
||||
public List<FaceSensorPropertiesInternal> getSensorPropertiesInternal() {
|
||||
try {
|
||||
if (mService == null || !mService.isHardwareDetected(mContext.getOpPackageName())) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return mService.getSensorProperties(mContext.getOpPackageName());
|
||||
return mService.getSensorPropertiesInternal(mContext.getOpPackageName());
|
||||
} catch (RemoteException e) {
|
||||
e.rethrowFromSystemServer();
|
||||
}
|
||||
@@ -874,6 +891,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
|
||||
/**
|
||||
* Container for callback data from {@link FaceManager#authenticate(CryptoObject,
|
||||
* CancellationSignal, int, AuthenticationCallback, Handler)}.
|
||||
* @hide
|
||||
*/
|
||||
public static class AuthenticationResult {
|
||||
private Face mFace;
|
||||
@@ -943,6 +961,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
|
||||
* FaceManager#authenticate(CryptoObject, CancellationSignal,
|
||||
* int, AuthenticationCallback, Handler) } must provide an implementation of this for listening
|
||||
* to face events.
|
||||
* @hide
|
||||
*/
|
||||
public abstract static class AuthenticationCallback
|
||||
extends BiometricAuthenticator.AuthenticationCallback {
|
||||
|
||||
@@ -16,76 +16,25 @@
|
||||
|
||||
package android.hardware.face;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.hardware.biometrics.SensorProperties;
|
||||
|
||||
/**
|
||||
* Container for face sensor properties.
|
||||
* @hide
|
||||
*/
|
||||
public class FaceSensorProperties implements Parcelable {
|
||||
public class FaceSensorProperties extends SensorProperties {
|
||||
|
||||
/**
|
||||
* A statically configured ID representing this sensor. Sensor IDs must be unique across all
|
||||
* biometrics across the device, starting at 0, and in increments of 1.
|
||||
* @hide
|
||||
*/
|
||||
public final int sensorId;
|
||||
public static FaceSensorProperties from(FaceSensorPropertiesInternal internalProp) {
|
||||
return new FaceSensorProperties(internalProp.sensorId, internalProp.sensorStrength);
|
||||
}
|
||||
/**
|
||||
* True if the sensor is able to perform generic face detection, without running the
|
||||
* matching algorithm, and without affecting the lockout counter.
|
||||
* @hide
|
||||
*/
|
||||
public final boolean supportsFaceDetection;
|
||||
/**
|
||||
* True if the sensor is able to provide self illumination in dark scenarios, without support
|
||||
* from above the HAL.
|
||||
*/
|
||||
public final boolean supportsSelfIllumination;
|
||||
/**
|
||||
* Maximum number of enrollments a user/profile can have.
|
||||
*/
|
||||
public final int maxTemplatesAllowed;
|
||||
|
||||
/**
|
||||
* Initializes SensorProperties with specified values
|
||||
*/
|
||||
public FaceSensorProperties(int sensorId, boolean supportsFaceDetection,
|
||||
boolean supportsSelfIllumination, int maxTemplatesAllowed) {
|
||||
this.sensorId = sensorId;
|
||||
this.supportsFaceDetection = supportsFaceDetection;
|
||||
this.supportsSelfIllumination = supportsSelfIllumination;
|
||||
this.maxTemplatesAllowed = maxTemplatesAllowed;
|
||||
public FaceSensorProperties(int sensorId, int sensorStrength) {
|
||||
super(sensorId, sensorStrength);
|
||||
}
|
||||
|
||||
protected FaceSensorProperties(Parcel in) {
|
||||
sensorId = in.readInt();
|
||||
supportsFaceDetection = in.readBoolean();
|
||||
supportsSelfIllumination = in.readBoolean();
|
||||
maxTemplatesAllowed = in.readInt();
|
||||
}
|
||||
|
||||
public static final Creator<FaceSensorProperties> CREATOR =
|
||||
new Creator<FaceSensorProperties>() {
|
||||
@Override
|
||||
public FaceSensorProperties createFromParcel(Parcel in) {
|
||||
return new FaceSensorProperties(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FaceSensorProperties[] newArray(int size) {
|
||||
return new FaceSensorProperties[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(sensorId);
|
||||
dest.writeBoolean(supportsFaceDetection);
|
||||
dest.writeBoolean(supportsSelfIllumination);
|
||||
dest.writeInt(maxTemplatesAllowed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,4 +15,4 @@
|
||||
*/
|
||||
package android.hardware.face;
|
||||
|
||||
parcelable FaceSensorProperties;
|
||||
parcelable FaceSensorPropertiesInternal;
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* 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.face;
|
||||
|
||||
import android.hardware.biometrics.SensorProperties;
|
||||
import android.hardware.biometrics.SensorPropertiesInternal;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/**
|
||||
* Container for face sensor properties.
|
||||
* @hide
|
||||
*/
|
||||
public class FaceSensorPropertiesInternal extends SensorPropertiesInternal {
|
||||
/**
|
||||
* True if the sensor is able to perform generic face detection, without running the
|
||||
* matching algorithm, and without affecting the lockout counter.
|
||||
*/
|
||||
public final boolean supportsFaceDetection;
|
||||
/**
|
||||
* True if the sensor is able to provide self illumination in dark scenarios, without support
|
||||
* from above the HAL.
|
||||
*/
|
||||
public final boolean supportsSelfIllumination;
|
||||
|
||||
/**
|
||||
* Initializes SensorProperties with specified values
|
||||
*/
|
||||
public FaceSensorPropertiesInternal(int sensorId, @SensorProperties.Strength int strength,
|
||||
int maxEnrollmentsPerUser, boolean supportsFaceDetection,
|
||||
boolean supportsSelfIllumination) {
|
||||
super(sensorId, strength, maxEnrollmentsPerUser);
|
||||
this.supportsFaceDetection = supportsFaceDetection;
|
||||
this.supportsSelfIllumination = supportsSelfIllumination;
|
||||
}
|
||||
|
||||
protected FaceSensorPropertiesInternal(Parcel in) {
|
||||
super(in);
|
||||
supportsFaceDetection = in.readBoolean();
|
||||
supportsSelfIllumination = in.readBoolean();
|
||||
}
|
||||
|
||||
public static final Creator<FaceSensorPropertiesInternal> CREATOR =
|
||||
new Creator<FaceSensorPropertiesInternal>() {
|
||||
@Override
|
||||
public FaceSensorPropertiesInternal createFromParcel(Parcel in) {
|
||||
return new FaceSensorPropertiesInternal(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FaceSensorPropertiesInternal[] newArray(int size) {
|
||||
return new FaceSensorPropertiesInternal[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
super.writeToParcel(dest, flags);
|
||||
dest.writeBoolean(supportsFaceDetection);
|
||||
dest.writeBoolean(supportsSelfIllumination);
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ import android.hardware.biometrics.IBiometricSensorReceiver;
|
||||
import android.hardware.biometrics.IBiometricServiceLockoutResetCallback;
|
||||
import android.hardware.face.IFaceServiceReceiver;
|
||||
import android.hardware.face.Face;
|
||||
import android.hardware.face.FaceSensorProperties;
|
||||
import android.hardware.face.FaceSensorPropertiesInternal;
|
||||
import android.view.Surface;
|
||||
|
||||
/**
|
||||
@@ -29,7 +29,7 @@ import android.view.Surface;
|
||||
*/
|
||||
interface IFaceService {
|
||||
// Retrieve static sensor properties for all face sensors
|
||||
List<FaceSensorProperties> getSensorProperties(String opPackageName);
|
||||
List<FaceSensorPropertiesInternal> getSensorPropertiesInternal(String opPackageName);
|
||||
|
||||
// Authenticate the given sessionId with a face
|
||||
void authenticate(IBinder token, long operationId, int userid, IFaceServiceReceiver receiver,
|
||||
|
||||
@@ -53,10 +53,7 @@ import android.view.Surface;
|
||||
import java.security.Signature;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.Mac;
|
||||
@@ -608,7 +605,8 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
|
||||
*/
|
||||
@RequiresPermission(MANAGE_FINGERPRINT)
|
||||
public void generateChallenge(GenerateChallengeCallback callback) {
|
||||
final List<FingerprintSensorProperties> fingerprintSensorProperties = getSensorProperties();
|
||||
final List<FingerprintSensorPropertiesInternal> fingerprintSensorProperties =
|
||||
getSensorPropertiesInternal();
|
||||
if (fingerprintSensorProperties.isEmpty()) {
|
||||
Slog.e(TAG, "No sensors");
|
||||
return;
|
||||
@@ -849,18 +847,33 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a list of properties for all fingerprint sensors on the device.
|
||||
* @hide
|
||||
*/
|
||||
@NonNull
|
||||
public List<FingerprintSensorProperties> getSensorProperties() {
|
||||
final List<FingerprintSensorProperties> properties = new ArrayList<>();
|
||||
final List<FingerprintSensorPropertiesInternal> internalProperties
|
||||
= getSensorPropertiesInternal();
|
||||
for (FingerprintSensorPropertiesInternal internalProp : internalProperties) {
|
||||
properties.add(FingerprintSensorProperties.from(internalProp));
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get statically configured sensor properties.
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(USE_BIOMETRIC_INTERNAL)
|
||||
@NonNull
|
||||
public List<FingerprintSensorProperties> getSensorProperties() {
|
||||
public List<FingerprintSensorPropertiesInternal> getSensorPropertiesInternal() {
|
||||
try {
|
||||
if (mService == null || !mService.isHardwareDetected(mContext.getOpPackageName())) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return mService.getSensorProperties(mContext.getOpPackageName());
|
||||
return mService.getSensorPropertiesInternal(mContext.getOpPackageName());
|
||||
} catch (RemoteException e) {
|
||||
e.rethrowFromSystemServer();
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ package android.hardware.fingerprint;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.hardware.biometrics.SensorProperties;
|
||||
import android.os.Parcel;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@@ -28,14 +27,39 @@ import java.lang.annotation.RetentionPolicy;
|
||||
* @hide
|
||||
*/
|
||||
public class FingerprintSensorProperties extends SensorProperties {
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public static final int TYPE_UNKNOWN = 0;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public static final int TYPE_REAR = 1;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public static final int TYPE_UDFPS_ULTRASONIC = 2;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public static final int TYPE_UDFPS_OPTICAL = 3;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public static final int TYPE_POWER_BUTTON = 4;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public static final int TYPE_HOME_BUTTON = 5;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
@IntDef({TYPE_UNKNOWN,
|
||||
TYPE_REAR,
|
||||
TYPE_UDFPS_ULTRASONIC,
|
||||
@@ -45,60 +69,34 @@ public class FingerprintSensorProperties extends SensorProperties {
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface SensorType {}
|
||||
|
||||
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;
|
||||
@SensorType final int mSensorType;
|
||||
|
||||
/**
|
||||
* Initializes SensorProperties with specified values
|
||||
* Constructs a {@link FingerprintSensorProperties} from the internal parcelable representation.
|
||||
* @hide
|
||||
*/
|
||||
public FingerprintSensorProperties(int sensorId, @Strength int strength,
|
||||
int maxEnrollmentsPerUser, @SensorType int sensorType,
|
||||
boolean resetLockoutRequiresHardwareAuthToken) {
|
||||
super(sensorId, strength, maxEnrollmentsPerUser);
|
||||
this.sensorType = sensorType;
|
||||
this.resetLockoutRequiresHardwareAuthToken = resetLockoutRequiresHardwareAuthToken;
|
||||
public static FingerprintSensorProperties from(
|
||||
FingerprintSensorPropertiesInternal internalProp) {
|
||||
return new FingerprintSensorProperties(internalProp.sensorId,
|
||||
internalProp.sensorStrength,
|
||||
internalProp.sensorType);
|
||||
}
|
||||
|
||||
protected FingerprintSensorProperties(Parcel in) {
|
||||
super(in);
|
||||
sensorType = in.readInt();
|
||||
resetLockoutRequiresHardwareAuthToken = in.readBoolean();
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public FingerprintSensorProperties(int sensorId, int sensorStrength,
|
||||
@SensorType int sensorType) {
|
||||
super(sensorId, sensorStrength);
|
||||
mSensorType = sensorType;
|
||||
}
|
||||
|
||||
public static final Creator<FingerprintSensorProperties> CREATOR =
|
||||
new Creator<FingerprintSensorProperties>() {
|
||||
@Override
|
||||
public FingerprintSensorProperties createFromParcel(Parcel in) {
|
||||
return new FingerprintSensorProperties(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FingerprintSensorProperties[] newArray(int size) {
|
||||
return new FingerprintSensorProperties[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
super.writeToParcel(dest, flags);
|
||||
dest.writeInt(sensorType);
|
||||
dest.writeBoolean(resetLockoutRequiresHardwareAuthToken);
|
||||
}
|
||||
|
||||
public boolean isAnyUdfpsType() {
|
||||
switch (sensorType) {
|
||||
case TYPE_UDFPS_OPTICAL:
|
||||
case TYPE_UDFPS_ULTRASONIC:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* @hide
|
||||
* @return The sensor's type.
|
||||
*/
|
||||
@SensorType
|
||||
public int getSensorType() {
|
||||
return mSensorType;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,4 +15,4 @@
|
||||
*/
|
||||
package android.hardware.fingerprint;
|
||||
|
||||
parcelable FingerprintSensorProperties;
|
||||
parcelable FingerprintSensorPropertiesInternal;
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* 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.fingerprint;
|
||||
|
||||
import static android.hardware.fingerprint.FingerprintSensorProperties.TYPE_UDFPS_OPTICAL;
|
||||
import static android.hardware.fingerprint.FingerprintSensorProperties.TYPE_UDFPS_ULTRASONIC;
|
||||
|
||||
import android.hardware.biometrics.SensorProperties;
|
||||
import android.hardware.biometrics.SensorPropertiesInternal;
|
||||
import android.os.Parcel;
|
||||
|
||||
/**
|
||||
* Container for fingerprint sensor properties.
|
||||
* @hide
|
||||
*/
|
||||
public class FingerprintSensorPropertiesInternal extends SensorPropertiesInternal {
|
||||
public final @FingerprintSensorProperties.SensorType int sensorType;
|
||||
// IBiometricsFingerprint@2.1 does not manage timeout below the HAL, so the Gatekeeper HAT
|
||||
// cannot be checked
|
||||
public final boolean resetLockoutRequiresHardwareAuthToken;
|
||||
|
||||
/**
|
||||
* Initializes SensorProperties with specified values
|
||||
*/
|
||||
public FingerprintSensorPropertiesInternal(int sensorId,
|
||||
@SensorProperties.Strength int strength, int maxEnrollmentsPerUser,
|
||||
@FingerprintSensorProperties.SensorType int sensorType,
|
||||
boolean resetLockoutRequiresHardwareAuthToken) {
|
||||
super(sensorId, strength, maxEnrollmentsPerUser);
|
||||
this.sensorType = sensorType;
|
||||
this.resetLockoutRequiresHardwareAuthToken = resetLockoutRequiresHardwareAuthToken;
|
||||
}
|
||||
|
||||
protected FingerprintSensorPropertiesInternal(Parcel in) {
|
||||
super(in);
|
||||
sensorType = in.readInt();
|
||||
resetLockoutRequiresHardwareAuthToken = in.readBoolean();
|
||||
}
|
||||
|
||||
public static final Creator<FingerprintSensorPropertiesInternal> CREATOR =
|
||||
new Creator<FingerprintSensorPropertiesInternal>() {
|
||||
@Override
|
||||
public FingerprintSensorPropertiesInternal createFromParcel(Parcel in) {
|
||||
return new FingerprintSensorPropertiesInternal(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FingerprintSensorPropertiesInternal[] newArray(int size) {
|
||||
return new FingerprintSensorPropertiesInternal[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
super.writeToParcel(dest, flags);
|
||||
dest.writeInt(sensorType);
|
||||
dest.writeBoolean(resetLockoutRequiresHardwareAuthToken);
|
||||
}
|
||||
|
||||
public boolean isAnyUdfpsType() {
|
||||
switch (sensorType) {
|
||||
case TYPE_UDFPS_OPTICAL:
|
||||
case TYPE_UDFPS_ULTRASONIC:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ import android.hardware.fingerprint.IFingerprintClientActiveCallback;
|
||||
import android.hardware.fingerprint.IFingerprintServiceReceiver;
|
||||
import android.hardware.fingerprint.IUdfpsOverlayController;
|
||||
import android.hardware.fingerprint.Fingerprint;
|
||||
import android.hardware.fingerprint.FingerprintSensorProperties;
|
||||
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
||||
import android.view.Surface;
|
||||
import java.util.List;
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.util.List;
|
||||
*/
|
||||
interface IFingerprintService {
|
||||
// Retrieve static sensor properties for all fingerprint sensors
|
||||
List<FingerprintSensorProperties> getSensorProperties(String opPackageName);
|
||||
List<FingerprintSensorPropertiesInternal> getSensorPropertiesInternal(String opPackageName);
|
||||
|
||||
// Authenticate the given sessionId with a fingerprint. This is protected by
|
||||
// USE_FINGERPRINT/USE_BIOMETRIC permission. This is effectively deprecated, since it only comes
|
||||
|
||||
@@ -56,7 +56,7 @@ import android.hardware.biometrics.BiometricManager;
|
||||
import android.hardware.biometrics.BiometricSourceType;
|
||||
import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback;
|
||||
import android.hardware.face.FaceManager;
|
||||
import android.hardware.face.FaceSensorProperties;
|
||||
import android.hardware.face.FaceSensorPropertiesInternal;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.hardware.fingerprint.FingerprintManager.AuthenticationCallback;
|
||||
import android.hardware.fingerprint.FingerprintManager.AuthenticationResult;
|
||||
@@ -1336,7 +1336,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
private CancellationSignal mFaceCancelSignal;
|
||||
private FingerprintManager mFpm;
|
||||
private FaceManager mFaceManager;
|
||||
private List<FaceSensorProperties> mFaceSensorProperties;
|
||||
private List<FaceSensorPropertiesInternal> mFaceSensorProperties;
|
||||
private boolean mFingerprintLockedOut;
|
||||
private TelephonyManager mTelephonyManager;
|
||||
|
||||
@@ -1778,7 +1778,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
}
|
||||
if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE)) {
|
||||
mFaceManager = (FaceManager) context.getSystemService(Context.FACE_SERVICE);
|
||||
mFaceSensorProperties = mFaceManager.getSensorProperties();
|
||||
mFaceSensorProperties = mFaceManager.getSensorPropertiesInternal();
|
||||
}
|
||||
|
||||
if (mFpm != null || mFaceManager != null) {
|
||||
|
||||
@@ -36,7 +36,7 @@ import android.hardware.biometrics.IBiometricSysuiReceiver;
|
||||
import android.hardware.biometrics.PromptInfo;
|
||||
import android.hardware.face.FaceManager;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.hardware.fingerprint.FingerprintSensorProperties;
|
||||
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
@@ -306,9 +306,9 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
|
||||
mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
|
||||
|
||||
if (mFingerprintManager != null && mFingerprintManager.isHardwareDetected()) {
|
||||
final List<FingerprintSensorProperties> fingerprintSensorProperties =
|
||||
mFingerprintManager.getSensorProperties();
|
||||
for (FingerprintSensorProperties props : fingerprintSensorProperties) {
|
||||
final List<FingerprintSensorPropertiesInternal> fingerprintSensorProperties =
|
||||
mFingerprintManager.getSensorPropertiesInternal();
|
||||
for (FingerprintSensorPropertiesInternal props : fingerprintSensorProperties) {
|
||||
if (props.isAnyUdfpsType()) {
|
||||
mUdfpsController = mUdfpsControllerFactory.get();
|
||||
break;
|
||||
|
||||
@@ -26,7 +26,7 @@ import android.content.res.TypedArray;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Point;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.hardware.fingerprint.FingerprintSensorProperties;
|
||||
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
||||
import android.hardware.fingerprint.IUdfpsOverlayController;
|
||||
import android.os.PowerManager;
|
||||
import android.os.UserHandle;
|
||||
@@ -53,7 +53,6 @@ import com.android.systemui.util.settings.SystemSettings;
|
||||
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@@ -182,7 +181,8 @@ class UdfpsController implements DozeReceiver {
|
||||
mLayoutParams = createLayoutParams(context);
|
||||
|
||||
int udfpsSensorId = -1;
|
||||
for (FingerprintSensorProperties props : mFingerprintManager.getSensorProperties()) {
|
||||
for (FingerprintSensorPropertiesInternal props :
|
||||
mFingerprintManager.getSensorPropertiesInternal()) {
|
||||
if (props.isAnyUdfpsType()) {
|
||||
udfpsSensorId = props.sensorId;
|
||||
break;
|
||||
|
||||
@@ -134,7 +134,7 @@ public class KeyguardModule {
|
||||
|
||||
// Cameras that support "self illumination," via IR for example, don't need low light
|
||||
// environment mitigation.
|
||||
boolean needsLowLightMitigation = faceManager.getSensorProperties().stream()
|
||||
boolean needsLowLightMitigation = faceManager.getSensorPropertiesInternal().stream()
|
||||
.anyMatch((properties) -> !properties.supportsSelfIllumination);
|
||||
if (!needsLowLightMitigation) {
|
||||
return Optional.empty();
|
||||
|
||||
@@ -53,6 +53,7 @@ import android.hardware.biometrics.BiometricSourceType;
|
||||
import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback;
|
||||
import android.hardware.face.FaceManager;
|
||||
import android.hardware.face.FaceSensorProperties;
|
||||
import android.hardware.face.FaceSensorPropertiesInternal;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.media.AudioManager;
|
||||
import android.os.Bundle;
|
||||
@@ -132,7 +133,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
@Mock
|
||||
private FaceManager mFaceManager;
|
||||
@Mock
|
||||
private List<FaceSensorProperties> mFaceSensorProperties;
|
||||
private List<FaceSensorPropertiesInternal> mFaceSensorProperties;
|
||||
@Mock
|
||||
private BiometricManager mBiometricManager;
|
||||
@Mock
|
||||
@@ -177,13 +178,14 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
when(mFaceManager.isHardwareDetected()).thenReturn(true);
|
||||
when(mFaceManager.hasEnrolledTemplates()).thenReturn(true);
|
||||
when(mFaceManager.hasEnrolledTemplates(anyInt())).thenReturn(true);
|
||||
when(mFaceManager.getSensorProperties()).thenReturn(mFaceSensorProperties);
|
||||
when(mFaceManager.getSensorPropertiesInternal()).thenReturn(mFaceSensorProperties);
|
||||
|
||||
// IBiometricsFace@1.0 does not support detection, only authentication.
|
||||
when(mFaceSensorProperties.isEmpty()).thenReturn(false);
|
||||
when(mFaceSensorProperties.get(anyInt())).thenReturn(new FaceSensorProperties(0 /* id */,
|
||||
false /* supportsFaceDetection */, true /* supportsSelfIllumination */,
|
||||
1 /* maxTemplatesAllowed */));
|
||||
when(mFaceSensorProperties.get(anyInt())).thenReturn(new FaceSensorPropertiesInternal(
|
||||
0 /* id */,
|
||||
FaceSensorProperties.STRENGTH_STRONG, 1 /* maxTemplatesAllowed */,
|
||||
false /* supportsFaceDetection */, true /* supportsSelfIllumination */));
|
||||
|
||||
when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
|
||||
when(mFingerprintManager.hasEnrolledTemplates(anyInt())).thenReturn(true);
|
||||
|
||||
@@ -49,6 +49,7 @@ import android.hardware.biometrics.SensorProperties;
|
||||
import android.hardware.face.FaceManager;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.hardware.fingerprint.FingerprintSensorProperties;
|
||||
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
||||
import android.os.Bundle;
|
||||
import android.test.suitebuilder.annotation.SmallTest;
|
||||
import android.testing.AndroidTestingRunner;
|
||||
@@ -120,14 +121,15 @@ public class AuthControllerTest extends SysuiTestCase {
|
||||
when(mDialog2.isAllowDeviceCredentials()).thenReturn(false);
|
||||
|
||||
when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
|
||||
FingerprintSensorProperties prop = new FingerprintSensorProperties(1 /* sensorId */,
|
||||
FingerprintSensorPropertiesInternal prop = new FingerprintSensorPropertiesInternal(
|
||||
1 /* sensorId */,
|
||||
SensorProperties.STRENGTH_STRONG,
|
||||
1 /* maxEnrollmentsPerUser */,
|
||||
FingerprintSensorProperties.TYPE_UDFPS_OPTICAL,
|
||||
true /* resetLockoutRequireHardwareAuthToken */);
|
||||
List<FingerprintSensorProperties> props = new ArrayList<>();
|
||||
List<FingerprintSensorPropertiesInternal> props = new ArrayList<>();
|
||||
props.add(prop);
|
||||
when(mFingerprintManager.getSensorProperties()).thenReturn(props);
|
||||
when(mFingerprintManager.getSensorPropertiesInternal()).thenReturn(props);
|
||||
|
||||
mAuthController = new TestableAuthController(context, mCommandQueue,
|
||||
mStatusBarStateController, mActivityTaskManager, mFingerprintManager,
|
||||
|
||||
@@ -30,6 +30,7 @@ import android.content.res.TypedArray;
|
||||
import android.hardware.biometrics.SensorProperties;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.hardware.fingerprint.FingerprintSensorProperties;
|
||||
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
||||
import android.hardware.fingerprint.IUdfpsOverlayController;
|
||||
import android.os.PowerManager;
|
||||
import android.os.RemoteException;
|
||||
@@ -109,13 +110,13 @@ public class UdfpsControllerTest extends SysuiTestCase {
|
||||
public void setUp() {
|
||||
setUpResources();
|
||||
when(mLayoutInflater.inflate(R.layout.udfps_view, null, false)).thenReturn(mUdfpsView);
|
||||
final List<FingerprintSensorProperties> props = new ArrayList<>();
|
||||
props.add(new FingerprintSensorProperties(TEST_UDFPS_SENSOR_ID,
|
||||
final List<FingerprintSensorPropertiesInternal> props = new ArrayList<>();
|
||||
props.add(new FingerprintSensorPropertiesInternal(TEST_UDFPS_SENSOR_ID,
|
||||
SensorProperties.STRENGTH_STRONG,
|
||||
5 /* maxEnrollmentsPerUser */,
|
||||
FingerprintSensorProperties.TYPE_UDFPS_OPTICAL,
|
||||
true /* resetLockoutRequiresHardwareAuthToken */));
|
||||
when(mFingerprintManager.getSensorProperties()).thenReturn(props);
|
||||
when(mFingerprintManager.getSensorPropertiesInternal()).thenReturn(props);
|
||||
mSystemSettings = new FakeSettings();
|
||||
mFgExecutor = new FakeExecutor(new FakeSystemClock());
|
||||
mUdfpsController = new UdfpsController(
|
||||
|
||||
@@ -49,8 +49,10 @@ import android.hardware.biometrics.BiometricPrompt.AuthenticationResultType;
|
||||
import android.hardware.biometrics.IBiometricService;
|
||||
import android.hardware.biometrics.PromptInfo;
|
||||
import android.hardware.biometrics.SensorProperties;
|
||||
import android.hardware.biometrics.SensorPropertiesInternal;
|
||||
import android.os.Binder;
|
||||
import android.os.Build;
|
||||
import android.os.Process;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.UserHandle;
|
||||
@@ -448,7 +450,7 @@ public class Utils {
|
||||
|
||||
/**
|
||||
* Converts from {@link BiometricManager.Authenticators} biometric strength to the internal
|
||||
* {@link SensorProperties} strength.
|
||||
* {@link SensorPropertiesInternal} strength.
|
||||
*/
|
||||
public static @SensorProperties.Strength int authenticatorStrengthToPropertyStrength(
|
||||
@BiometricManager.Authenticators.Types int strength) {
|
||||
|
||||
@@ -31,7 +31,7 @@ import android.hardware.biometrics.BiometricsProtoEnums;
|
||||
import android.hardware.biometrics.face.V1_0.IBiometricsFace;
|
||||
import android.hardware.biometrics.face.V1_0.IBiometricsFaceClientCallback;
|
||||
import android.hardware.face.Face;
|
||||
import android.hardware.face.FaceSensorProperties;
|
||||
import android.hardware.face.FaceSensorPropertiesInternal;
|
||||
import android.hardware.face.IFaceServiceReceiver;
|
||||
import android.os.Binder;
|
||||
import android.os.Build;
|
||||
@@ -87,7 +87,7 @@ class Face10 implements IHwBinder.DeathRecipient {
|
||||
static final String NOTIFICATION_TAG = "FaceService";
|
||||
static final int NOTIFICATION_ID = 1;
|
||||
|
||||
@NonNull private final FaceSensorProperties mFaceSensorProperties;
|
||||
@NonNull private final FaceSensorPropertiesInternal mFaceSensorProperties;
|
||||
@NonNull private final Context mContext;
|
||||
@NonNull private final BiometricScheduler mScheduler;
|
||||
@NonNull private final Handler mHandler;
|
||||
@@ -285,8 +285,8 @@ class Face10 implements IHwBinder.DeathRecipient {
|
||||
.getBoolean(R.bool.config_faceAuthSupportsSelfIllumination);
|
||||
final int maxTemplatesAllowed = context.getResources()
|
||||
.getInteger(R.integer.config_faceMaxTemplatesPerUser);
|
||||
mFaceSensorProperties = new FaceSensorProperties(sensorId, false /* supportsFaceDetect */,
|
||||
supportsSelfIllumination, maxTemplatesAllowed);
|
||||
mFaceSensorProperties = new FaceSensorPropertiesInternal(sensorId, strength,
|
||||
maxTemplatesAllowed, false /* supportsFaceDetect */, supportsSelfIllumination);
|
||||
mContext = context;
|
||||
mSensorId = sensorId;
|
||||
mScheduler = new BiometricScheduler(TAG, null /* gestureAvailabilityTracker */);
|
||||
@@ -672,7 +672,8 @@ class Face10 implements IHwBinder.DeathRecipient {
|
||||
return daemon != null;
|
||||
}
|
||||
|
||||
@NonNull FaceSensorProperties getFaceSensorProperties() {
|
||||
@NonNull
|
||||
FaceSensorPropertiesInternal getFaceSensorProperties() {
|
||||
return mFaceSensorProperties;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import android.hardware.biometrics.BiometricsProtoEnums;
|
||||
import android.hardware.biometrics.IBiometricSensorReceiver;
|
||||
import android.hardware.biometrics.IBiometricServiceLockoutResetCallback;
|
||||
import android.hardware.face.Face;
|
||||
import android.hardware.face.FaceSensorProperties;
|
||||
import android.hardware.face.FaceSensorPropertiesInternal;
|
||||
import android.hardware.face.IFaceService;
|
||||
import android.hardware.face.IFaceServiceReceiver;
|
||||
import android.os.Binder;
|
||||
@@ -67,9 +67,11 @@ public class FaceService extends SystemService {
|
||||
*/
|
||||
private final class FaceServiceWrapper extends IFaceService.Stub {
|
||||
@Override // Binder call
|
||||
public List<FaceSensorProperties> getSensorProperties(String opPackageName) {
|
||||
public List<FaceSensorPropertiesInternal> getSensorPropertiesInternal(
|
||||
String opPackageName) {
|
||||
Utils.checkPermission(getContext(), USE_BIOMETRIC_INTERNAL);
|
||||
final List<FaceSensorProperties> properties = new ArrayList<>();
|
||||
|
||||
final List<FaceSensorPropertiesInternal> properties = new ArrayList<>();
|
||||
|
||||
if (mFace10 != null) {
|
||||
properties.add(mFace10.getFaceSensorProperties());
|
||||
|
||||
@@ -33,7 +33,7 @@ import android.hardware.biometrics.BiometricsProtoEnums;
|
||||
import android.hardware.biometrics.IBiometricSensorReceiver;
|
||||
import android.hardware.biometrics.IBiometricServiceLockoutResetCallback;
|
||||
import android.hardware.fingerprint.Fingerprint;
|
||||
import android.hardware.fingerprint.FingerprintSensorProperties;
|
||||
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
||||
import android.hardware.fingerprint.IFingerprintClientActiveCallback;
|
||||
import android.hardware.fingerprint.IFingerprintService;
|
||||
import android.hardware.fingerprint.IFingerprintServiceReceiver;
|
||||
@@ -87,9 +87,11 @@ public class FingerprintService extends SystemService {
|
||||
*/
|
||||
private final class FingerprintServiceWrapper extends IFingerprintService.Stub {
|
||||
@Override // Binder call
|
||||
public List<FingerprintSensorProperties> getSensorProperties(String opPackageName) {
|
||||
public List<FingerprintSensorPropertiesInternal> getSensorPropertiesInternal(
|
||||
String opPackageName) {
|
||||
Utils.checkPermission(getContext(), USE_BIOMETRIC_INTERNAL);
|
||||
final List<FingerprintSensorProperties> properties =
|
||||
|
||||
final List<FingerprintSensorPropertiesInternal> properties =
|
||||
FingerprintService.this.getSensorProperties();
|
||||
|
||||
Slog.d(TAG, "Retrieved sensor properties for: " + opPackageName
|
||||
@@ -347,7 +349,8 @@ public class FingerprintService extends SystemService {
|
||||
final long ident = Binder.clearCallingIdentity();
|
||||
try {
|
||||
for (ServiceProvider provider : mServiceProviders) {
|
||||
for (FingerprintSensorProperties props : provider.getSensorProperties()) {
|
||||
for (FingerprintSensorPropertiesInternal props :
|
||||
provider.getSensorProperties()) {
|
||||
if (args.length > 0 && "--proto".equals(args[0])) {
|
||||
provider.dumpProto(props.sensorId, fd);
|
||||
} else {
|
||||
@@ -566,7 +569,7 @@ public class FingerprintService extends SystemService {
|
||||
*/
|
||||
@Nullable
|
||||
private Pair<Integer, ServiceProvider> getSingleProvider() {
|
||||
final List<FingerprintSensorProperties> properties = getSensorProperties();
|
||||
final List<FingerprintSensorPropertiesInternal> properties = getSensorProperties();
|
||||
if (properties.size() != 1) {
|
||||
return null;
|
||||
}
|
||||
@@ -585,8 +588,8 @@ public class FingerprintService extends SystemService {
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private List<FingerprintSensorProperties> getSensorProperties() {
|
||||
final List<FingerprintSensorProperties> properties = new ArrayList<>();
|
||||
private List<FingerprintSensorPropertiesInternal> getSensorProperties() {
|
||||
final List<FingerprintSensorPropertiesInternal> properties = new ArrayList<>();
|
||||
|
||||
for (ServiceProvider provider : mServiceProviders) {
|
||||
properties.addAll(provider.getSensorProperties());
|
||||
|
||||
@@ -20,7 +20,7 @@ import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.hardware.fingerprint.Fingerprint;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.hardware.fingerprint.FingerprintSensorProperties;
|
||||
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
||||
import android.hardware.fingerprint.IFingerprintServiceReceiver;
|
||||
import android.hardware.fingerprint.IUdfpsOverlayController;
|
||||
import android.os.IBinder;
|
||||
@@ -49,8 +49,8 @@ import java.util.List;
|
||||
* }
|
||||
*
|
||||
* For operations that are supported by some providers but not others, clients are required
|
||||
* to check (e.g. via {@link FingerprintManager#getSensorProperties()}) to ensure that the code
|
||||
* path isn't taken. ServiceProviders will provide a no-op for unsupported operations to
|
||||
* to check (e.g. via {@link FingerprintManager#getSensorPropertiesInternal()}) to ensure that the
|
||||
* code path isn't taken. ServiceProviders will provide a no-op for unsupported operations to
|
||||
* fail safely.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@@ -60,7 +60,7 @@ public interface ServiceProvider {
|
||||
*/
|
||||
boolean containsSensor(int sensorId);
|
||||
|
||||
@NonNull List<FingerprintSensorProperties> getSensorProperties();
|
||||
@NonNull List<FingerprintSensorPropertiesInternal> getSensorProperties();
|
||||
|
||||
void scheduleResetLockout(int sensorId, int userId, @Nullable byte[] hardwareAuthToken);
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import android.hardware.biometrics.fingerprint.V2_1.IBiometricsFingerprint;
|
||||
import android.hardware.biometrics.fingerprint.V2_2.IBiometricsFingerprintClientCallback;
|
||||
import android.hardware.fingerprint.Fingerprint;
|
||||
import android.hardware.fingerprint.FingerprintSensorProperties;
|
||||
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
||||
import android.hardware.fingerprint.IFingerprintServiceReceiver;
|
||||
import android.hardware.fingerprint.IUdfpsOverlayController;
|
||||
import android.os.Handler;
|
||||
@@ -91,7 +92,7 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
|
||||
|
||||
final Context mContext;
|
||||
private final IActivityTaskManager mActivityTaskManager;
|
||||
@NonNull private final FingerprintSensorProperties mSensorProperties;
|
||||
@NonNull private final FingerprintSensorPropertiesInternal mSensorProperties;
|
||||
private final BiometricScheduler mScheduler;
|
||||
private final Handler mHandler;
|
||||
private final LockoutResetDispatcher mLockoutResetDispatcher;
|
||||
@@ -347,7 +348,7 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
|
||||
final int maxEnrollmentsPerUser = mContext.getResources()
|
||||
.getInteger(R.integer.config_fingerprintMaxTemplatesPerUser);
|
||||
|
||||
mSensorProperties = new FingerprintSensorProperties(sensorId,
|
||||
mSensorProperties = new FingerprintSensorPropertiesInternal(sensorId,
|
||||
Utils.authenticatorStrengthToPropertyStrength(strength), maxEnrollmentsPerUser,
|
||||
sensorType, resetLockoutRequiresHardwareAuthToken);
|
||||
}
|
||||
@@ -487,8 +488,8 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public List<FingerprintSensorProperties> getSensorProperties() {
|
||||
final List<FingerprintSensorProperties> properties = new ArrayList<>();
|
||||
public List<FingerprintSensorPropertiesInternal> getSensorProperties() {
|
||||
final List<FingerprintSensorPropertiesInternal> properties = new ArrayList<>();
|
||||
properties.add(mSensorProperties);
|
||||
return properties;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.hardware.fingerprint.FingerprintManager.AuthenticationCallback;
|
||||
import android.hardware.fingerprint.FingerprintManager.AuthenticationResult;
|
||||
import android.hardware.fingerprint.FingerprintSensorProperties;
|
||||
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
||||
import android.hardware.fingerprint.IUdfpsOverlayController;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
@@ -124,7 +125,7 @@ public class Fingerprint21UdfpsMock extends Fingerprint21 implements TrustManage
|
||||
|
||||
@NonNull private final TestableBiometricScheduler mScheduler;
|
||||
@NonNull private final Handler mHandler;
|
||||
@NonNull private final FingerprintSensorProperties mSensorProperties;
|
||||
@NonNull private final FingerprintSensorPropertiesInternal mSensorProperties;
|
||||
@NonNull private final MockHalResultController mMockHalResultController;
|
||||
@NonNull private final TrustManager mTrustManager;
|
||||
@NonNull private final SparseBooleanArray mUserHasTrust;
|
||||
@@ -418,7 +419,7 @@ public class Fingerprint21UdfpsMock extends Fingerprint21 implements TrustManage
|
||||
final boolean resetLockoutRequiresHardwareAuthToken = false;
|
||||
final int maxTemplatesAllowed = mContext.getResources()
|
||||
.getInteger(R.integer.config_fingerprintMaxTemplatesPerUser);
|
||||
mSensorProperties = new FingerprintSensorProperties(sensorId,
|
||||
mSensorProperties = new FingerprintSensorPropertiesInternal(sensorId,
|
||||
Utils.authenticatorStrengthToPropertyStrength(strength), maxTemplatesAllowed,
|
||||
FingerprintSensorProperties.TYPE_UDFPS_OPTICAL,
|
||||
resetLockoutRequiresHardwareAuthToken);
|
||||
@@ -453,8 +454,8 @@ public class Fingerprint21UdfpsMock extends Fingerprint21 implements TrustManage
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public List<FingerprintSensorProperties> getSensorProperties() {
|
||||
final List<FingerprintSensorProperties> properties = new ArrayList<>();
|
||||
public List<FingerprintSensorPropertiesInternal> getSensorProperties() {
|
||||
final List<FingerprintSensorPropertiesInternal> properties = new ArrayList<>();
|
||||
properties.add(mSensorProperties);
|
||||
return properties;
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@ import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.content.Context;
|
||||
import android.hardware.face.FaceManager;
|
||||
import android.hardware.face.FaceSensorProperties;
|
||||
import android.hardware.face.FaceSensorPropertiesInternal;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.hardware.fingerprint.FingerprintSensorProperties;
|
||||
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.ServiceManager;
|
||||
@@ -34,7 +34,6 @@ import com.android.internal.widget.VerifyCredentialResponse;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -203,9 +202,9 @@ public class BiometricDeferredQueue {
|
||||
|
||||
private void processPendingLockoutsForFingerprint(List<UserAuthInfo> pendingResetLockouts) {
|
||||
if (mFingerprintManager != null) {
|
||||
final List<FingerprintSensorProperties> fingerprintSensorProperties =
|
||||
mFingerprintManager.getSensorProperties();
|
||||
for (FingerprintSensorProperties prop : fingerprintSensorProperties) {
|
||||
final List<FingerprintSensorPropertiesInternal> fingerprintSensorProperties =
|
||||
mFingerprintManager.getSensorPropertiesInternal();
|
||||
for (FingerprintSensorPropertiesInternal prop : fingerprintSensorProperties) {
|
||||
if (!prop.resetLockoutRequiresHardwareAuthToken) {
|
||||
for (UserAuthInfo user : pendingResetLockouts) {
|
||||
mFingerprintManager.resetLockout(prop.sensorId, user.userId,
|
||||
@@ -238,16 +237,16 @@ public class BiometricDeferredQueue {
|
||||
Slog.w(TAG, "mFaceGenerateChallengeCallback not null, previous operation may be"
|
||||
+ " stuck");
|
||||
}
|
||||
final List<FaceSensorProperties> faceSensorProperties =
|
||||
mFaceManager.getSensorProperties();
|
||||
final List<FaceSensorPropertiesInternal> faceSensorProperties =
|
||||
mFaceManager.getSensorPropertiesInternal();
|
||||
final Set<Integer> sensorIds = new ArraySet<>();
|
||||
for (FaceSensorProperties prop : faceSensorProperties) {
|
||||
for (FaceSensorPropertiesInternal prop : faceSensorProperties) {
|
||||
sensorIds.add(prop.sensorId);
|
||||
}
|
||||
|
||||
mFaceResetLockoutTask = new FaceResetLockoutTask(mFaceFinishCallback, mFaceManager,
|
||||
mSpManager, sensorIds, pendingResetLockouts);
|
||||
for (final FaceSensorProperties prop : faceSensorProperties) {
|
||||
for (final FaceSensorPropertiesInternal prop : faceSensorProperties) {
|
||||
// Generate a challenge for each sensor. The challenge does not need to be
|
||||
// per-user, since the HAT returned by gatekeeper contains userId.
|
||||
mFaceManager.generateChallenge(prop.sensorId, mFaceResetLockoutTask);
|
||||
|
||||
Reference in New Issue
Block a user