Status Update
Comments
il...@google.com <il...@google.com> #2
Please provide a minimal sample project that reproduces this issue.
t....@gmail.com <t....@gmail.com> #3
Sure, I created a minimal sample app for you:
Just click "Next Fragment" multiple times, then press the back button or perform the back gesture multiple times in quick succession.
Note: I tested this on a Pixel 8 with Android 14. Also, I have the predictive back animations enabled in the developer options.
il...@google.com <il...@google.com> #4
Just FYI: Still happens on fragment library version 1.7.1
.
t....@gmail.com <t....@gmail.com> #5
Still crashing with fragment 1.8.0
. I have updated my example github repo with all latest libraries.
il...@google.com <il...@google.com> #6
Still crashing with fragment 1.8.1
. Example GitHub Repo was updated again.
t....@gmail.com <t....@gmail.com> #7
Any plan to get this done in time for Android 15's enabling of back gesture animations?
si...@gmail.com <si...@gmail.com> #8
Branch: androidx-main
commit 8b1990bc47272275051da2b252189adafde79124
Author: Jeremy Woods <jbwoods@google.com>
Date: Fri Jun 28 02:56:56 2024
Fix issue with predictive back cancellation
When a Predictive back gesture that is not seekable is interrupted by
another fragment operation, fragment manager loses it state and fails to
display the proper fragment.
We should make it so that when a Predictive back gesture that is not
seekable is interrupt we still move to the correct state.
This ignores the fact that the system will continue to dispatch calls,
but that is okay, we should ignore any calls after our cancellation.
RelNote: "Fixed an issue in fragments where interrupting a predictive
back gesture would send the fragment manager into an undefined state and
even up showing the wrong fragment."
Test: modified and added tests
Bug: 338624457
Change-Id: If82e2cd540a5319faa2e40d4a28ce31026e2e19d
M fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentAnimatorTest.kt
M fragment/fragment/src/androidTest/java/androidx/fragment/app/OnBackStackChangedListenerTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/BackStackRecord.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
M fragment/fragment/src/main/java/androidx/fragment/app/SpecialEffectsController.kt
M transition/transition/src/androidTest/java/androidx/transition/FragmentTransitionSeekingTest.kt
il...@google.com <il...@google.com> #9
Branch: androidx-main
commit 27a398bdc622236b84683d7a1c036803d77fe0d3
Author: George Mount <mount@google.com>
Date: Thu Jul 11 15:39:01 2024
Delay start of animateToStart/End() until Transition is ready.
Bug: 338624457
When a seekable transition has animateToStart() or animateToEnd()
called before the transition is ready, it was previously not
animating. Now, it waits until the transition is ready
before starting the animation.
Test: New tests, manual testing
Change-Id: I44d9618604c29659e1f6ae7e966cd1533369b18c
M transition/transition/src/androidTest/java/androidx/transition/SeekTransitionTest.kt
M transition/transition/src/main/java/androidx/transition/Transition.java
t....@gmail.com <t....@gmail.com> #10
This was actually an error specific to Androidx Transition, was addressed internally, and will be released in the Transition 1.5.1
version.
sm...@gmail.com <sm...@gmail.com> #11
Seems to be not fixed. My sample app is still crashing after updating to the latest libraries:
material = "1.12.0"
activity = "1.9.1"
fragment = "1.8.2"
transition = "1.5.1"
I have pushed an update to my sample library. To reproduce:
- click multiple times on "Next Fragment" (adding a fragment to the back stack)
- repeatedly perform the back gesture in a short period of time -> crash
il...@google.com <il...@google.com> #12
It's still crashing with the latest libraries:
material = "1.13.0-alpha05"
activity = "1.9.2"
fragment = "1.8.3"
navigation = "2.8.0"
my github repo was updated
Description
Version used:
androidx.navigation:navigation-fragment-ktx:2.2.0-rc01
androidx.navigation:navigation-ui-ktx:2.2.0-rc01
Devices/Android versions reproduced on:
Pixel 3
Android 10
When switching tabs (using BottomNavigation / setupWithNavController()), when the destination Fragment contains a call to postponeEnterTransition() in onCreate() or onCreateView(), the onCreateView() lifecycle method gets called twice. This behavior is visible to the user, via a sort of 'flicker' (depending on the layout), as the fragment's view is recreated.
I suspect this may be due to some code in
`FragmentManager.addAddedFragments(@NonNull ArraySet<Fragment> added)`
It appears the destination Fragment (which invoked postponeEnterTransition()) has moveToState() called on it twice (vie addAddedFragments()). My guess, is that the destination fragment hasn't completed its first moveToState() before the second moveToState() is called, so the secondMoveToState() is attempting to move from a stale state.
I'm not able to provide a sample project for you at this stage.