Loading packages/SystemUI/shared/biometrics/src/com/android/systemui/biometrics/shared/model/FingerprintSensor.kt +14 −2 Original line number Diff line number Diff line Loading @@ -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]. */ Loading @@ -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, ) } packages/SystemUI/shared/biometrics/src/com/android/systemui/biometrics/shared/model/SensorStrength.kt +7 −0 Original line number Diff line number Diff line Loading @@ -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 } Loading
packages/SystemUI/shared/biometrics/src/com/android/systemui/biometrics/shared/model/FingerprintSensor.kt +14 −2 Original line number Diff line number Diff line Loading @@ -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]. */ Loading @@ -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, ) }
packages/SystemUI/shared/biometrics/src/com/android/systemui/biometrics/shared/model/SensorStrength.kt +7 −0 Original line number Diff line number Diff line Loading @@ -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 }