Fixed
Status Update
Comments
il...@google.com <il...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 57ca221882695bd6a52549f4d9ea3b812e6fe87c
Author: Simon Schiller <simonschiller@users.noreply.github.com>
Date: Mon Mar 22 16:09:30 2021
[GH] [FragmentStrictMode] Detect <fragment> tag usage
## Proposed Changes
- Detect `<fragment>` tag usage inside XML layouts
## Testing
Test: See `FragmentStrictModeTest#detectFragmentTagUsage`
## Issues Fixed
Fixes: 153738235
This is an imported pull request fromhttps://github.com/androidx/androidx/pull/141 .
Resolves #141
Github-Pr-Head-Sha: 4ea052596e4341b9f11bcf335e2bc38045a91f19
GitOrigin-RevId: 62e7487aa4874eef6bb556490e193717cf937251
Change-Id: Iae48578e85e4e4897f806d7ade2e2a660adf9479
M fragment/fragment/api/public_plus_experimental_current.txt
M fragment/fragment/api/restricted_current.txt
M fragment/fragment/src/androidTest/java/androidx/fragment/app/strictmode/FragmentStrictModeTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentLayoutInflaterFactory.java
M fragment/fragment/src/main/java/androidx/fragment/app/strictmode/FragmentStrictMode.java
A fragment/fragment/src/main/java/androidx/fragment/app/strictmode/FragmentTagUsageViolation.java
https://android-review.googlesource.com/1649748
Branch: androidx-main
commit 57ca221882695bd6a52549f4d9ea3b812e6fe87c
Author: Simon Schiller <simonschiller@users.noreply.github.com>
Date: Mon Mar 22 16:09:30 2021
[GH] [FragmentStrictMode] Detect <fragment> tag usage
## Proposed Changes
- Detect `<fragment>` tag usage inside XML layouts
## Testing
Test: See `FragmentStrictModeTest#detectFragmentTagUsage`
## Issues Fixed
Fixes: 153738235
This is an imported pull request from
Resolves #141
Github-Pr-Head-Sha: 4ea052596e4341b9f11bcf335e2bc38045a91f19
GitOrigin-RevId: 62e7487aa4874eef6bb556490e193717cf937251
Change-Id: Iae48578e85e4e4897f806d7ade2e2a660adf9479
M fragment/fragment/api/public_plus_experimental_current.txt
M fragment/fragment/api/restricted_current.txt
M fragment/fragment/src/androidTest/java/androidx/fragment/app/strictmode/FragmentStrictModeTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentLayoutInflaterFactory.java
M fragment/fragment/src/main/java/androidx/fragment/app/strictmode/FragmentStrictMode.java
A fragment/fragment/src/main/java/androidx/fragment/app/strictmode/FragmentTagUsageViolation.java
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-master-dev
commit d73a0b625d96f1be7cdc47076560e4d7f3a01077
Author: Ian Lake <ilake@google.com>
Date: Thu Dec 05 15:38:03 2019
Properly destroy non-config of <fragment> tag
When a <fragment> tag added Fragment isn't
always in your layout, it can get stuck in
INITIALIZING and therefore does not get
properly cleared when the FragmentManager is
destroyed.
Change it so that Fragments in this state correctly
move to CREATED and get cleaned up appropriately.
Test: newly added test passes
BUG: 145769287
Change-Id: I4eea2c00d3085a62581ddb26e442cf109a04a249
M fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentLifecycleTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentStateManager.java
https://android-review.googlesource.com/1183079
Branch: androidx-master-dev
commit d73a0b625d96f1be7cdc47076560e4d7f3a01077
Author: Ian Lake <ilake@google.com>
Date: Thu Dec 05 15:38:03 2019
Properly destroy non-config of <fragment> tag
When a <fragment> tag added Fragment isn't
always in your layout, it can get stuck in
INITIALIZING and therefore does not get
properly cleared when the FragmentManager is
destroyed.
Change it so that Fragments in this state correctly
move to CREATED and get cleaned up appropriately.
Test: newly added test passes
BUG: 145769287
Change-Id: I4eea2c00d3085a62581ddb26e442cf109a04a249
M fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentLifecycleTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentStateManager.java
Description
Version used: 1.2.0-rc03
Devices/Android versions reproduced on:
When you use a <fragment> tag and do a configuration change to a layout that does not contain the <fragment> tag, the Fragment is still recreated by FragmentManager, but stays in the INITIALIZING state.
If the FragmentManager is then destroyed (i.e., by the user hitting back, the parent fragment being removed, etc), the non-config state is not correctly cleared out. This can be seen by checking if any ViewModels are cleared or if any retained child fragments are destroyed.