Fixed
Status Update
Comments
il...@google.com <il...@google.com>
il...@google.com <il...@google.com>
il...@google.com <il...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 82941c128d8ef57e36a739fcfacdf006e94d1a4a
Author: Simon Schiller <simonschiller@users.noreply.github.com>
Date: Thu Oct 15 17:31:58 2020
[GH] Don't cache fragment classes across different class loaders
## Proposed Changes
- Don't cache fragment classes across different class loaders inside `FragmentFactory`.
## Testing
Test: Added tests to verify the change
## Issues Fixed
Fixes: 113886460
This is an imported pull request fromhttps://github.com/androidx/androidx/pull/87 .
Resolves #87
Github-Pr-Head-Sha: e5f5916840904cab91884e3f525fde4a71d5a7dc
GitOrigin-RevId: babb5e1aedec7d815aa38a50ebca89d6c3e93f00
Change-Id: I07d5541a45ccadcf7159854818000455e245d118
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentFactory.java
A fragment/fragment/src/test/java/androidx/fragment/app/FragmentFactoryTest.kt
https://android-review.googlesource.com/1462523
Branch: androidx-master-dev
commit 82941c128d8ef57e36a739fcfacdf006e94d1a4a
Author: Simon Schiller <simonschiller@users.noreply.github.com>
Date: Thu Oct 15 17:31:58 2020
[GH] Don't cache fragment classes across different class loaders
## Proposed Changes
- Don't cache fragment classes across different class loaders inside `FragmentFactory`.
## Testing
Test: Added tests to verify the change
## Issues Fixed
Fixes: 113886460
This is an imported pull request from
Resolves #87
Github-Pr-Head-Sha: e5f5916840904cab91884e3f525fde4a71d5a7dc
GitOrigin-RevId: babb5e1aedec7d815aa38a50ebca89d6c3e93f00
Change-Id: I07d5541a45ccadcf7159854818000455e245d118
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentFactory.java
A fragment/fragment/src/test/java/androidx/fragment/app/FragmentFactoryTest.kt
ma...@gmail.com <ma...@gmail.com> #3
Thanks for the quick fix!
Description
Version used: 1.0.0-alpha09
Devices/Android versions reproduced on: Nexus 5X
Sample: attached
Screen recording: attached
As you can see in the attached sample, I have a simple application with one Activity that has a NavHostFragment and a BottomNavigationView. The navigation graph contains 3 fragment destinations(fragments A, B and C) which are also the menu items for the BottomNavigationView. Fragment C has a drawer layout that contains another NavHostFragment and a NavigationView. This inner NavHostFragment has its own navigation graph with another 3 fragments: D(start destination), E, and F.
Steps to reproduce:
1) Open app
2) Open Fragment C which implicitly opens Fragment D(start destination for that NavHostFragment)
3) From the drawer open Fragment E
4) Click on Fragment B from BottomNavigationView
5) Press back
Observe that Fragment D is opened and that the Fragment B is still the selected item from the BottomNavigationView.
My expected behavior is that the inner NavHostFragment stack is cleared by step 4 and the back button will navigate the user to the start destination of the outer NavHostFragment(Fragment A).
Strange behavior can also be observed if you click on A or C destinations at step 4.
I'm looking forward to your reply.
Thanks!