From 7d19b1ef7a029be61677148a13290156aefdbf4c Mon Sep 17 00:00:00 2001 From: Joe Bolinger Date: Wed, 12 May 2021 18:08:20 -0700 Subject: [PATCH] Add extra flags to biometrics proto for tests. Bug: 185290945 Test: atest android.server.biometrics.fingerprint.FingerprintServiceTest#testRejectThenErrorFromForegroundActivity Change-Id: I10cfdf0a2183643f9957b2a6f8a9448a8de858a0 --- core/proto/android/server/biometrics.proto | 8 ++++++++ .../biometrics/sensors/fingerprint/aidl/Sensor.java | 3 +++ .../sensors/fingerprint/hidl/Fingerprint21.java | 3 +++ 3 files changed, 14 insertions(+) diff --git a/core/proto/android/server/biometrics.proto b/core/proto/android/server/biometrics.proto index c918dbbede268..ac9e3e001d504 100644 --- a/core/proto/android/server/biometrics.proto +++ b/core/proto/android/server/biometrics.proto @@ -113,11 +113,16 @@ message SensorStateProto { IRIS = 3; } + enum ModalityFlag { + FINGERPRINT_UDFPS = 0; + } + option (.android.msg_privacy).dest = DEST_AUTOMATIC; // Unique sensorId optional int32 sensor_id = 1; + // The type of the sensor. optional Modality modality = 2; // The current strength (see {@link BiometricManager.Authenticators}) of this sensor, taking any @@ -137,6 +142,9 @@ message SensorStateProto { // True if a HAT is required (field above) AND a challenge needs to be generated by the // biometric TEE (or equivalent), and wrapped within the HAT. optional bool reset_lockout_requires_challenge = 7; + + // Detailed information about the sensor's modality, if available. + repeated ModalityFlag modality_flags = 8; } // State of a specific user for a specific sensor. diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/Sensor.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/Sensor.java index cf915ad78509a..368ac920a4139 100644 --- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/Sensor.java +++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/Sensor.java @@ -529,6 +529,9 @@ class Sensor { proto.write(SensorStateProto.SENSOR_ID, mSensorProperties.sensorId); proto.write(SensorStateProto.MODALITY, SensorStateProto.FINGERPRINT); + if (mSensorProperties.isAnyUdfpsType()) { + proto.write(SensorStateProto.MODALITY_FLAGS, SensorStateProto.FINGERPRINT_UDFPS); + } proto.write(SensorStateProto.CURRENT_STRENGTH, Utils.getCurrentStrength(mSensorProperties.sensorId)); proto.write(SensorStateProto.SCHEDULER, mScheduler.dumpProtoState(clearSchedulerBuffer)); diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java index 2746520966247..33532643b7196 100644 --- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java +++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java @@ -760,6 +760,9 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider proto.write(SensorStateProto.SENSOR_ID, mSensorProperties.sensorId); proto.write(SensorStateProto.MODALITY, SensorStateProto.FINGERPRINT); + if (mSensorProperties.isAnyUdfpsType()) { + proto.write(SensorStateProto.MODALITY_FLAGS, SensorStateProto.FINGERPRINT_UDFPS); + } proto.write(SensorStateProto.CURRENT_STRENGTH, Utils.getCurrentStrength(mSensorProperties.sensorId)); proto.write(SensorStateProto.SCHEDULER, mScheduler.dumpProtoState(clearSchedulerBuffer));