Fixed
Status Update
Comments
kr...@gmail.com <kr...@gmail.com> #2
I just realized that there are actually two different exceptions/crashes. When I use the back gesture in quick succession, I get the already mentioned setCurrentPlayTimeMillis
Crash:
java.lang.IllegalStateException: setCurrentPlayTimeMillis() called after animation has been started
at androidx.transition.Transition$SeekController.setCurrentPlayTimeMillis(Transition.java:2789)
at androidx.transition.FragmentTransitionSupport.setCurrentPlayTime(FragmentTransitionSupport.java:265)
at androidx.fragment.app.DefaultSpecialEffectsController$TransitionEffect.onProgress(DefaultSpecialEffectsController.kt:817)
at androidx.fragment.app.SpecialEffectsController.processProgress(SpecialEffectsController.kt:442)
at androidx.fragment.app.FragmentManager$1.handleOnBackProgressed(FragmentManager.java:554)
at androidx.activity.OnBackPressedDispatcher.onBackProgressed(OnBackPressedDispatcher.kt:258)
at androidx.activity.OnBackPressedDispatcher.access$onBackProgressed(OnBackPressedDispatcher.kt:63)
at androidx.activity.OnBackPressedDispatcher$2.invoke(OnBackPressedDispatcher.kt:129)
at androidx.activity.OnBackPressedDispatcher$2.invoke(OnBackPressedDispatcher.kt:127)
at androidx.activity.OnBackPressedDispatcher$Api34Impl$createOnBackAnimationCallback$1.onBackProgressed(OnBackPressedDispatcher.kt:391)
at android.window.WindowOnBackInvokedDispatcher$OnBackInvokedCallbackWrapper$$ExternalSyntheticLambda4.onProgressUpdate(D8$$SyntheticClass:0)
at android.window.BackProgressAnimator.updateProgressValue(BackProgressAnimator.java:167)
at android.window.BackProgressAnimator.-$$Nest$mupdateProgressValue(Unknown Source:0)
at android.window.BackProgressAnimator$1.setValue(BackProgressAnimator.java:70)
at android.window.BackProgressAnimator$1.setValue(BackProgressAnimator.java:66)
at com.android.internal.dynamicanimation.animation.DynamicAnimation.setPropertyValue(DynamicAnimation.java:731)
at com.android.internal.dynamicanimation.animation.DynamicAnimation.doAnimationFrame(DynamicAnimation.java:687)
at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:344)
at android.animation.AnimationHandler.-$$Nest$mdoAnimationFrame(Unknown Source:0)
at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:87)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1404)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1415)
at android.view.Choreographer.doCallbacks(Choreographer.java:1015)
at android.view.Choreographer.doFrame(Choreographer.java:941)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1389)
at android.os.Handler.handleCallback(Handler.java:959)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8592)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
But when I enable the system back button (3-button-navigation) and press it in quick succession, I get this crash:
java.lang.IllegalStateException: Fragment ExampleFragment{53cf465} (9226608f-e4bb-4461-a3a4-e596dfa6952a) did not return a View from onCreateView() or this was called before onCreateView().
at androidx.fragment.app.Fragment.requireView(Fragment.java:2067)
at androidx.fragment.app.SpecialEffectsController$FragmentStateManagerOperation.onStart(SpecialEffectsController.kt:789)
at androidx.fragment.app.SpecialEffectsController.processStart(SpecialEffectsController.kt:421)
at androidx.fragment.app.SpecialEffectsController.completeBack(SpecialEffectsController.kt:453)
at androidx.fragment.app.FragmentManager.handleOnBackPressed(FragmentManager.java:886)
at androidx.fragment.app.FragmentManager$1.handleOnBackPressed(FragmentManager.java:570)
at androidx.activity.OnBackPressedDispatcher.onBackPressed(OnBackPressedDispatcher.kt:279)
at androidx.activity.OnBackPressedDispatcher$3.invoke(OnBackPressedDispatcher.kt:130)
at androidx.activity.OnBackPressedDispatcher$3.invoke(OnBackPressedDispatcher.kt:127)
at androidx.activity.OnBackPressedDispatcher$Api34Impl$createOnBackAnimationCallback$1.onBackInvoked(OnBackPressedDispatcher.kt:395)
at android.view.ViewRootImpl$NativePreImeInputStage.doOnBackKeyEvent(ViewRootImpl.java:7079)
at android.view.ViewRootImpl$NativePreImeInputStage.onProcess(ViewRootImpl.java:7042)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6723)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:9827)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:9778)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:9747)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:9969)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:295)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:349)
at android.os.Looper.loopOnce(Looper.java:189)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8592)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit ce926c1290a188c0ae8b363f2d8c31dbd7738df1
Author: Jeremy Woods <jbwoods@google.com>
Date: Fri Sep 13 21:57:52 2024
Consider seeking when cancelling transition effects
Currently if you run a seekable transitions, when the operation is
cancelled, we always attempt to reverse the transition. The problem is
that there are cases when we actually want to finish the transition.
If the operation is cancelled by another incoming operation, (i.e. there
was a fragment transaction) we have been interrupted and should try to
reverse the transition. However, if the operation is cancelled by
forceComplete (i.e. fragment manager state changes, another back event,
executePendingActions, etc), we want to finish the transition.
This change looks at the seeking status of the operation, inside the
effect so that effects can now cancel with and without seeking. This
allows the TransitionEffect to consider seeking when deciding whether to
reverse the transition.
RelNote: "Fixed an issue where quickly pressing system back or doing
fast gesture back will cause Fragments to crash."
Test: Added test in transition
Bug: 364804225
Fixes: 364914301
Change-Id: Ibc038d8db7c3e7903a4dc8bfa556883705d27ee8
M fragment/fragment/src/main/java/androidx/fragment/app/DefaultSpecialEffectsController.kt
M fragment/fragment/src/main/java/androidx/fragment/app/SpecialEffectsController.kt
M transition/transition/src/androidTest/java/androidx/transition/FragmentTransitionSeekingTest.kt
https://android-review.googlesource.com/3263864
Branch: androidx-main
commit ce926c1290a188c0ae8b363f2d8c31dbd7738df1
Author: Jeremy Woods <jbwoods@google.com>
Date: Fri Sep 13 21:57:52 2024
Consider seeking when cancelling transition effects
Currently if you run a seekable transitions, when the operation is
cancelled, we always attempt to reverse the transition. The problem is
that there are cases when we actually want to finish the transition.
If the operation is cancelled by another incoming operation, (i.e. there
was a fragment transaction) we have been interrupted and should try to
reverse the transition. However, if the operation is cancelled by
forceComplete (i.e. fragment manager state changes, another back event,
executePendingActions, etc), we want to finish the transition.
This change looks at the seeking status of the operation, inside the
effect so that effects can now cancel with and without seeking. This
allows the TransitionEffect to consider seeking when deciding whether to
reverse the transition.
RelNote: "Fixed an issue where quickly pressing system back or doing
fast gesture back will cause Fragments to crash."
Test: Added test in transition
Bug: 364804225
Fixes: 364914301
Change-Id: Ibc038d8db7c3e7903a4dc8bfa556883705d27ee8
M fragment/fragment/src/main/java/androidx/fragment/app/DefaultSpecialEffectsController.kt
M fragment/fragment/src/main/java/androidx/fragment/app/SpecialEffectsController.kt
M transition/transition/src/androidTest/java/androidx/transition/FragmentTransitionSeekingTest.kt
jb...@google.com <jb...@google.com> #4
This has been fixed internally and will be available in the Fragment 1.8.4
release.
pr...@google.com <pr...@google.com> #5
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.fragment:fragment:1.8.4
kr...@gmail.com <kr...@gmail.com> #6
I just updated the example project and both crashes are indeed fixed. Thanks a lot!
pr...@google.com <pr...@google.com> #7
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.transition:transition:1.6.0-alpha01
Description
Component used: Fragment
Version used:
Devices/Android versions reproduced on:
(this was already marked as fixed in https://issuetracker.google.com/issues/338624457 , but the crash still exists in the latest library versions)
You can find a minimal sample repo here:https://github.com/kroegerama/android-fragment-crash-sample
Setup in fragment:
I'm getting this crash, when I navigate forward multiple times (navigate(FragFooDirections.actionFooBar())) and then repeatedly in quick succession use the back gesture or back button (popBackStack()).