Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit b146651745fddfdf2c1f062c12676bf82d422693
Author: Ian Lake <ilake@google.com>
Date: Tue Nov 12 16:25:22 2019
Ensure markState correctly nests stopped events
Child fragments should always be stopped
before the parent fragments. While this was
already the case when you remove() the Fragment,
markState should also be changed to have the
same behavior.
Test: new FragmentArchLifecycleTest
BUG: 144380645
Change-Id: I654b45a7cb33f165bcafee232fdd9f2888f046d3
M fragment/fragment/src/androidTest/AndroidManifest.xml
M fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentArchLifecycleTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentActivity.java
https://android-review.googlesource.com/1164269
Branch: androidx-master-dev
commit b146651745fddfdf2c1f062c12676bf82d422693
Author: Ian Lake <ilake@google.com>
Date: Tue Nov 12 16:25:22 2019
Ensure markState correctly nests stopped events
Child fragments should always be stopped
before the parent fragments. While this was
already the case when you remove() the Fragment,
markState should also be changed to have the
same behavior.
Test: new FragmentArchLifecycleTest
BUG: 144380645
Change-Id: I654b45a7cb33f165bcafee232fdd9f2888f046d3
M fragment/fragment/src/androidTest/AndroidManifest.xml
M fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentArchLifecycleTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentActivity.java
il...@google.com <il...@google.com> #3
This has been fixed internally and will be available in Fragments 1.2.0-rc03
Description
Version used: 1.2.0-rc02
When the FragmentActivity hits onSaveInstanceState(), FragmentActivity moves all of the FragmentManagers to STOPPED, as expected.
However, it is expected that Lifecycle changes are always nested:
- Parent ON_START
- Child ON_START
- Parent ON_RESUME
- Child ON_RESUME
---
- Child ON_PAUSE
- Parent ON_PAUSE
- Child ON_STOP
- Parent ON_STOP
But in the case of onSaveInstanceState() it appears that the markState() method stops the parent Fragments first before the children, breaking the nesting guarantee.
You can verify the correct ordering by calling remove on the parent Fragment - you'll see the proper nesting there.