Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit cdaa373d842f07e1aa29514afa10bc86f111339b
Author: Jeremy Woods <jbwoods@google.com>
Date: Thu Feb 18 13:17:47 2021
Fix inflating <fragment> tag without a container
aosp/1591056 fixed an issue that was preventing <fragment> tag inflated
fragments from getting to resume if the activity was already resumed. It
used the container passed in from inflate, but that can be null as in
the case of inflating a view for use with the dialog fragment, so we
should use fragment view's parent. We know this will not be null since
it is inside of an onViewAttachedtoWindow listener.
Test: testInflatedDialogFragmentShows
Bug: 180538371
Fixes: 180637744
Change-Id: I11920da0b6603db82b272edd553f8e66b3c9248c
M fragment/fragment/src/androidTest/java/androidx/fragment/app/DialogFragmentTest.kt
A fragment/fragment/src/androidTest/res/layout/inflated_fragment_tag.xml
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentLayoutInflaterFactory.java
https://android-review.googlesource.com/1595193
Branch: androidx-main
commit cdaa373d842f07e1aa29514afa10bc86f111339b
Author: Jeremy Woods <jbwoods@google.com>
Date: Thu Feb 18 13:17:47 2021
Fix inflating <fragment> tag without a container
aosp/1591056 fixed an issue that was preventing <fragment> tag inflated
fragments from getting to resume if the activity was already resumed. It
used the container passed in from inflate, but that can be null as in
the case of inflating a view for use with the dialog fragment, so we
should use fragment view's parent. We know this will not be null since
it is inside of an onViewAttachedtoWindow listener.
Test: testInflatedDialogFragmentShows
Bug: 180538371
Fixes: 180637744
Change-Id: I11920da0b6603db82b272edd553f8e66b3c9248c
M fragment/fragment/src/androidTest/java/androidx/fragment/app/DialogFragmentTest.kt
A fragment/fragment/src/androidTest/res/layout/inflated_fragment_tag.xml
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentLayoutInflaterFactory.java
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit 9821a81abedf7464527fc0ff87d5fa3832bb6209
Author: Jeremy Woods <jbwoods@google.com>
Date: Thu Feb 18 16:03:29 2021
Ensure inflated fragments that are recreated are shown
When using the new fragment state manager, if a fragment is inflated
after the host activity is RESUMED using a FragmentContainerView, the
fragment is added and correctly moves to RESUMED the first time, but
upon config change, the fragment's view is never readded to the
container. This results in the fragment moving to RESUMED but never
being reattached to the view hierarchy.
This change finds the restored fragment and indicates to the
FragmentManager that the FragmentContainerView is ready for the fragment
to be attached.
RelNote: "Fragments inflated into an already RESUMED activity using
FragmentContainerView are now properly shown after a configuration
change."
Test: DialogFragmentTest and FragmentLifecycleTest
Bug: 180538371
Change-Id: Ie14c80467b66186862319469f51bbd4d7ebcbbb9
M fragment/fragment/src/androidTest/java/androidx/fragment/app/DialogFragmentTest.kt
M fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentLifecycleTest.kt
M fragment/fragment/src/androidTest/java/androidx/fragment/app/StrictViewFragment.kt
A fragment/fragment/src/androidTest/res/layout/inflated_fragment_container_view_no_parent.xml
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentContainerView.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
https://android-review.googlesource.com/1595200
Branch: androidx-main
commit 9821a81abedf7464527fc0ff87d5fa3832bb6209
Author: Jeremy Woods <jbwoods@google.com>
Date: Thu Feb 18 16:03:29 2021
Ensure inflated fragments that are recreated are shown
When using the new fragment state manager, if a fragment is inflated
after the host activity is RESUMED using a FragmentContainerView, the
fragment is added and correctly moves to RESUMED the first time, but
upon config change, the fragment's view is never readded to the
container. This results in the fragment moving to RESUMED but never
being reattached to the view hierarchy.
This change finds the restored fragment and indicates to the
FragmentManager that the FragmentContainerView is ready for the fragment
to be attached.
RelNote: "Fragments inflated into an already RESUMED activity using
FragmentContainerView are now properly shown after a configuration
change."
Test: DialogFragmentTest and FragmentLifecycleTest
Bug: 180538371
Change-Id: Ie14c80467b66186862319469f51bbd4d7ebcbbb9
M fragment/fragment/src/androidTest/java/androidx/fragment/app/DialogFragmentTest.kt
M fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentLifecycleTest.kt
M fragment/fragment/src/androidTest/java/androidx/fragment/app/StrictViewFragment.kt
A fragment/fragment/src/androidTest/res/layout/inflated_fragment_container_view_no_parent.xml
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentContainerView.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
jb...@google.com <jb...@google.com> #4
This has been fixed internally and will be available in the Fragment version 1.3.1
release.
ad...@gmail.com <ad...@gmail.com> #5
I am still experiencing this issue in versions 1.3.1, 1.3.2 and 1.3.3 of the fragment library. (The latest version of the fragment library at the time of writing is 1.3.3.)
Given that this issue is closed and marked as fixed, I've created a separate issue
Description
When using the new fragment state manager , if a fragment is inflated after the host activity is RESUMED, via either the deprecated , the fragment never makes it to a RESUMED state.
<fragment>
tag orFragmentContainerView
In the case of the
<fragment>
tag:VIEW_CREATED
and never makes it any furtherfor
FragmentContainerView
:RESUMED
the first time, but on configuration change, the view that inflates the fragment is never attached to the new view hierarchy, so the fragment isRESUMED
but never actually visible.We should address this issue for both components. aosp/1591056 and aosp/1593053 have been implemented for the
<fragment>
tag case. This bug will track theFragmentContainerView
case.