Merge "Allow UDFPS props to be overlayed" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-02-03 11:19:34 +00:00
committed by Android (Google) Code Review
4 changed files with 53 additions and 15 deletions

View File

@@ -19,6 +19,8 @@ package android.hardware.fingerprint;
import static android.hardware.fingerprint.FingerprintSensorProperties.TYPE_UDFPS_OPTICAL;
import static android.hardware.fingerprint.FingerprintSensorProperties.TYPE_UDFPS_ULTRASONIC;
import android.annotation.NonNull;
import android.content.Context;
import android.hardware.biometrics.SensorProperties;
import android.hardware.biometrics.SensorPropertiesInternal;
import android.os.Parcel;
@@ -81,10 +83,36 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna
@SensorProperties.Strength int strength, int maxEnrollmentsPerUser,
@FingerprintSensorProperties.SensorType int sensorType,
boolean resetLockoutRequiresHardwareAuthToken) {
// TODO: Value should be provided from the HAL
// TODO(b/179175438): Value should be provided from the HAL
this(sensorId, strength, maxEnrollmentsPerUser, sensorType,
resetLockoutRequiresHardwareAuthToken, 540 /* sensorLocationX */,
1769 /* sensorLocationY */, 130 /* sensorRadius */);
resetLockoutRequiresHardwareAuthToken, 0 /* sensorLocationX */,
0 /* sensorLocationY */, 0 /* 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,
@FingerprintSensorProperties.SensorType int sensorType,
boolean resetLockoutRequiresHardwareAuthToken) {
super(sensorId, strength, maxEnrollmentsPerUser);
this.sensorType = sensorType;
this.resetLockoutRequiresHardwareAuthToken = resetLockoutRequiresHardwareAuthToken;
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 {
this.sensorLocationX = 0;
this.sensorLocationY = 0;
this.sensorRadius = 0;
}
}
protected FingerprintSensorPropertiesInternal(Parcel in) {

View File

@@ -4407,6 +4407,15 @@
<!--If true, allows the device to load udfps components on older HIDL implementations -->
<bool name="allow_test_udfps" translatable="false" >false</bool>
<!-- The properties of a UDFPS sensor in pixels, in the order listed below: -->
<integer-array name="config_udfps_sensor_props" translatable="false" >
<!--
<item>sensorLocationX</item>
<item>sensorLocationY</item>
<item>sensorRadius</item>
-->
</integer-array>
<!-- Messages that should not be shown to the user during face auth enrollment. This should be
used to hide messages that may be too chatty or messages that the user can't do much about.
Entries are defined in android.hardware.biometrics.face@1.0 types.hal -->

View File

@@ -2541,6 +2541,7 @@
<java-symbol type="string" name="config_biometric_prompt_ui_package" />
<java-symbol type="array" name="config_biometric_sensors" />
<java-symbol type="bool" name="allow_test_udfps" />
<java-symbol type="array" name="config_udfps_sensor_props" />
<java-symbol type="array" name="config_face_acquire_enroll_ignorelist" />
<java-symbol type="array" name="config_face_acquire_vendor_enroll_ignorelist" />

View File

@@ -145,11 +145,11 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
private final LockoutFrameworkImpl.LockoutResetCallback mLockoutResetCallback =
new LockoutFrameworkImpl.LockoutResetCallback() {
@Override
public void onLockoutReset(int userId) {
mLockoutResetDispatcher.notifyLockoutResetCallbacks(mSensorProperties.sensorId);
}
};
@Override
public void onLockoutReset(int userId) {
mLockoutResetDispatcher.notifyLockoutResetCallbacks(mSensorProperties.sensorId);
}
};
private final UserSwitchObserver mUserSwitchObserver = new SynchronousUserSwitchObserver() {
@Override
@@ -356,7 +356,7 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
final int maxEnrollmentsPerUser = mContext.getResources()
.getInteger(R.integer.config_fingerprintMaxTemplatesPerUser);
mSensorProperties = new FingerprintSensorPropertiesInternal(sensorId,
mSensorProperties = new FingerprintSensorPropertiesInternal(context, sensorId,
Utils.authenticatorStrengthToPropertyStrength(strength), maxEnrollmentsPerUser,
sensorType, resetLockoutRequiresHardwareAuthToken);
}
@@ -631,13 +631,13 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
@NonNull IFingerprintServiceReceiver receiver, int fingerId, int userId,
@NonNull String opPackageName) {
mHandler.post(() -> {
scheduleUpdateActiveUserWithoutHandler(userId);
scheduleUpdateActiveUserWithoutHandler(userId);
final FingerprintRemovalClient client = new FingerprintRemovalClient(mContext,
mLazyDaemon, token, new ClientMonitorCallbackConverter(receiver), fingerId,
userId, opPackageName, FingerprintUtils.getLegacyInstance(mSensorId),
mSensorProperties.sensorId, mAuthenticatorIds);
mScheduler.scheduleClientMonitor(client);
final FingerprintRemovalClient client = new FingerprintRemovalClient(mContext,
mLazyDaemon, token, new ClientMonitorCallbackConverter(receiver), fingerId,
userId, opPackageName, FingerprintUtils.getLegacyInstance(mSensorId),
mSensorProperties.sensorId, mAuthenticatorIds);
mScheduler.scheduleClientMonitor(client);
});
}