Fixed
Status Update
Comments
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 3cbeef5e31f501d5d29fba8c4c3b7d7f213d3e5b
Author: Jeremy Woods <jbwoods@google.com>
Date: Tue May 26 18:21:01 2020
Ensure parent Fragment restoreViewState before child Fragments
On process recreation parent Fragments dispatch onActivityCreated which
ends up restoring the view state of their child Fragments before they
have the chance to restore their own.
Just as parent Fragment views should be created before their children,
they should also be restored before their children. This change moves
the view state restoration to happen right after the parent gets the
onActivityCreate callback, but before activityCreated is dispatched to
any child Fragments.
Test: Added NestFragmentRestoreTest
Bug: 157195715
Change-Id: I62c9320510dc92358da8b8e9030c064b477d4a8a
M fragment/fragment/src/androidTest/java/androidx/fragment/app/NestedFragmentRestoreTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/Fragment.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentStateManager.java
https://android-review.googlesource.com/1317939
Branch: androidx-master-dev
commit 3cbeef5e31f501d5d29fba8c4c3b7d7f213d3e5b
Author: Jeremy Woods <jbwoods@google.com>
Date: Tue May 26 18:21:01 2020
Ensure parent Fragment restoreViewState before child Fragments
On process recreation parent Fragments dispatch onActivityCreated which
ends up restoring the view state of their child Fragments before they
have the chance to restore their own.
Just as parent Fragment views should be created before their children,
they should also be restored before their children. This change moves
the view state restoration to happen right after the parent gets the
onActivityCreate callback, but before activityCreated is dispatched to
any child Fragments.
Test: Added NestFragmentRestoreTest
Bug: 157195715
Change-Id: I62c9320510dc92358da8b8e9030c064b477d4a8a
M fragment/fragment/src/androidTest/java/androidx/fragment/app/NestedFragmentRestoreTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/Fragment.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentStateManager.java
jb...@google.com <jb...@google.com> #3
This has been fixed internally and will be available in the Fragment 1.3.0-alpha06 release.
Description
Component used: Fragment
Version used:1.3.0-alpha03 up to 1.3.0-alpha05
Devices/Android versions reproduced on: any
Sample code:https://gist.github.com/amihusb/7f2b38904d6245eb1c70064cb3ca6fd4
This is happening because Dialog#onRestoreInstanceState now gets called in DialogFragment#onViewStateRestored and child fragments gets restored their views before parent fragment, dialog restoring its own state and call show() before the parent dialog