Status Update
Comments
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #2
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
jb...@google.com <jb...@google.com> #3
This is fixed internally and will be available in the Fragment 1.7.0-alpha04
release.
pr...@google.com <pr...@google.com> #4
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.fragment:fragment:1.7.0-alpha04
pa...@gmail.com <pa...@gmail.com> #5
Thanks Mr Woods! The back gesture now seems to be working, although there are still some remaining issues in alpha04:
When you go to the second fragment in the sample app (with version changed to alpha04 in libs.versions.toml), then the touch targets in the app bar are still covered by some earlier state I think. They are not responding (no ripple and nothing happens), and as soon as you are moving the finger slightly to one side, the touch targets seem to be reached. In my own project with alpha04 the behavior is the same, but multiple taps on the invalid touch target produce an IllegalArgumentException like in alpha03, which I somehow couldn't reproduce with the sample app this time:
java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 0
at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
at java.util.Objects.checkIndex(Objects.java:359)
at java.util.ArrayList.get(ArrayList.java:434)
at androidx.fragment.app.FragmentManager.prepareBackStackState(FragmentManager.java:2478)
at androidx.fragment.app.FragmentManager$PrepareBackStackTransitionState.generateOps(FragmentManager.java:3726)
at androidx.fragment.app.FragmentManager.generateOpsForPendingActions(FragmentManager.java:2256)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1922)
at androidx.fragment.app.FragmentManager.executePendingTransactions(FragmentManager.java:719)
at androidx.fragment.app.FragmentManager.cancelBackStackTransition(FragmentManager.java:989)
at androidx.fragment.app.FragmentManager$1.handleOnBackCancelled(FragmentManager.java:523)
at androidx.activity.OnBackPressedDispatcher.onBackCancelled(OnBackPressedDispatcher.kt:295)
at androidx.activity.OnBackPressedDispatcher.access$onBackCancelled(OnBackPressedDispatcher.kt:63)
at androidx.activity.OnBackPressedDispatcher$4.invoke(OnBackPressedDispatcher.kt:131)
at androidx.activity.OnBackPressedDispatcher$4.invoke(OnBackPressedDispatcher.kt:127)
at androidx.activity.OnBackPressedDispatcher$Api34Impl$createOnBackAnimationCallback$1.onBackCancelled(OnBackPressedDispatcher.kt:396)
at android.window.WindowOnBackInvokedDispatcher$OnBackInvokedCallbackWrapper.lambda$onBackCancelled$3(WindowOnBackInvokedDispatcher.java:353)
at android.window.WindowOnBackInvokedDispatcher$OnBackInvokedCallbackWrapper.$r8$lambda$MvEvoNsuMagpR44wZwrfwOccMBA(Unknown Source:0)
at android.window.WindowOnBackInvokedDispatcher$OnBackInvokedCallbackWrapper$$ExternalSyntheticLambda3.run(Unknown Source:2)
at android.window.BackProgressAnimator$2.onAnimationEnd(BackProgressAnimator.java:144)
at com.android.internal.dynamicanimation.animation.DynamicAnimation.endAnimationInternal(DynamicAnimation.java:720)
at com.android.internal.dynamicanimation.animation.DynamicAnimation.doAnimationFrame(DynamicAnimation.java:690)
at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:328)
at android.animation.AnimationHandler.-$$Nest$mdoAnimationFrame(Unknown Source:0)
at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:86)
Hope you get this fixed and thank you again!
an...@gmail.com <an...@gmail.com> #6
ho...@myrealtrip.com <ho...@myrealtrip.com> #7
ha...@gmail.com <ha...@gmail.com> #8
According to above thread, you should either disable predictive back or upgrade the fragment version to 1.8.3
Description
Component used: Fragment
Version used: 1.7.0-alpha03
Devices/Android versions reproduced on: Pixel 6 with Android 14
The short summary of the issue is that once the predictive back gesture is completed (or started and canceled only), the fragments seem to be stacked on top of each other, with the top one displaying its contents without being interactive and the bottom one handling the touch input, which leads to crashes and unexpected behavior.
I've attached a minimal sample project to reproduce and describe the issues:
Hope you guys can fix that for the next alpha, thanks for your amazing work! :)