Loading core/java/android/hardware/biometrics/SensorLocationInternal.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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; // @hide parcelable SensorLocationInternal; core/java/android/hardware/biometrics/SensorLocationInternal.java 0 → 100644 +112 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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.NonNull; import android.annotation.Nullable; import android.os.Parcel; import android.os.Parcelable; /** * The location of a sensor relative to a physical display. * * Note that the location may change depending on other attributes of the device, such as * fold status, which are not yet included in this class. * @hide */ public class SensorLocationInternal implements Parcelable { /** Default value to use when the sensor's location is unknown or undefined. */ public static final SensorLocationInternal DEFAULT = new SensorLocationInternal("", 0, 0, 0); /** * The stable display id. */ @NonNull public final String displayId; /** * The location of the center of the sensor if applicable. For example, sensors of type * {@link FingerprintSensorProperties#TYPE_UDFPS_OPTICAL} would report this value as the * distance in pixels, measured from the left edge of the screen. */ public final int sensorLocationX; /** * The location of the center of the sensor if applicable. For example, sensors of type * {@link FingerprintSensorProperties#TYPE_UDFPS_OPTICAL} would report this value as the * distance in pixels, measured from the top edge of the screen. * */ public final int sensorLocationY; /** * The radius of the sensor if applicable. For example, sensors of type * {@link FingerprintSensorProperties#TYPE_UDFPS_OPTICAL} would report this value as the radius * of the sensor, in pixels. */ public final int sensorRadius; public SensorLocationInternal(@Nullable String displayId, int sensorLocationX, int sensorLocationY, int sensorRadius) { this.displayId = displayId != null ? displayId : ""; this.sensorLocationX = sensorLocationX; this.sensorLocationY = sensorLocationY; this.sensorRadius = sensorRadius; } protected SensorLocationInternal(Parcel in) { displayId = in.readString16NoHelper(); sensorLocationX = in.readInt(); sensorLocationY = in.readInt(); sensorRadius = in.readInt(); } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(displayId); dest.writeInt(sensorLocationX); dest.writeInt(sensorLocationY); dest.writeInt(sensorRadius); } @Override public int describeContents() { return 0; } public static final Creator<SensorLocationInternal> CREATOR = new Creator<SensorLocationInternal>() { @Override public SensorLocationInternal createFromParcel(Parcel in) { return new SensorLocationInternal(in); } @Override public SensorLocationInternal[] newArray(int size) { return new SensorLocationInternal[size]; } }; @Override public String toString() { return "[id: " + displayId + ", x: " + sensorLocationX + ", y: " + sensorLocationY + ", r: " + sensorRadius + "]"; } } core/java/android/hardware/fingerprint/FingerprintSensorPropertiesInternal.java +49 −34 Original line number Diff line number Diff line Loading @@ -21,7 +21,9 @@ import static android.hardware.fingerprint.FingerprintSensorProperties.TYPE_UDFP import static android.hardware.fingerprint.FingerprintSensorProperties.TYPE_UDFPS_ULTRASONIC; import android.annotation.NonNull; import android.annotation.Nullable; import android.hardware.biometrics.ComponentInfoInternal; import android.hardware.biometrics.SensorLocationInternal; import android.hardware.biometrics.SensorProperties; import android.hardware.biometrics.SensorPropertiesInternal; import android.os.Parcel; Loading @@ -38,34 +40,14 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna */ public final @FingerprintSensorProperties.SensorType int sensorType; /** * The location of the center of the sensor if applicable. For example, sensors of type * {@link FingerprintSensorProperties#TYPE_UDFPS_OPTICAL} would report this value as the * distance in pixels, measured from the left edge of the screen. */ public final int sensorLocationX; /** * The location of the center of the sensor if applicable. For example, sensors of type * {@link FingerprintSensorProperties#TYPE_UDFPS_OPTICAL} would report this value as the * distance in pixels, measured from the top edge of the screen. * */ public final int sensorLocationY; /** * The radius of the sensor if applicable. For example, sensors of type * {@link FingerprintSensorProperties#TYPE_UDFPS_OPTICAL} would report this value as the radius * of the sensor, in pixels. */ public final int sensorRadius; private final List<SensorLocationInternal> mSensorLocations; public FingerprintSensorPropertiesInternal(int sensorId, @SensorProperties.Strength int strength, int maxEnrollmentsPerUser, @NonNull List<ComponentInfoInternal> componentInfo, @FingerprintSensorProperties.SensorType int sensorType, boolean resetLockoutRequiresHardwareAuthToken, int sensorLocationX, int sensorLocationY, int sensorRadius) { boolean resetLockoutRequiresHardwareAuthToken, @NonNull List<SensorLocationInternal> sensorLocations) { // IBiometricsFingerprint@2.1 handles lockout in the framework, so the challenge is not // required as it can only be generated/attested/verified by TEE components. // IFingerprint@1.0 handles lockout below the HAL, but does not require a challenge. See Loading @@ -73,9 +55,7 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna super(sensorId, strength, maxEnrollmentsPerUser, componentInfo, resetLockoutRequiresHardwareAuthToken, false /* resetLockoutRequiresChallenge */); this.sensorType = sensorType; this.sensorLocationX = sensorLocationX; this.sensorLocationY = sensorLocationY; this.sensorRadius = sensorRadius; this.mSensorLocations = List.copyOf(sensorLocations); } /** Loading @@ -88,16 +68,15 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna boolean resetLockoutRequiresHardwareAuthToken) { // TODO(b/179175438): Value should be provided from the HAL this(sensorId, strength, maxEnrollmentsPerUser, componentInfo, sensorType, resetLockoutRequiresHardwareAuthToken, 540 /* sensorLocationX */, 1636 /* sensorLocationY */, 130 /* sensorRadius */); resetLockoutRequiresHardwareAuthToken, List.of(new SensorLocationInternal( "" /* displayId */, 540 /* sensorLocationX */, 1636 /* sensorLocationY */, 130 /* sensorRadius */))); } protected FingerprintSensorPropertiesInternal(Parcel in) { super(in); sensorType = in.readInt(); sensorLocationX = in.readInt(); sensorLocationY = in.readInt(); sensorRadius = in.readInt(); mSensorLocations = in.createTypedArrayList(SensorLocationInternal.CREATOR); } public static final Creator<FingerprintSensorPropertiesInternal> CREATOR = Loading @@ -122,9 +101,7 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna public void writeToParcel(Parcel dest, int flags) { super.writeToParcel(dest, flags); dest.writeInt(sensorType); dest.writeInt(sensorLocationX); dest.writeInt(sensorLocationY); dest.writeInt(sensorRadius); dest.writeTypedList(mSensorLocations); } public boolean isAnyUdfpsType() { Loading @@ -150,6 +127,44 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna } } /** * Get the default location. * * Use this method when the sensor's relationship to the displays on the device do not * matter. * @return */ @NonNull public SensorLocationInternal getLocation() { final SensorLocationInternal location = getLocation("" /* displayId */); return location != null ? location : SensorLocationInternal.DEFAULT; } /** * Get the location of a sensor relative to a physical display layout. * * @param displayId stable display id * @return location or null if none is specified */ @Nullable public SensorLocationInternal getLocation(String displayId) { for (SensorLocationInternal location : mSensorLocations) { if (location.displayId.equals(displayId)) { return location; } } return null; } /** * Gets all locations relative to all supported display layouts. * @return supported locations */ @NonNull public List<SensorLocationInternal> getAllLocations() { return mSensorLocations; } @Override public String toString() { return "ID: " + sensorId + ", Strength: " + sensorStrength + ", Type: " + sensorType; Loading core/res/res/values/config.xml +14 −0 Original line number Diff line number Diff line Loading @@ -4576,6 +4576,20 @@ --> </integer-array> <!-- An array of arrays of side fingerprint sensor properties relative to each display. Note: this value is temporary and is expected to be queried directly from the HAL in the future. --> <array name="config_sfps_sensor_props" translatable="false"> <!-- <array> <item>displayId</item> <item>sensorLocationX</item> <item>sensorLocationY</item> <item>sensorRadius</item> <array> --> </array> <!-- How long it takes for the HW to start illuminating after the illumination is requested. --> <integer name="config_udfps_illumination_transition_ms">50</integer> Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -2609,6 +2609,7 @@ <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_sfps_sensor_props" /> <java-symbol type="integer" name="config_udfps_illumination_transition_ms" /> <java-symbol type="bool" name="config_is_powerbutton_fps" /> Loading Loading
core/java/android/hardware/biometrics/SensorLocationInternal.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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; // @hide parcelable SensorLocationInternal;
core/java/android/hardware/biometrics/SensorLocationInternal.java 0 → 100644 +112 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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.NonNull; import android.annotation.Nullable; import android.os.Parcel; import android.os.Parcelable; /** * The location of a sensor relative to a physical display. * * Note that the location may change depending on other attributes of the device, such as * fold status, which are not yet included in this class. * @hide */ public class SensorLocationInternal implements Parcelable { /** Default value to use when the sensor's location is unknown or undefined. */ public static final SensorLocationInternal DEFAULT = new SensorLocationInternal("", 0, 0, 0); /** * The stable display id. */ @NonNull public final String displayId; /** * The location of the center of the sensor if applicable. For example, sensors of type * {@link FingerprintSensorProperties#TYPE_UDFPS_OPTICAL} would report this value as the * distance in pixels, measured from the left edge of the screen. */ public final int sensorLocationX; /** * The location of the center of the sensor if applicable. For example, sensors of type * {@link FingerprintSensorProperties#TYPE_UDFPS_OPTICAL} would report this value as the * distance in pixels, measured from the top edge of the screen. * */ public final int sensorLocationY; /** * The radius of the sensor if applicable. For example, sensors of type * {@link FingerprintSensorProperties#TYPE_UDFPS_OPTICAL} would report this value as the radius * of the sensor, in pixels. */ public final int sensorRadius; public SensorLocationInternal(@Nullable String displayId, int sensorLocationX, int sensorLocationY, int sensorRadius) { this.displayId = displayId != null ? displayId : ""; this.sensorLocationX = sensorLocationX; this.sensorLocationY = sensorLocationY; this.sensorRadius = sensorRadius; } protected SensorLocationInternal(Parcel in) { displayId = in.readString16NoHelper(); sensorLocationX = in.readInt(); sensorLocationY = in.readInt(); sensorRadius = in.readInt(); } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(displayId); dest.writeInt(sensorLocationX); dest.writeInt(sensorLocationY); dest.writeInt(sensorRadius); } @Override public int describeContents() { return 0; } public static final Creator<SensorLocationInternal> CREATOR = new Creator<SensorLocationInternal>() { @Override public SensorLocationInternal createFromParcel(Parcel in) { return new SensorLocationInternal(in); } @Override public SensorLocationInternal[] newArray(int size) { return new SensorLocationInternal[size]; } }; @Override public String toString() { return "[id: " + displayId + ", x: " + sensorLocationX + ", y: " + sensorLocationY + ", r: " + sensorRadius + "]"; } }
core/java/android/hardware/fingerprint/FingerprintSensorPropertiesInternal.java +49 −34 Original line number Diff line number Diff line Loading @@ -21,7 +21,9 @@ import static android.hardware.fingerprint.FingerprintSensorProperties.TYPE_UDFP import static android.hardware.fingerprint.FingerprintSensorProperties.TYPE_UDFPS_ULTRASONIC; import android.annotation.NonNull; import android.annotation.Nullable; import android.hardware.biometrics.ComponentInfoInternal; import android.hardware.biometrics.SensorLocationInternal; import android.hardware.biometrics.SensorProperties; import android.hardware.biometrics.SensorPropertiesInternal; import android.os.Parcel; Loading @@ -38,34 +40,14 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna */ public final @FingerprintSensorProperties.SensorType int sensorType; /** * The location of the center of the sensor if applicable. For example, sensors of type * {@link FingerprintSensorProperties#TYPE_UDFPS_OPTICAL} would report this value as the * distance in pixels, measured from the left edge of the screen. */ public final int sensorLocationX; /** * The location of the center of the sensor if applicable. For example, sensors of type * {@link FingerprintSensorProperties#TYPE_UDFPS_OPTICAL} would report this value as the * distance in pixels, measured from the top edge of the screen. * */ public final int sensorLocationY; /** * The radius of the sensor if applicable. For example, sensors of type * {@link FingerprintSensorProperties#TYPE_UDFPS_OPTICAL} would report this value as the radius * of the sensor, in pixels. */ public final int sensorRadius; private final List<SensorLocationInternal> mSensorLocations; public FingerprintSensorPropertiesInternal(int sensorId, @SensorProperties.Strength int strength, int maxEnrollmentsPerUser, @NonNull List<ComponentInfoInternal> componentInfo, @FingerprintSensorProperties.SensorType int sensorType, boolean resetLockoutRequiresHardwareAuthToken, int sensorLocationX, int sensorLocationY, int sensorRadius) { boolean resetLockoutRequiresHardwareAuthToken, @NonNull List<SensorLocationInternal> sensorLocations) { // IBiometricsFingerprint@2.1 handles lockout in the framework, so the challenge is not // required as it can only be generated/attested/verified by TEE components. // IFingerprint@1.0 handles lockout below the HAL, but does not require a challenge. See Loading @@ -73,9 +55,7 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna super(sensorId, strength, maxEnrollmentsPerUser, componentInfo, resetLockoutRequiresHardwareAuthToken, false /* resetLockoutRequiresChallenge */); this.sensorType = sensorType; this.sensorLocationX = sensorLocationX; this.sensorLocationY = sensorLocationY; this.sensorRadius = sensorRadius; this.mSensorLocations = List.copyOf(sensorLocations); } /** Loading @@ -88,16 +68,15 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna boolean resetLockoutRequiresHardwareAuthToken) { // TODO(b/179175438): Value should be provided from the HAL this(sensorId, strength, maxEnrollmentsPerUser, componentInfo, sensorType, resetLockoutRequiresHardwareAuthToken, 540 /* sensorLocationX */, 1636 /* sensorLocationY */, 130 /* sensorRadius */); resetLockoutRequiresHardwareAuthToken, List.of(new SensorLocationInternal( "" /* displayId */, 540 /* sensorLocationX */, 1636 /* sensorLocationY */, 130 /* sensorRadius */))); } protected FingerprintSensorPropertiesInternal(Parcel in) { super(in); sensorType = in.readInt(); sensorLocationX = in.readInt(); sensorLocationY = in.readInt(); sensorRadius = in.readInt(); mSensorLocations = in.createTypedArrayList(SensorLocationInternal.CREATOR); } public static final Creator<FingerprintSensorPropertiesInternal> CREATOR = Loading @@ -122,9 +101,7 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna public void writeToParcel(Parcel dest, int flags) { super.writeToParcel(dest, flags); dest.writeInt(sensorType); dest.writeInt(sensorLocationX); dest.writeInt(sensorLocationY); dest.writeInt(sensorRadius); dest.writeTypedList(mSensorLocations); } public boolean isAnyUdfpsType() { Loading @@ -150,6 +127,44 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna } } /** * Get the default location. * * Use this method when the sensor's relationship to the displays on the device do not * matter. * @return */ @NonNull public SensorLocationInternal getLocation() { final SensorLocationInternal location = getLocation("" /* displayId */); return location != null ? location : SensorLocationInternal.DEFAULT; } /** * Get the location of a sensor relative to a physical display layout. * * @param displayId stable display id * @return location or null if none is specified */ @Nullable public SensorLocationInternal getLocation(String displayId) { for (SensorLocationInternal location : mSensorLocations) { if (location.displayId.equals(displayId)) { return location; } } return null; } /** * Gets all locations relative to all supported display layouts. * @return supported locations */ @NonNull public List<SensorLocationInternal> getAllLocations() { return mSensorLocations; } @Override public String toString() { return "ID: " + sensorId + ", Strength: " + sensorStrength + ", Type: " + sensorType; Loading
core/res/res/values/config.xml +14 −0 Original line number Diff line number Diff line Loading @@ -4576,6 +4576,20 @@ --> </integer-array> <!-- An array of arrays of side fingerprint sensor properties relative to each display. Note: this value is temporary and is expected to be queried directly from the HAL in the future. --> <array name="config_sfps_sensor_props" translatable="false"> <!-- <array> <item>displayId</item> <item>sensorLocationX</item> <item>sensorLocationY</item> <item>sensorRadius</item> <array> --> </array> <!-- How long it takes for the HW to start illuminating after the illumination is requested. --> <integer name="config_udfps_illumination_transition_ms">50</integer> Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -2609,6 +2609,7 @@ <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_sfps_sensor_props" /> <java-symbol type="integer" name="config_udfps_illumination_transition_ms" /> <java-symbol type="bool" name="config_is_powerbutton_fps" /> Loading