Fixed
Status Update
Comments
ku...@google.com <ku...@google.com>
ku...@google.com <ku...@google.com> #2
Can you provide the below requested information to better understand the issue:
Steps to reproduce
Please provide a sample application or apk to reproduce the issue.
Also kindly mention the steps to be followed for reproducing the issue with the given sample application.
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.
Steps to reproduce
Please provide a sample application or apk to reproduce the issue.
Also kindly mention the steps to be followed for reproducing the issue with the given sample application.
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.
ch...@gmail.com <ch...@gmail.com> #3
Please find attached: bug report and dumpstate files along with a zip of a sample app with the issue and reproduction steps.
Note: seems to happen when biometric authentication is called in onResume, but not when triggered by a button click
Steps to reproduce:
- Start app
- on app resume, fingerprint dialog will show
- Cancel fingerprint dialog
- Observe crash mentioned above
Note: seems to happen when biometric authentication is called in onResume, but not when triggered by a button click
Steps to reproduce:
- Start app
- on app resume, fingerprint dialog will show
- Cancel fingerprint dialog
- Observe crash mentioned above
ch...@gmail.com <ch...@gmail.com> #4
To test my theory that it has to do specifically with onResume, I moved the call to authenticate into a delayed runnable and the crash stops. So that is a potential work around for anyone who finds this before the problem is resolved.
ku...@google.com <ku...@google.com> #5
Thank you for the reply.
We are not able to reproduce this issue on a Pixel and Emulator. Attached video for reference.
So, can you please confirm whether this issue is reproducing in nexus/ pixel devices?
If yes, please share the bugreport for analysis.
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.
We are not able to reproduce this issue on a Pixel and Emulator. Attached video for reference.
So, can you please confirm whether this issue is reproducing in nexus/ pixel devices?
If yes, please share the bugreport for analysis.
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.
ja...@gmail.com <ja...@gmail.com> #6
Can confirm the crash on a Samsung Galaxy S8 and a Pixel 3 device. See crash log attached. I tried it with the test application provided, but I have the same issue on "my app".
```
--------- beginning of crash
01-02 09:33:05.427 10196 9472 9472 E AndroidRuntime: FATAL EXCEPTION: main
01-02 09:33:05.427 10196 9472 9472 E AndroidRuntime: Process: com.example.brokenbiometric, PID: 9472
01-02 09:33:05.427 10196 9472 9472 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence androidx.biometric.FingerprintDialogFragment.getNegativeButtonText()' on a null object reference
01-02 09:33:05.427 10196 9472 9472 E AndroidRuntime: at androidx.biometric.BiometricPrompt$1$1.run(BiometricPrompt.java:336)
01-02 09:33:05.427 10196 9472 9472 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:789)
01-02 09:33:05.427 10196 9472 9472 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:98)
01-02 09:33:05.427 10196 9472 9472 E AndroidRuntime: at android.os.Looper.loop(Looper.java:164)
01-02 09:33:05.427 10196 9472 9472 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6938)
01-02 09:33:05.427 10196 9472 9472 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
01-02 09:33:05.427 10196 9472 9472 E AndroidRuntime: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
01-02 09:33:05.427 10196 9472 9472 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
01-02 09:33:05.432 1000 5058 5732 D Debug : !@DumpState : SHIP
01-02 09:33:05.432 1000 5058 5732 D Debug : !@DumpState : debug level:0x4f4c
01-02 09:33:05.432 1000 5058 5732 D Debug : !@Dumpstate : Finally, system will skip dumpstate
01-02 09:33:05.432 1000 5058 5732 W ActivityManager: crash : com.example.brokenbiometric,0
01-02 09:33:05.434 1000 5058 5732 W ActivityManager: Force finishing activity com.example.brokenbiometric/.MainActivity
```
```
--------- beginning of crash
01-02 09:33:05.427 10196 9472 9472 E AndroidRuntime: FATAL EXCEPTION: main
01-02 09:33:05.427 10196 9472 9472 E AndroidRuntime: Process: com.example.brokenbiometric, PID: 9472
01-02 09:33:05.427 10196 9472 9472 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence androidx.biometric.FingerprintDialogFragment.getNegativeButtonText()' on a null object reference
01-02 09:33:05.427 10196 9472 9472 E AndroidRuntime: at androidx.biometric.BiometricPrompt$1$1.run(BiometricPrompt.java:336)
01-02 09:33:05.427 10196 9472 9472 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:789)
01-02 09:33:05.427 10196 9472 9472 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:98)
01-02 09:33:05.427 10196 9472 9472 E AndroidRuntime: at android.os.Looper.loop(Looper.java:164)
01-02 09:33:05.427 10196 9472 9472 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6938)
01-02 09:33:05.427 10196 9472 9472 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
01-02 09:33:05.427 10196 9472 9472 E AndroidRuntime: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
01-02 09:33:05.427 10196 9472 9472 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
01-02 09:33:05.432 1000 5058 5732 D Debug : !@DumpState : SHIP
01-02 09:33:05.432 1000 5058 5732 D Debug : !@DumpState : debug level:0x4f4c
01-02 09:33:05.432 1000 5058 5732 D Debug : !@Dumpstate : Finally, system will skip dumpstate
01-02 09:33:05.432 1000 5058 5732 W ActivityManager: crash : com.example.brokenbiometric,0
01-02 09:33:05.434 1000 5058 5732 W ActivityManager: Force finishing activity com.example.brokenbiometric/.MainActivity
```
ja...@gmail.com <ja...@gmail.com> #7
Pixel 3 Crash Logs
ku...@google.com <ku...@google.com>
ma...@gmail.com <ma...@gmail.com> #8
I have the same issue with my Pixel 1. I can confirm, like stated in comment #4 , that running the biometric prompt like this will not crash when tapping the negative button:
override fun onResume() {
super.onResume()
// Start a coroutine
GlobalScope.launch {
delay(200)
withContext(Dispatchers.Main) {
launchBiometricPrompt()
}
}
}
override fun onResume() {
super.onResume()
// Start a coroutine
GlobalScope.launch {
delay(200)
withContext(Dispatchers.Main) {
launchBiometricPrompt()
}
}
}
ap...@google.com <ap...@google.com> #10
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 6783b5f4310a65d3e9adb85e77676214e55d4066
Author: joshmccloskey <joshmccloskey@google.com>
Date: Wed Jan 23 15:56:42 2019
Fixing a race condition.
Test: Manually tested on P & O devices.
Bug: 122054485
Change-Id: I8f68b95af15d9b94dd0d5fff780ded03949fc1d4
M biometric/src/main/java/androidx/biometric/BiometricPrompt.java
https://android-review.googlesource.com/883573
https://goto.google.com/android-sha1/6783b5f4310a65d3e9adb85e77676214e55d4066
Branch: androidx-master-dev
commit 6783b5f4310a65d3e9adb85e77676214e55d4066
Author: joshmccloskey <joshmccloskey@google.com>
Date: Wed Jan 23 15:56:42 2019
Fixing a race condition.
Test: Manually tested on P & O devices.
Bug: 122054485
Change-Id: I8f68b95af15d9b94dd0d5fff780ded03949fc1d4
M biometric/src/main/java/androidx/biometric/BiometricPrompt.java
jo...@google.com <jo...@google.com>
ch...@gmail.com <ch...@gmail.com> #11
Please release this fix. This is a source of many crashes.
ph...@gmail.com <ph...@gmail.com> #12
Run
ph...@gmail.com <ph...@gmail.com> #13
Run
ph...@gmail.com <ph...@gmail.com> #14
Run
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)