Skip to content
Snippets Groups Projects
Commit a90f38ae authored by Joshua Mccloskey's avatar Joshua Mccloskey Committed by Android (Google) Code Review
Browse files

Merge "Added additional properties to FingerprintSensor" into main

parents 0343daa8 ac173383
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,7 @@
package com.android.systemui.biometrics.shared.model
import android.graphics.Rect
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal
/** Fingerprint sensor property. Represents [FingerprintSensorPropertiesInternal]. */
......@@ -23,12 +24,23 @@ data class FingerprintSensor(
val sensorId: Int,
val sensorStrength: SensorStrength,
val maxEnrollmentsPerUser: Int,
val sensorType: FingerprintSensorType
val sensorType: FingerprintSensorType,
val sensorBounds: Rect,
val sensorRadius: Int,
)
/** Convert [FingerprintSensorPropertiesInternal] to corresponding [FingerprintSensor] */
fun FingerprintSensorPropertiesInternal.toFingerprintSensor(): FingerprintSensor {
val sensorStrength: SensorStrength = this.sensorStrength.toSensorStrength()
val sensorType: FingerprintSensorType = this.sensorType.toSensorType()
return FingerprintSensor(this.sensorId, sensorStrength, this.maxEnrollmentsPerUser, sensorType)
val sensorBounds: Rect = this.location.rect
val sensorRadius = this.location.sensorRadius
return FingerprintSensor(
this.sensorId,
sensorStrength,
this.maxEnrollmentsPerUser,
sensorType,
sensorBounds,
sensorRadius,
)
}
......@@ -33,3 +33,10 @@ fun Int.toSensorStrength(): SensorStrength =
SensorProperties.STRENGTH_STRONG -> SensorStrength.STRONG
else -> throw IllegalArgumentException("Invalid SensorStrength value: $this")
}
/** Convert [SensorStrength] to corresponding [Int] */
fun SensorStrength.toInt(): Int =
when (this) {
SensorStrength.CONVENIENCE -> SensorProperties.STRENGTH_CONVENIENCE
SensorStrength.WEAK -> SensorProperties.STRENGTH_WEAK
SensorStrength.STRONG -> SensorProperties.STRENGTH_STRONG
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment