Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 03603f3b authored by Ilya Matyukhin's avatar Ilya Matyukhin
Browse files

Allow UDFPS props to be overlayed

Bug: 179175099
Test: on device
Change-Id: Ib4bc3c89fcacf4bd0a972f7111aa41ed217332e6
parent ba8bc8e9
Loading
Loading
Loading
Loading
+31 −3
Original line number Diff line number Diff line
@@ -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) {
+9 −0
Original line number Diff line number Diff line
@@ -4404,6 +4404,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 -->
+1 −0
Original line number Diff line number Diff line
@@ -2540,6 +2540,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" />
+12 −12
Original line number Diff line number Diff line
@@ -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);
    }