Fixed
Status Update
Comments
ca...@gmail.com <ca...@gmail.com> #2
This even happens on some devices with API < 23.
cu...@google.com <cu...@google.com>
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit 3212e7c8d4646da3e440a4b8d8208048e919a7af
Author: Curtis Belmonte <curtislb@google.com>
Date: Fri Jan 15 15:25:46 2021
Fix BiometricManager error code for unsecured device
Currently, BiometricManager#canAuthenticate(int) will always return
BIOMETRIC_NONE_ENROLLED if the device is not secured with a credential,
since no form of authentication is possible. However, this error code
is incorrect if (1) the argument passed to canAuthenticate(int) does not
allow device credential authentication and (2) the device has no
biometric sensor. Instead, BIOMETRIC_ERROR_NO_HARDWARE should be
returned in this case.
This commit fixes the issue by returning BIOMETRIC_NONE_ENROLLED early
*only* if the device is not secured with a credential and device
credential authentication is allowed. In order to still indicate that
authentication is definitely not possible if the device is unsecured,
the canAuthenticate(int) method now returns the FingerprintManager error
code instead of BIOMETRIC_STATUS_UNKNOWN in some cases.
Test: Biometric integration test app on API 27-30.
Test: ./gradlew biometric:biometric:test
Test: ./gradlew biometric:biometric:connectedAndroidTest
Fixes: 174505824
Change-Id: I79b7dbf009c44582c4693be5d27dd850777ab4d1
M biometric/biometric/src/main/java/androidx/biometric/BiometricManager.java
M biometric/biometric/src/test/java/androidx/biometric/BiometricManagerTest.java
https://android-review.googlesource.com/1553145
Branch: androidx-main
commit 3212e7c8d4646da3e440a4b8d8208048e919a7af
Author: Curtis Belmonte <curtislb@google.com>
Date: Fri Jan 15 15:25:46 2021
Fix BiometricManager error code for unsecured device
Currently, BiometricManager#canAuthenticate(int) will always return
BIOMETRIC_NONE_ENROLLED if the device is not secured with a credential,
since no form of authentication is possible. However, this error code
is incorrect if (1) the argument passed to canAuthenticate(int) does not
allow device credential authentication and (2) the device has no
biometric sensor. Instead, BIOMETRIC_ERROR_NO_HARDWARE should be
returned in this case.
This commit fixes the issue by returning BIOMETRIC_NONE_ENROLLED early
*only* if the device is not secured with a credential and device
credential authentication is allowed. In order to still indicate that
authentication is definitely not possible if the device is unsecured,
the canAuthenticate(int) method now returns the FingerprintManager error
code instead of BIOMETRIC_STATUS_UNKNOWN in some cases.
Test: Biometric integration test app on API 27-30.
Test: ./gradlew biometric:biometric:test
Test: ./gradlew biometric:biometric:connectedAndroidTest
Fixes: 174505824
Change-Id: I79b7dbf009c44582c4693be5d27dd850777ab4d1
M biometric/biometric/src/main/java/androidx/biometric/BiometricManager.java
M biometric/biometric/src/test/java/androidx/biometric/BiometricManagerTest.java
an...@gmail.com <an...@gmail.com> #4
Comment has been deleted.
Description
If this is a bug in the library, we would appreciate if you could attach: This bug is reproducible when the device(without fingerprint feature) hasn't PIN-protected enable and you call
canAuthenticate()
method. It returns the statusBIOMETRIC_ERROR_NONE_ENROLLED
, but should returnBIOMETRIC_ERROR_NO_HARDWARE
.In case if PIN protect is enabled,
canAuthenticate
returnsBIOMETRIC_ERROR_NO_HARDWARE
It simply to fix. You should check first if the device has a Fingerprint feature before you check
mInjector.isDeviceSecuredWithCredential()
on line 376.BUILD INFO
STEPS TO REPRODUCE
EXPECTED RESULTS
BIOMETRIC_ERROR_NO_HARDWARE
OBSERVED RESULTS
BIOMETRIC_ERROR_NONE_ENROLLED
everytime