Fixed
Status Update
Comments
il...@google.com <il...@google.com>
jb...@google.com <jb...@google.com>
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit d05ccdbc98fa30ffb6777933dbc738907a36f098
Author: Clara Fok <clarafok@google.com>
Date: Wed May 24 11:39:10 2023
Clear FragmentStore savedState on resume
Currently savedState survives resume and the stale state gets stored. When resumed, the stale state is restored.
Now we ensure stale states are cleared upon resume.
Test: ./graldew fragment:fragment:cC
Bug: 246289075
Relnote: "Fixed an issue where the saved state stored when the activity was stopped but not destroyed would be incorrectly cached even after the fragment instance was moved back to the RESUMED state. This would cause that cached state to be reused if that fragment instance was on the back stack when using the multiple back stacks API to save and restore that fragment."
Change-Id: I712884633ae73e0784ba0a7fe50bb5a1046e2275
M fragment/CHANGELOG.md
M fragment/fragment/src/androidTest/java/androidx/fragment/app/SaveRestoreBackStackTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentStateManager.java
https://android-review.googlesource.com/2602789
Branch: androidx-main
commit d05ccdbc98fa30ffb6777933dbc738907a36f098
Author: Clara Fok <clarafok@google.com>
Date: Wed May 24 11:39:10 2023
Clear FragmentStore savedState on resume
Currently savedState survives resume and the stale state gets stored. When resumed, the stale state is restored.
Now we ensure stale states are cleared upon resume.
Test: ./graldew fragment:fragment:cC
Bug: 246289075
Relnote: "Fixed an issue where the saved state stored when the activity was stopped but not destroyed would be incorrectly cached even after the fragment instance was moved back to the RESUMED state. This would cause that cached state to be reused if that fragment instance was on the back stack when using the multiple back stacks API to save and restore that fragment."
Change-Id: I712884633ae73e0784ba0a7fe50bb5a1046e2275
M fragment/CHANGELOG.md
M fragment/fragment/src/androidTest/java/androidx/fragment/app/SaveRestoreBackStackTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentStateManager.java
cl...@google.com <cl...@google.com> #3
Fixed internally and will be available in fragment 1.6.1
.
na...@google.com <na...@google.com> #4
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.fragment:fragment:1.6.1
Description
Component used: Navigation Version used: 2.5.1 Devices/Android versions reproduced on: multiple devices/emulator variants
The
onSaveInstanceState
not called again after leave/resume app and navigate from nested navigation target. Sample project and screenrecord attached.The major part is that I leave the app for a short time so
onSaveInstanceState
is called for the current Fragment with the current state (e.g. have an open dialog). Then I navigation to a child fragment (nested in the parent navigation graph). From this nested Fragment I navigate to another navigation root.onSaveInstanceState
are calledonSaveInstanceState
is called. But not the root Fragment. So the root Fragment does not store his real current state (e.g. dialog is closed). This can be seen by the reappearing bottom sheet shadow.