Status Update
Comments
il...@google.com <il...@google.com> #2
Jeremy, is this still an issue? I think the problem was that you had two transitions targeting the same View for the same action (e.g. two Slide() transitions).
be...@gmail.com <be...@gmail.com> #3
I have a similar issue with plain AnimatorSet:
set.start()
set.pause()
set.setCurrentPlayTime(100)
set.setCurrentPlayTime(0)
set.setCurrentPlayTime(100)
set.resume()
doesn't play animation in resume().
il...@google.com <il...@google.com> #4
Should clarify that if I filter out setCurrentPlayTime(0)
(or replace it with setCurrentPlayTime(1)
) it works well.
Also even with setCurrentPlayTime(0)
, onAnimationEnd
is notified with correct delay (as if the animation has played).
be...@gmail.com <be...@gmail.com> #5
@
I think that is intended for Animator. If you set the currentPlayTime
to 0 or the total duration the animator completes. We do some
be...@gmail.com <be...@gmail.com> #6
Did some investigation on the Fragment side and it seems like the merged transition is targeting correctly.
Exiting Transition: Slide@aa9288e: tgts(android.widget.LinearLayout{f9add3d})
>>>>> ExitingViews <<<<<
View: android.widget.LinearLayout{f9add3d}
Entering Transition: Slide@35b8af: tgts(android.widget.LinearLayout{b7f24bc})
>>>>> EnteringViews <<<<<
View: android.widget.LinearLayout{b7f24bc}
Final merged transition: TransitionSet@7bc1c45:
TransitionSet@e133f9a:
Slide@aa9288e: tgts(android.widget.LinearLayout{f9add3d})
Slide@35b8af: tgts(android.widget.LinearLayout{b7f24bc})
merged transition passed to controlDelayedTransition: TransitionSet@7bc1c45:
TransitionSet@e133f9a:
Slide@aa9288e: tgts(android.widget.LinearLayout{f9add3d})
Slide@35b8af: tgts(android.widget.LinearLayout{b7f24bc})
Still digging.
be...@gmail.com <be...@gmail.com> #7
Branch: androidx-main
commit 567b7459329d1ec8d27a8c6fe1c4a86442065d7d
Author: Jeremy Woods <jbwoods@google.com>
Date: Tue Sep 26 20:06:54 2023
Add additional logging for transitions
Adding more debug logging in transitions to track the entering and
exiting transitions as well as the final merged transition and its
targets.
Test: added logging
Bug: 300157785
Change-Id: I0d9ad72b865422493c6c895ddb6115abf85eed16
M fragment/fragment/src/main/java/androidx/fragment/app/DefaultSpecialEffectsController.kt
il...@google.com <il...@google.com>
to...@gmail.com <to...@gmail.com> #8
So I have isolated this outside of fragment into something much simpler and I think it breaks down when it comes to the adding and removing of Views with animateToStart.
The attached sample is a simple add that goes between two screens BLUE
and GREEN
. It has code for both the 1.5.0-alpha03
and 1.5.0-alpha04
versions, but I think alpha04 is currently broken in another way so I will upload the alpha03 version here.
This is integrated with predictive back similar to how fragment is, so upon cancelling we call animateToStart
, then we do a beginDelayedTransition
on a 0
duration Fade()
and we reverse the view visibility back to what it was prior to starting the transition.
If you only do visibility, cancel always works the view never goes away, it is wonderful, but when you do adding and removing views like we need to in fragment it fails.
First the code for beginDelayedTransition goes from this:
TransitionManager.beginDelayedTransition(container, Fade().apply {
duration = 0
})
reverseViews()
to this:
TransitionManager.beginDelayedTransition(container, Fade().apply {
duration = 0
addListener(onEnd = {
reverseViews()
blueScreen.visibility = View.VISIBLE
greenScreen.visibility = View.VISIBLE
})
})
reverseViews(useVisibility = true)
We need to make this change because after the animateToStart()
view is still parented by the overlay, so we call reverseViews(useVisibility = true)
to only change the visibility and then once the transition finishes we can call reverseViews()
to parent the view properly, then we make both views visible again.
From our perspective after the 0
duration transition our views are back in the proper state, but they do not transition properly after a cancel.
If the app is doing this wrong and we can make the appropriate fixes, doing the same in fragment should resolve this. There is logging available that shows the state of the views when we start the transition.
be...@gmail.com <be...@gmail.com> #9
The API has changed since that project was created in a way that makes the API more robust. I'm hoping that has fixed this...
jb...@google.com <jb...@google.com> #10
There appears to be a problem with the order of operations. I'm going to look into fixing that.
ap...@google.com <ap...@google.com> #11
Branch: androidx-main
commit e57dd5f9ac6cbb8cf83b221e2d5b3fbd3e88ce6b
Author: George Mount <mount@google.com>
Date: Thu Nov 09 14:33:53 2023
Fix animateToStart with Slide.
Fixes: 300157785
Slide was not repositioning the View to its proper
translation after animating it to the start position.
This fixes that so that it is moved.
Test: new test
Change-Id: I698f4dbcef46304f9aa545847d205f7b70c80d63
M transition/transition/src/androidTest/java/androidx/transition/SlideEdgeTest.java
M transition/transition/src/androidTest/java/androidx/transition/TranslationAnimationCreatorTest.java
M transition/transition/src/main/java/androidx/transition/TranslationAnimationCreator.java
jb...@google.com <jb...@google.com> #12
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.transition:transition:1.5.0-alpha05
na...@google.com <na...@google.com> #13
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.fragment:fragment:1.6.0-alpha09
androidx.fragment:fragment-ktx:1.6.0-alpha09
ma...@gmail.com <ma...@gmail.com> #14
I'm using fragment-ktx
version 1.6.1, and after an upgrade to androidx.navigation
2.7.1 (from 2.3.x) we started experiencing very similar issue:
E java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.next(ArrayList.java:860)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1915)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1845)
at androidx.fragment.app.FragmentManager.popBackStackImmediate(FragmentManager.java:891)
at androidx.fragment.app.FragmentManager.popBackStackImmediate(FragmentManager.java:797)
at androidx.fragment.app.FragmentManager.handleOnBackPressed(FragmentManager.java:717)
at androidx.fragment.app.FragmentManager$1.handleOnBackPressed(FragmentManager.java:447)
at androidx.activity.OnBackPressedDispatcher.onBackPressed(OnBackPressedDispatcher.kt:213)
at androidx.activity.OnBackPressedDispatcher$2.invoke(OnBackPressedDispatcher.kt:102)
at androidx.activity.OnBackPressedDispatcher$2.invoke(OnBackPressedDispatcher.kt:102)
at androidx.activity.OnBackPressedDispatcher$Api33Impl.createOnBackInvokedCallback$lambda$0(OnBackPressedDispatcher.kt:286)
at androidx.activity.OnBackPressedDispatcher$Api33Impl.$r8$lambda$tzBBo0FLedRCWSI6_icF8qhF74s(Unknown Source:0)
at androidx.activity.OnBackPressedDispatcher$Api33Impl$$ExternalSyntheticLambda0.onBackInvoked(Unknown Source:2)
at android.view.ViewRootImpl$NativePreImeInputStage.onProcess(ViewRootImpl.java:7558)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:7213)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:10788)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:10676)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:10632)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:10926)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:285)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:335)
at android.os.Looper.loopOnce(Looper.java:186)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8757)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
I wasn't able to come up with a repro yet, since this only happens occasionally. It seems it only happens when navigating back from a backstack with multiple entries. The app opts in the predictive back feature, it uses single navigation component graph + I haven't found single FragmentManager interaction that would be called outside of the scope of the main thread.
It looks like adding @MainThread
annotations wasn't enough, and people are still able to call FragmentManager methods the wrong way (I'm referring to code from latest stable navigation component library). Have you considered fixing the root cause of ConcurrentModificationException
? Or maybe it would be possible to help developers identify offending code (the ones that suposedly calls FragmentManager methods on a wrong thread)? Looking at the stacktrace it looks like the issue is fully within the FragmentManager implementation 🤷♂️
Description
Version used:
dependencies {
...
implementation 'androidx.appcompat:appcompat:1.4.2'
...
Devices/Android versions reproduced on: Samsung Galaxy Note 10 / Android 12
This is a problem in androidx library:
--------- beginning of crash
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: FATAL EXCEPTION: main
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: Process: sk.alteris.app.kalendarsk, PID: 6643
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: java.util.ConcurrentModificationException
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at java.util.ArrayList$Itr.next(ArrayList.java:860)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2184)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2100)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at androidx.fragment.app.FragmentManager.execSingleAction(FragmentManager.java:1971)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at androidx.fragment.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:311)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at androidx.fragment.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:274)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1244)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1092)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at androidx.viewpager.widget.ViewPager.onMeasure(ViewPager.java:1622)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.view.View.measure(View.java:27129)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7980)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.view.View.measure(View.java:27129)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.widget.LinearLayout.measureVertical(LinearLayout.java:995)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.view.View.measure(View.java:27129)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7980)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.widget.FrameLayout.onMeasure(FrameLayout.java:197)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:145)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.view.View.measure(View.java:27129)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7980)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at androidx.appcompat.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:496)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.view.View.measure(View.java:27129)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7980)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.widget.FrameLayout.onMeasure(FrameLayout.java:197)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.view.View.measure(View.java:27129)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7980)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.view.View.measure(View.java:27129)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7980)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.widget.FrameLayout.onMeasure(FrameLayout.java:197)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at com.android.internal.policy.DecorView.onMeasure(DecorView.java:1277)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.view.View.measure(View.java:27129)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:4528)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:3220)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3525)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2911)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:10458)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1108)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.view.Choreographer.doCallbacks(Choreographer.java:866)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.view.Choreographer.doFrame(Choreographer.java:797)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1092)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:938)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:226)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.os.Looper.loop(Looper.java:313)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:8663)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
06-20 19:51:20.465 10283 6643 6643 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
06-20 19:51:20.465 10227 7726 7726 I HWRResConfig: [setPreloadRootDirectoryPath] mPreloadRootDirPath is set with /product/HWRDB/
06-20 19:51:20.467 1000 966 1340 D SyncManager: userId - 0 auto - true
06-20 19:51:20.469 1000 966 1544 D Debug : low && ship && 3rdparty app crash, do not dump
06-20 19:51:20.469 1000 966 1544 W ActivityManager: crash : sk.alteris.app.kalendarsk,10283