Fixed
Status Update
Comments
fo...@gmail.com <fo...@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.
jb...@google.com <jb...@google.com>
th...@outlook.com <th...@outlook.com> #3
Great! Thanks a lot, I'll look for the live updates soon!
pa...@gmail.com <pa...@gmail.com> #4
Hello, do we have any news on the status of this?
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-main
Author: Ian Lake <
Link:
Prevent double expansion of transaction operations
Expand for full commit details
Prevent double expansion of transaction operations
How predictive back with fragments works is that
we pop the FragmentTransaction from the
FragmentManager, but keep a copy of that
transaction around in case the back operation
is cancelled (either via gesture or interruption
by changes to the FragmentManager).
In the cancellation case, we then re-apply the
same FragmentTransaction again, putting the
FragmentManager back into the state it was in
before the predictive back happened.
However, when using operations that are
'expanded' like setPrimaryNavigationFragment(),
we need to explicitly call collapseOps() before
re-executing the operation so that we ensure
that these transactions never have a direct
reference to fragments from other transactions.
By ensuring we only don't double expandOps(),
we can avoid cases where FragmentManager does not
allow references to previous fragments such as when
using saveBackStack().
Relnote: "Fixed an `IllegalStateException` triggered
by `saveBackStack` only after a Predictive Back gesture
was cancelled or interrupted."
Test: new PredictiveBackTest test cases
BUG: 342419080
Change-Id: I3387d9d02495112f211448d7f3c9f862299da697
Files:
- M
fragment/fragment/src/androidTest/java/androidx/fragment/app/PredictiveBackTest.kt
- M
fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
Hash: 922bb8acc3661be78480dd40f3c582af8b87f935
Date: Mon Oct 21 20:45:54 2024
il...@google.com <il...@google.com> #6
We've fixed this internally and will be available in Fragment 1.8.5.
Description
Component used: Fragment, Navigation
Version used: Fragment 1.7.0, Navigation 2.7.7
Devices/Android versions reproduced on: Poco F5, Android 14
Screen recording demonstrating the issue and sample project are attached. Predictive back gesture is enabled.
Steps to reproduce: Navigate to another tab. Perform the back gesture and cancel it. Navigate to another tab.
Exception: