UdfpsAnimation: Use UDFPS props verification before checking service
Apparently, using getSensorPropertiesInternal here even if you grant TEST_BIOMETRICS permissions results in a crash in some devices. Let's use the previous udfps check first and move onto the new one for incompatible devices.
This commit is contained in:
parent
b54d477426
commit
a0d40d005a
|
@ -52,16 +52,21 @@ class UdfpsAnimationSectionController(
|
|||
}
|
||||
|
||||
private fun isUdfpsAvailable(context: Context): Boolean {
|
||||
val hasFingerprint = context.packageManager
|
||||
.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)
|
||||
return if (hasFingerprint) {
|
||||
val fingerprintManger =
|
||||
context.getSystemService(Context.FINGERPRINT_SERVICE) as FingerprintManager
|
||||
return if (context.resources
|
||||
.getIntArray(com.android.internal.R.array.config_udfps_sensor_props).isNotEmpty())
|
||||
true
|
||||
else {
|
||||
val hasFingerprint = context.packageManager
|
||||
.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)
|
||||
if (hasFingerprint) {
|
||||
val fingerprintManager =
|
||||
context.getSystemService(Context.FINGERPRINT_SERVICE) as FingerprintManager
|
||||
val udfpsProps =
|
||||
fingerprintManger.getSensorPropertiesInternal().filter { it.isAnyUdfpsType() }
|
||||
fingerprintManager.getSensorPropertiesInternal().filter { it.isAnyUdfpsType() }
|
||||
udfpsProps.isNotEmpty() // return
|
||||
} else {
|
||||
false
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue