Fixed
Status Update
Comments
tf...@gmail.com <tf...@gmail.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 0d5272e6e4fe56f09e5246d42c0930bcc50e26fa
Author: Jeremy Woods <jbwoods@google.com>
Date: Tue Sep 29 23:38:37 2020
Fix issues caused by interrupting exit effects
When removing a fragment using an exit effect, then reversing the exit
operation (by using the back button) to an enter effect, while exiting
the fragment only ever makes it to AWAITING_EXIT_EFFECTS so the view is
not destroyed. This means that when the fragment attempts to reenter it
does not go through createView() which gets the view ready for effects.
For this case, we need to:
1. Ensure we endViewTransition() on the exiting view since the one we
call in onAnimationEnd() wouldn't be executed until after the enter
aniamtion ended.
2. We need to prepare the entering view to be animated in by setting
its alpha to 0, then same as we should if it had gone through createView
RelNote: "Exiting fragments that have their effects reversed now
correctly cancel and restart with the proper entering effect."
Bug: 167092035
Test: FragmentAnimationTest.popReplaceOperationWithAnimation
Change-Id: I622265e9b4ebb210657aac2a5b97dd47061bfd5c
M fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentAnimationTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentStateManager.java
https://android-review.googlesource.com/1442517
Branch: androidx-master-dev
commit 0d5272e6e4fe56f09e5246d42c0930bcc50e26fa
Author: Jeremy Woods <jbwoods@google.com>
Date: Tue Sep 29 23:38:37 2020
Fix issues caused by interrupting exit effects
When removing a fragment using an exit effect, then reversing the exit
operation (by using the back button) to an enter effect, while exiting
the fragment only ever makes it to AWAITING_EXIT_EFFECTS so the view is
not destroyed. This means that when the fragment attempts to reenter it
does not go through createView() which gets the view ready for effects.
For this case, we need to:
1. Ensure we endViewTransition() on the exiting view since the one we
call in onAnimationEnd() wouldn't be executed until after the enter
aniamtion ended.
2. We need to prepare the entering view to be animated in by setting
its alpha to 0, then same as we should if it had gone through createView
RelNote: "Exiting fragments that have their effects reversed now
correctly cancel and restart with the proper entering effect."
Bug: 167092035
Test: FragmentAnimationTest.popReplaceOperationWithAnimation
Change-Id: I622265e9b4ebb210657aac2a5b97dd47061bfd5c
M fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentAnimationTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentStateManager.java
il...@google.com <il...@google.com>
ja...@gmail.com <ja...@gmail.com> #4
Any plans soon to release a new fragment beta containing the fix?
il...@google.com <il...@google.com> #5
Re #4 - we're working through our FragmentManager.enableNewStateManager(false)
until that point.
Description
Component used: Fragment
Version used: 1.3.0-alpha08
Devices/Android versions reproduced on: Pixel 4 / Android 10
Sample project:https://github.com/tfcporciuncula/broken-transition
Fragment blinking issue video:https://github.com/tfcporciuncula/broken-transition/blob/master/videos/red%20blink.mp4 (you might need to go frame by frame in the video to see the blinking)
Back issue video:https://github.com/tfcporciuncula/broken-transition/blob/master/videos/back%20regular.mp4 ( and here's a video with the regular behavior for this )
I have very simple slide transitions defined by myself ( exactly like these ones ) and I noticed they got a bit broken after I updated everything to the latest version. I decided to call
FragmentManager.enableNewStateManager(false)
to check if the issues were related to the new state manager, and indeed the issues were gone after that.The first issue I noticed was that the fragment I'm transitioning to blinks in the very beginning of the transition. I managed to reproduce it in the very simple example I'm linking here, but for some reason the issue seems to happen more frequently on my actual app and not that often in the sample, even though it still happen fairly often. It feels like it's a single frame blink, so it's a little hard to see but it's definitely noticeable when it happens.
There's a second issue I noticed while testing this with a super slow transition duration: when I tap back during the transition from the blue fragment to the red fragment, I end up in a blank screen. If I have the
enableNewStateManager(false)
call, it simply moves to the end of the transition and transitions back from the blue fragment to the red, certainly a better behavior.