Fixed
Status Update
Comments
ku...@google.com <ku...@google.com>
ku...@google.com <ku...@google.com> #2
Would you like to move it to android.hardware.biometrics? It looks like the problem is deeper than androidx.
ch...@gmail.com <ch...@gmail.com> #3
Native Android 10 BiometricPrompt has exactly the same issue. If fixing this in the platform is impractical, maybe AndroidX Biometrics library can implement some workaround?
ch...@gmail.com <ch...@gmail.com> #4
exxbrain@ can you attach a bugreport?
ku...@google.com <ku...@google.com> #5
I've created two sample projects (see attachment): one with android.hardware.biometrics (TestBiometricQ), other with androidx.biometric:biometric:1.0.0 (TestBiometricX).
They both have the same issue with setDeviceCredentialAllowed(true) (see #1).
Bug reports:
https://drive.google.com/file/d/1fx4EyHdfJ1koRIt2KZ1emQeRdSDnNOkG/view?usp=drive_web (biometric_q_report.zip)
https://drive.google.com/file/d/1PASxQhxXvLp62t91mYis28QhGqvHBfD5/view?usp=drive_web (biometric_x_report.zip)
On attached screenshots you can see "onAuthenticationError" toast alongside device pattern UI.
They both have the same issue with setDeviceCredentialAllowed(true) (see #1).
Bug reports:
On attached screenshots you can see "onAuthenticationError" toast alongside device pattern UI.
ja...@gmail.com <ja...@gmail.com> #6
Some clarifications:
1. The issue applies to any non-biometric unlock method (pattern, PIN, or password), if fingerprint is configured too. Not sure about face recognition.
2. "onAuthenticationSucceeded" is not called after providing correct pattern/PIN/password.
1. The issue applies to any non-biometric unlock method (pattern, PIN, or password), if fingerprint is configured too. Not sure about face recognition.
2. "onAuthenticationSucceeded" is not called after providing correct pattern/PIN/password.
ja...@gmail.com <ja...@gmail.com> #7
There is no bug report - just inconsistent behavior. From my point of view Authentication shouldn’t be cancelled in the moment when user chooses “Use pin” in a biometric prompt.
ku...@google.com <ku...@google.com>
ma...@gmail.com <ma...@gmail.com> #8
Well, I would still call it a bug. Documentation for setDeviceCredentialAllowed() method says that user will be "given the option to authenticate with their device PIN, pattern, or password" - and this does not work: the user can enter PIN/password/pattern, but cannot authenticate, because the app always gets onAuthenticationError callback.
ap...@google.com <ap...@google.com> #10
Agree.
jo...@google.com <jo...@google.com>
ch...@gmail.com <ch...@gmail.com> #11
Found another issue when setDeviceCredentialAllowed() is set to true.
I have attached video to show bug with bio-metric prompt.
BP is not removed when user does home button swipe while setDeviceCredentialAllowed() is set true.
I have attached video to show bug with bio-metric prompt.
BP is not removed when user does home button swipe while setDeviceCredentialAllowed() is set true.
ph...@gmail.com <ph...@gmail.com> #12
Do you want me to fix this issue?
ph...@gmail.com <ph...@gmail.com> #13
It is still assigned to me.
ph...@gmail.com <ph...@gmail.com> #14
Please do fix this issue. This is a blocker for using the library in production.
Description
Version used:1.0.0-alpha03
Theme used:Theme.MaterialComponents.Light.NoActionBar"
Devices/Android versions reproduced on:
- Galaxy S9+/8.0.0
- Emulator/9.0.0
- Relevant code to trigger the issue.
override fun onResume() {
super.onResume()
DataManager.instance.getBiometricCredential(this)?.let {
BiometricUtils.authenticateBiometric(this,
object : BiometricPrompt.AuthenticationCallback() {
override fun onAuthenticationError(errorCode: Int,
errString: CharSequence) {
Log.d(TAG,
"onAuthenticationError - errorCode: $errorCode, errorString: $errString")
if(errorCode != BiometricPrompt.ERROR_CANCELED) {
R.string.unable_to_verify_fingerprint,
null,
null,
R.string.dismiss,
null,
null,
{ dialog -> dialog.dismiss() },
true))
}
}
override fun onAuthenticationFailed() {
Log.d(TAG, "onAuthenticationFailed")
R.string.unable_to_verify_fingerprint,
null,
null,
R.string.dismiss,
null,
null,
{ dialog -> dialog.dismiss() },
true))
}
override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
val user = DataManager.instance.getBiometricCredential(
context)
Log.d(TAG,
"onAuthenticationSucceeded - logging in biometric user: ${user?.id
?: ""}")
user?.let {
binding.textEmail.setText(user.username)
binding.textPassword.setText(user.password)
signIn()
} ?: run {
R.string.error_general_error_message,
null,
null,
R.string.dismiss,
null,
null,
{ dialog -> dialog.dismiss() },
true))
}
}
})
}
}
fun authenticateBiometric(activity: FragmentActivity,
callback: BiometricPrompt.AuthenticationCallback) {
var signature: Signature? = null
try {
KeyStoreUtil.getKeyPair(KeyStoreUtil.BIOMETRIC)?.let {
signature = Signature.getInstance("SHA256withECDSA")
signature?.initSign(it.private)
}
} catch (e: Exception) {
}
val promptInfo = BiometricPrompt.PromptInfo.Builder()
.setTitle(stringProvider.getString(R.string.fingerprint_login))
.setDescription("")
.setNegativeButtonText(stringProvider.getString(R.string.cancel))
.build()
signature?.let {
BiometricPrompt(activity, TaskExecutors.MAIN_THREAD, callback).authenticate(promptInfo,
BiometricPrompt.CryptoObject(
it))
}
}
Pressing cancel on the BiometricDialog produces the following exception:
2018-12-27 15:14:00.933 5960-5960/
Process:
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence androidx.biometric.FingerprintDialogFragment.getNegativeButtonText()' on a null object reference
at androidx.biometric.BiometricPrompt$1$1.run(BiometricPrompt.java:336)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)