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

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
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -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,
    )
}
+7 −0
Original line number Diff line number Diff line
@@ -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
    }