Fixed
Status Update
Comments
kc...@google.com <kc...@google.com> #2
Thank you for reporting this issue. For us to further investigate this issue, please provide the following additional information:
Please provide sample project or apk to reproduce the issue. Also mention the steps to be followed for reproducing the issue with the given sample project or apk.
Expected output
What do you expect to occur?
Current output
What do you see instead?
Android bug report
After reproducing the issue, press the volume up, volume down, and power button simultaneously. This will capture a bug report on your device in the “bug reports” directory. Attach the bug report file to this issue.
Alternate method:
After reproducing the issue, navigate to developer settings, ensure ‘USB debugging’ is enabled, then enable ‘Bug report shortcut’. To take bug report, hold the power button and select the ‘Take bug report’ option.
NOTE: Please upload the files to Google Drive and share the folder to android-bugreport@google.com, then share the link here.
Please provide sample project or apk to reproduce the issue. Also mention the steps to be followed for reproducing the issue with the given sample project or apk.
Expected output
What do you expect to occur?
Current output
What do you see instead?
Android bug report
After reproducing the issue, press the volume up, volume down, and power button simultaneously. This will capture a bug report on your device in the “bug reports” directory. Attach the bug report file to this issue.
Alternate method:
After reproducing the issue, navigate to developer settings, ensure ‘USB debugging’ is enabled, then enable ‘Bug report shortcut’. To take bug report, hold the power button and select the ‘Take bug report’ option.
NOTE: Please upload the files to Google Drive and share the folder to android-bugreport@google.com, then share the link here.
kc...@google.com <kc...@google.com>
kc...@google.com <kc...@google.com> #3
ok, I did some more research, turns out that callback notification goes to the if we press "cancel" button but goes wrong when authentication succeeds
as you can see in the attached project
if you open the bio-prompt in the 1st Fragment and authenticate
and after that you go to the 2nd Fragment and authenticate in the bio-prompt
callback notifies the Fragment1 instead of the Fragment2 as you can see in the logs
expected result is that Fragment2 is notified instead of Fragment1
also if you first go to Fragment2 and after that you go to Fragment1 always opening the prompt and doing the authentication
Fragment2 is notified instead of Fragment1
funny thing is that doing cancel instead of authentication notification works ok
https://drive.google.com/open?id=1ZVhp9sFBJ6pa1bKzHg1AM5tF5XnmyFMM
as you can see in the attached project
if you open the bio-prompt in the 1st Fragment and authenticate
and after that you go to the 2nd Fragment and authenticate in the bio-prompt
callback notifies the Fragment1 instead of the Fragment2 as you can see in the logs
expected result is that Fragment2 is notified instead of Fragment1
also if you first go to Fragment2 and after that you go to Fragment1 always opening the prompt and doing the authentication
Fragment2 is notified instead of Fragment1
funny thing is that doing cancel instead of authentication notification works ok
ev...@tatarka.me <ev...@tatarka.me> #4
manually closing the FingerprintHelperFragment works as a workaround
```
override fun onPause() {
// WORKAROUND forhttps://issuetracker.google.com/issues/123857949
activity?.let { activity ->
activity.supportFragmentManager.findFragmentByTag("FingerprintHelperFragment")?.let {
activity.supportFragmentManager.beginTransaction().remove(it).commitAllowingStateLoss()
}
super.onPause()
}
}
```
```
override fun onPause() {
// WORKAROUND for
activity?.let { activity ->
activity.supportFragmentManager.findFragmentByTag("FingerprintHelperFragment")?.let {
activity.supportFragmentManager.beginTransaction().remove(it).commitAllowingStateLoss()
}
super.onPause()
}
}
```
kc...@google.com <kc...@google.com> #5
kc...@google.com <kc...@google.com> #6
There's might be something slightly different in the way lifecycle is being managed between O and lower, and P+
Looking at how mAuthenticationCallback is being passed around here should give us some ideas
https://cs.corp.google.com/aosp-androidx/biometric/src/main/java/androidx/biometric/BiometricPrompt.java?q=biometricprompt.java&dr
Josh can you take a look when convenient? I think the callback isn't getting to the FingerprintHelperFragment for some reason. We can also chat offline when you get to this.
Looking at how mAuthenticationCallback is being passed around here should give us some ideas
Josh can you take a look when convenient? I think the callback isn't getting to the FingerprintHelperFragment for some reason. We can also chat offline when you get to this.
su...@gmail.com <su...@gmail.com> #7
This bug is actually a duplicate of https://issuetracker.google.com/issues/121117380 . This issue happens because the new AuthenticationCallback is not being supplied to the biometric prompt fragments if they already exist in the FragmentManager.
Until this is fixed, users of this library MUST manually check for and remove any biometric prompt fragments from the FragmentManager before attempting to call BiometricPrompt#authenticate().
Until this is fixed, users of this library MUST manually check for and remove any biometric prompt fragments from the FragmentManager before attempting to call BiometricPrompt#authenticate().
an...@gmail.com <an...@gmail.com> #8
#7
I think that:
1. BiometricPrompt#authenticateInternal should call mFingerprintHelperFragment.setCallback method even if mFingerprintHelperFragment was existed before.
2. FingerprintHelperFragment#cleanup has to set mClientAuthenticationCallback and mExecutor to null to prevent leaking.
I think that:
1. BiometricPrompt#authenticateInternal should call mFingerprintHelperFragment.setCallback method even if mFingerprintHelperFragment was existed before.
2. FingerprintHelperFragment#cleanup has to set mClientAuthenticationCallback and mExecutor to null to prevent leaking.
pu...@gmail.com <pu...@gmail.com> #9
My mistake in point one:
1. Biometric#mLifecycleObserver#onResume should call mFingerprintHelperFragment.setCallback(...) even if mFingerprintDialogFragment is null.
Here is my temporary fix. Just place it in androidx.biometric package and use it like BiometricPrompt:
package androidx.biometric
import android.annotation.SuppressLint
import androidx.fragment.app.FragmentActivity
import java.util.concurrent.Executor
/**
* Fix for isssuehttps://issuetracker.google.com/issues/123857949
*/
@SuppressLint("RestrictedApi")
class FixedBiometricPrompt(
private val fragmentActivity: FragmentActivity,
executor: Executor,
callback: BiometricPrompt.AuthenticationCallback
) {
private val delegate: BiometricPrompt
init {
// set executor and callback to helper fragment
(fragmentActivity.supportFragmentManager.findFragmentByTag("FingerprintHelperFragment") as? FingerprintHelperFragment)?.setCallback(
executor,
callback
)
delegate = BiometricPrompt(fragmentActivity, executor, callback)
}
fun authenticate(info: BiometricPrompt.PromptInfo, crypto: BiometricPrompt.CryptoObject) {
delegate.authenticate(info, crypto)
}
fun authenticate(info: BiometricPrompt.PromptInfo) {
delegate.authenticate(info)
}
fun cancelAuthentication() {
delegate.cancelAuthentication()
}
fun cleanup() {
// remove executor and callback from helper fragment to prevent memory leak
(fragmentActivity.supportFragmentManager.findFragmentByTag("FingerprintHelperFragment") as? FingerprintHelperFragment)?.setCallback(
null,
null
)
}
}
1. Biometric#mLifecycleObserver#onResume should call mFingerprintHelperFragment.setCallback(...) even if mFingerprintDialogFragment is null.
Here is my temporary fix. Just place it in androidx.biometric package and use it like BiometricPrompt:
package androidx.biometric
import android.annotation.SuppressLint
import androidx.fragment.app.FragmentActivity
import java.util.concurrent.Executor
/**
* Fix for isssue
*/
@SuppressLint("RestrictedApi")
class FixedBiometricPrompt(
private val fragmentActivity: FragmentActivity,
executor: Executor,
callback: BiometricPrompt.AuthenticationCallback
) {
private val delegate: BiometricPrompt
init {
// set executor and callback to helper fragment
(fragmentActivity.supportFragmentManager.findFragmentByTag("FingerprintHelperFragment") as? FingerprintHelperFragment)?.setCallback(
executor,
callback
)
delegate = BiometricPrompt(fragmentActivity, executor, callback)
}
fun authenticate(info: BiometricPrompt.PromptInfo, crypto: BiometricPrompt.CryptoObject) {
delegate.authenticate(info, crypto)
}
fun authenticate(info: BiometricPrompt.PromptInfo) {
delegate.authenticate(info)
}
fun cancelAuthentication() {
delegate.cancelAuthentication()
}
fun cleanup() {
// remove executor and callback from helper fragment to prevent memory leak
(fragmentActivity.supportFragmentManager.findFragmentByTag("FingerprintHelperFragment") as? FingerprintHelperFragment)?.setCallback(
null,
null
)
}
}
ri...@brainvire.com <ri...@brainvire.com> #10
...
Then call function cleanup() in onDestroyView...
override fun onDestroyView() {
super.onDestroyView()
biometricPrompt.cleanup()
}
Then call function cleanup() in onDestroyView...
override fun onDestroyView() {
super.onDestroyView()
biometricPrompt.cleanup()
}
[Deleted User] <[Deleted User]> #11
the proper fix (on google's side) is pretty simple
on line 498
if (mFingerprintHelperFragment == null) {
mFingerprintHelperFragment = FingerprintHelperFragment.newInstance();
mFingerprintHelperFragment.setCallback(mExecutor, mAuthenticationCallback); // <-- this line should be moved out side the if statement
}
on line 498
if (mFingerprintHelperFragment == null) {
mFingerprintHelperFragment = FingerprintHelperFragment.newInstance();
mFingerprintHelperFragment.setCallback(mExecutor, mAuthenticationCallback); // <-- this line should be moved out side the if statement
}
ja...@gmail.com <ja...@gmail.com> #12
Hmm we already fixed this. Just need to cut a new build for alpha04 now.
The bug was referenced in this CL but somehow buganizer didn't close it
https://android-review.googlesource.com/c/platform/frameworks/support/+/917882/
The bug was referenced in this CL but somehow buganizer didn't close it
94...@gmail.com <94...@gmail.com> #13
ma...@gmail.com <ma...@gmail.com> #14
Not fixed and not work on emulator Nexus 5x API 33
Description
Version used: 1.0.0-alpha03
Devices/Android versions reproduced on: Samsung S7 Android 8.0.0, Pixel Android 9, Huawei Mate 20 lite Android 8.1.0
When using the BiometricPrompt, it is cancelled when the user touches outside the dialog asking for biometric verification. This is especially problematic when the dialog appears in the middle of the screen and the fingerprint scanner is on the home button, like on the Samsung S7. The problem is that the user will touch the screen while verifying and so accidentally cancel the verification.
Request:
Allow functionality like DialogFragment#setCancelable(boolean) or Dialog#setCanceledOnTouchOutside() to be set through BiometricPrompt.PromptInfo.Builder (for relevant implementations).