Status Update
Comments
jb...@google.com <jb...@google.com>
jb...@google.com <jb...@google.com>
tp...@gmail.com <tp...@gmail.com> #2
Branch: androidx-main
commit 57ca221882695bd6a52549f4d9ea3b812e6fe87c
Author: Simon Schiller <simonschiller@users.noreply.github.com>
Date: Mon Mar 22 16:09:30 2021
[GH] [FragmentStrictMode] Detect <fragment> tag usage
## Proposed Changes
- Detect `<fragment>` tag usage inside XML layouts
## Testing
Test: See `FragmentStrictModeTest#detectFragmentTagUsage`
## Issues Fixed
Fixes: 153738235
This is an imported pull request from
Resolves #141
Github-Pr-Head-Sha: 4ea052596e4341b9f11bcf335e2bc38045a91f19
GitOrigin-RevId: 62e7487aa4874eef6bb556490e193717cf937251
Change-Id: Iae48578e85e4e4897f806d7ade2e2a660adf9479
M fragment/fragment/api/public_plus_experimental_current.txt
M fragment/fragment/api/restricted_current.txt
M fragment/fragment/src/androidTest/java/androidx/fragment/app/strictmode/FragmentStrictModeTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentLayoutInflaterFactory.java
M fragment/fragment/src/main/java/androidx/fragment/app/strictmode/FragmentStrictMode.java
A fragment/fragment/src/main/java/androidx/fragment/app/strictmode/FragmentTagUsageViolation.java
jb...@google.com <jb...@google.com> #3
Can you provide a sample for that case as well so we can ensure any fix we have addresses that as well?
ap...@google.com <ap...@google.com> #4
Branch: androidx-main
commit 7b70603d0d18f00187898b5397d9b6ba90500032
Author: Jeremy Woods <jbwoods@google.com>
Date: Mon Apr 24 18:37:09 2023
Dispatch onBackStackChange callbacks to the correct records
With reorderingAllowed true, it is possible to get in a scenario where
there are multiple transactions in the FragmentManager, some added to
the back stack and others not. FragmentManager currently looks at the
global result and if a single transaction changes the back stack it
dispatches onBackStackChange callbacks for all of the records.
We need to ensure only the individual records that explicitly add things
to the back stack cause the onBackStackChange callbacks to be
dispatched.
RelNote: "Fixed an issue where the onBackStackChangeListener callbacks
were being dispatched for transactions that did not actually change the
back stack if they were mixed in with transactions that do."
Test: Added onBackStackChangedListenerTest
Bug: 279306628
Change-Id: I0eb5c9622f2984232ac106bb975ba72ae9b2435f
M fragment/fragment/src/androidTest/java/androidx/fragment/app/OnBackStackChangedListenerTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
jb...@google.com <jb...@google.com> #5
This has been fixed internally and will be available in the Fragment 1.6.0-rc01
release.
jb...@google.com <jb...@google.com> #6
You can try running your code with a snapshot build from
tp...@gmail.com <tp...@gmail.com> #7
Hi, I have created a sample and attached in this separate issue here as this issue is marked as fixed. Crash still occurs with the latest snapshot build from androidx.dev
ma...@gmail.com <ma...@gmail.com> #8
Tested for 2.6.0-SNAPSHOT, (Build 10012776)
na...@google.com <na...@google.com> #9
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.fragment:fragment:1.6.0-rc01
za...@google.com <za...@google.com> #10
Still hitting this: YAQS/8332979824100376576
ma...@zentity.com <ma...@zentity.com> #11
Still persist in 2.6.0. From Crashlytics report:
Fatal Exception: java.lang.IllegalArgumentException: The fragment MyFragment{e08e9e3} (ffd3a63d-e7c5-4d27-8836-9579f2aea852 id=0x7f0a03a2 tag=0dcc6840-37be-40d3-9aab-10a5381ca884) is unknown to the FragmentNavigator. Please use the navigate() function to add fragments to the FragmentNavigator managed FragmentManager.
at androidx.navigation.fragment.FragmentNavigator$onAttach$2.onBackStackChangeCommitted(FragmentNavigator.kt:143)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1918)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1845)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782)
at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:565)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7879)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1009)
MyFragment is in main fragment for subgraph which is included to nav_graph.xml.
an...@gmail.com <an...@gmail.com> #12
Same case as above so I assume that not further details are required.
All good if I test with version 2.6.0-alpha09.
I assume the problem starts here:
I do add fragments navigate() and there are no manual FragmentTransaction's in the project.
jb...@google.com <jb...@google.com> #13
Please file a new bug with a minimal sample project that reproduces this issue.
go...@gmail.com <go...@gmail.com> #14
I have a BottomNavigationView and I just quickly click on two elements asynchronously and within 1 minute it crashes
You probably have test projects, two fragments will be enough
jb...@google.com <jb...@google.com> #15
We will need you to file a new bug with a minimal sample project that reproduces this issue.
Description
Version used: 2.6.0-beta01
Devices/Android versions reproduced on: Everywhere
Crash stack trace
java.lang.IllegalArgumentException: The fragment BottomSheetFragment{6c59aad}
(a05692b2-965c-40c6-82ce-57991ab0e8d6 tag=b3f6ebd6-263b-402f-8ebe-7762287c5f6d) is unknown to the FragmentNavigator. Please use the navigate() function to add fragments to the FragmentNavigator managed FragmentManager. (FragmentNavigator.kt:147)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1918)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1845)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782)
at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:565)
You can reproduce crash in the attached project.
Project has 3 fragments.
1. StartFragment
2. BottomSheetDialog
3. SimpleFragment
Navigation flow looks like: StartFragment (click on button) -> Navigation opens BottomSheet dialog fragment (click on button) -> crash.
But in 2.6.0-alpha09 and below crash is not reproduced and all works fine (BottomSheet dialog disappears and SimpleFragment appears, back stack looks like StartFragment -> SimpleFragment)
Thanks.