android / security-samples

Multiple samples showing the best practices in security APIs on Android.
Apache License 2.0
938 stars 395 forks source link

CRASH: on save instance state exception #18

Closed codingjeremy closed 4 years ago

codingjeremy commented 5 years ago

Issue by br00 Wednesday Oct 12, 2016 at 07:50 GMT Originally opened as https://github.com/googlesamples/android-FingerprintDialog/issues/39


Hi, To make it crash do this:

The issue is that are missing some checks when you call dismiss()

@Override public void onAuthenticated() { // Callback from FingerprintUiHelper. Let the activity know that authentication was // successful. mActivity.onPurchased(true /* withFingerprint */, mCryptoObject); dismiss(); }

I suggest to put Activity anActivity = getActivity(); if (getDialog() != null && getDialog().isShowing() && isResumed() && anActivity != null && !anActivity.isFinishing()) { dismiss(); }

or you can use dismissAllowingStateLoss()

codingjeremy commented 5 years ago

Comment by usantos Thursday Jul 04, 2019 at 20:05 GMT


If you use dismissAllowingStateLoss () would it be after the dismiss?

nic0lette commented 4 years ago

The sample was ported to use BiometricPrompt and so I'm hopeful that this issue would be resolved. If it's still occurring, please open another issue.