Closed codingjeremy closed 4 years ago
Comment by alex-townsend Tuesday May 24, 2016 at 19:42 GMT
Here's a log of the flow as well:
05-24 15:39:30.241 8110-8110/ D/DEBUG_TAG: startListening // Purchase pressed 05-24 15:39:39.811 8110-8110/ D/DEBUG_TAG: stopListening // Rotation happens 05-24 15:39:39.878 8110-8110/ D/DEBUG_TAG: startListening 05-24 15:39:39.882 8110-8110/ D/DEBUG_TAG: onAuthenticationError: errString: Fingerprint operation canceled. mSelfCancelled: false 05-24 15:39:40.110 8110-8110/ D/DEBUG_TAG: stopListening 05-24 15:39:40.203 8110-8110/ D/DEBUG_TAG: onAuthenticationError: errString: Fingerprint operation canceled. mSelfCancelled: true
Comment by nikhil-thakkar Tuesday Dec 12, 2017 at 17:49 GMT
Late answer but I also found it the hard way. The way it is handled is:
override fun onFingerprintAuthenticationError(errMsgId: Int, message: String) {
if (errMsgId != android.hardware.fingerprint.FingerprintManager.FINGERPRINT_ERROR_CANCELED) {
//do your thing
}
Issue by alex-townsend Tuesday May 24, 2016 at 19:11 GMT Originally opened as https://github.com/googlesamples/android-FingerprintDialog/issues/30
The dialog fragment for the fingerprint authentication does not survive rotation, despite having setRetainInstanceState(true) set. This appears to be because the CancellationSignal does not emit the cancellation before the dialog fragment is recreated and resumed again -- mSelfCancelled = false then, causing mCallback.onError() to be called and to close the newly created dialog fragment to be dismissed.
Flow looks something like this (user selects Purchase to start):
1) FingerprintAuthenticationDialogFragment created:
2) User rotates device
3) New FingerprintAuthenticationDialogFragment created:
So it looks like the cancellation is not sent quickly enough on a rotation, causing the fragment created after the rotation to receive that cancellation message, which then closes the dialog fragment.