Fixed
Status Update
Comments
le...@gmail.com <le...@gmail.com> #2
Hi Ed, Thank you so much for these suggestions. I've been reviewing them and merging them in. Hopefully it should be live. I've included a thank you note too in the article.
ad...@google.com <ad...@google.com> #3
Great! Thanks a lot, I'll look for the live updates soon!
kc...@google.com <kc...@google.com> #4
We need some source code at least to figure out what's going on, can you please provide (a stripped down version that repros is fine too)
le...@gmail.com <le...@gmail.com> #5
I created a branch of my open-source project that you can access here https://github.com/LithiumSR/openstud_client/tree/bug/biometric-crash-repro , for this repro only LauncherActivity, SuccessFingerprintActivity, FailFingerprintActivity are used.
In this branch I purged everything that wasn't needed in order to repro this issue.
In this branch I purged everything that wasn't needed in order to repro this issue.
kc...@google.com <kc...@google.com> #6
Josh do you have some cycles to look at this?
le...@gmail.com <le...@gmail.com> #7
I tinkered with my code and I found out that if I don't recreate the prompt when the layout changes it works just fine (I added a check "if (savedInstanceState == null)" before initializing the biometric prompt) .
If the prompt is recreated again when the layout changes it will lead to a crash later on when the layout changes again.
I don't know if this was the intended behavior but I guess that now the issue is more clear.
If the prompt is recreated again when the layout changes it will lead to a crash later on when the layout changes again.
I don't know if this was the intended behavior but I guess that now the issue is more clear.
xl...@google.com <xl...@google.com> #8
Why is this bug not being investigated since February?
The crash stack trace, and the BiometricFingerprint prompt being used in this example being a Fragment internally, all look highly similar to the recent crashes (just search "java.lang.IllegalStateException at FragmentManagerImpl.restoreSaveState") that's happening to multiple apps that had their Android support library being migrated to AndroidX.
This should be an issue of higher priority than P2/S4.
The crash stack trace, and the BiometricFingerprint prompt being used in this example being a Fragment internally, all look highly similar to the recent crashes (just search "java.lang.IllegalStateException at FragmentManagerImpl.restoreSaveState") that's happening to multiple apps that had their Android support library being migrated to AndroidX.
This should be an issue of higher priority than P2/S4.
kc...@google.com <kc...@google.com> #9
This bug is triaged correctly, unless all the app crashes you mention are due to the specific concern raised in comment #1 .
Your comment probably belongs in an androidx.fragment bug, not this androidx.biometric bug.
Your comment probably belongs in an androidx.fragment bug, not this androidx.biometric bug.
jo...@google.com <jo...@google.com> #10
This seems to be a fragment issue that Ian is working to resolve.
il...@google.com <il...@google.com> #11
So BiometricPrompt has some underlying issues where it tries to reattach a Fragment after you rotate your screen, but uses the wrong Fragment instance - resulting in it attaching a Fragment that the FragmentManager has never seen before (rather than attaching the Fragment that it previously detached). This puts the FragmentManager in an inconsistent state, causing the crash.
We've made FragmentManager more resilient to invalid uses inhttps://android-review.googlesource.com/943306 but more changes in BiometricPrompt will have to be made to correct their internal usage of Fragments to make things actually work.
We've made FragmentManager more resilient to invalid uses in
ap...@google.com <ap...@google.com> #12
Project: platform/frameworks/support
Branch: androidx-master-dev
commit b248db36ceb5c54b2ed2995f689d9238bd75dbf7
Author: Ian Lake <ilake@google.com>
Date: Sat Apr 13 11:41:31 2019
Don't change the state of inactive Fragments
Wait until a Fragment is added to the set of
active fragments (via FragmentTransaction.add())
before changing its state.
Test: updated tests
BUG: 123811924
Change-Id: I9822540120487321edb0c6f26658345c5968cd52
M fragment/src/androidTest/java/androidx/fragment/app/BackStackStateTest.kt
M fragment/src/androidTest/java/androidx/fragment/app/FragmentViewTest.kt
M fragment/src/main/java/androidx/fragment/app/FragmentManagerImpl.java
https://android-review.googlesource.com/943306
https://goto.google.com/android-sha1/b248db36ceb5c54b2ed2995f689d9238bd75dbf7
Branch: androidx-master-dev
commit b248db36ceb5c54b2ed2995f689d9238bd75dbf7
Author: Ian Lake <ilake@google.com>
Date: Sat Apr 13 11:41:31 2019
Don't change the state of inactive Fragments
Wait until a Fragment is added to the set of
active fragments (via FragmentTransaction.add())
before changing its state.
Test: updated tests
BUG: 123811924
Change-Id: I9822540120487321edb0c6f26658345c5968cd52
M fragment/src/androidTest/java/androidx/fragment/app/BackStackStateTest.kt
M fragment/src/androidTest/java/androidx/fragment/app/FragmentViewTest.kt
M fragment/src/main/java/androidx/fragment/app/FragmentManagerImpl.java
il...@google.com <il...@google.com> #13
Back to the Biometrics team to fix the issue in #11 now that the masking issue in FragmentManager is fixed.
Description
- Reproduced on a device with Android O
I'm providing an apk that I made from butchering my app in order to reproduce that issue, LauncherActivity is where the biometric prompt is created.
Steps to reproduce:
- Start my apk
- Rotate the screen to landscape when biometric dialog is visible
- Rotate the screen again to portrait
- Crash
Stacktrace:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.lithium.leona.openstud, PID: 19140
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.lithium.leona.openstud/com.lithium.leona.openstud.activities.LauncherActivity}: java.lang.IllegalStateException: Could not find active fragment with unique id d3d7d2aa-4ea1-4a2b-833c-6404dcddf62a
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2955)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3030)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4919)
at android.app.ActivityThread.-wrap19(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1702)
at android.os.Handler.dispatchMessage(Handler.java:105)
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)
Caused by: java.lang.IllegalStateException: Could not find active fragment with unique id d3d7d2aa-4ea1-4a2b-833c-6404dcddf62a
at androidx.fragment.app.FragmentManagerImpl.restoreSaveState(FragmentManagerImpl.java:2434)
at androidx.fragment.app.FragmentController.restoreSaveState(FragmentController.java:194)
at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:279)
at androidx.appcompat.app.AppCompatActivity.onCreate(AppCompatActivity.java:85)
at com.lithium.leona.openstud.activities.LauncherActivity.onCreate(LauncherActivity.java:21)
at android.app.Activity.performCreate(Activity.java:7183)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2908)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3030)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4919)
at android.app.ActivityThread.-wrap19(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1702)
at android.os.Handler.dispatchMessage(Handler.java:105)
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)