Fixed
Status Update
Comments
da...@google.com <da...@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
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 752ab57254b100d48f87172fdc9af288753d9491
Author: Jeremy Woods <jbwoods@google.com>
Date: Fri Nov 20 12:51:59 2020
Only requestFocus on child views of Fragments
When resuming a Fragment, before we call requestFocus(), we should check
that the saved focus view is still within the fragment view hierarchy.
If the saved view is not present we should avoid making the call to
requestFocus().
RelNote: "Fragments that remove their focused view during an animation
will no longer attempt to restore the focus on the detached view once
they reach RESUMED"
Test: focusViewRemoved
Bug: 172925703
Change-Id: I38c65f834e9b85c365952fdb1e84e03a82863063
A fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentFocusTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentStateManager.java
https://android-review.googlesource.com/1506491
Branch: androidx-master-dev
commit 752ab57254b100d48f87172fdc9af288753d9491
Author: Jeremy Woods <jbwoods@google.com>
Date: Fri Nov 20 12:51:59 2020
Only requestFocus on child views of Fragments
When resuming a Fragment, before we call requestFocus(), we should check
that the saved focus view is still within the fragment view hierarchy.
If the saved view is not present we should avoid making the call to
requestFocus().
RelNote: "Fragments that remove their focused view during an animation
will no longer attempt to restore the focus on the detached view once
they reach RESUMED"
Test: focusViewRemoved
Bug: 172925703
Change-Id: I38c65f834e9b85c365952fdb1e84e03a82863063
A fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentFocusTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentStateManager.java
jb...@google.com <jb...@google.com> #4
This has been fixed internally and will be available in the Fragment 1.3.0-beta02
release.
Description
Version used: fragment-ktx:1.3.0-beta01
This bug is part of the problem of
Steps to reproduce
- Fragment1 replaced with fragment2, then press BACK as soon as I see the fragment2 is showing.
- Upon returning, fragment1 calls AnimationInfo.mFocusedView.requestFocus(). However the view being called requestFocus() belongs to the old view tree, it's not belonging to the new view tree that is created during returning.
The bug is hard to reproduce. It's around 1/50 for me using project at
Attached a screenshot showing "detached state" of the view.
The bug is probably not critical because calling requestFocus() on a detached view should be no-op. But it may cause problem if the app added a onFocusChange listener and perform some logic in the fragment (as illustrated in leanback crash