Status Update
Comments
to...@gmail.com <to...@gmail.com> #2
Branch: androidx-master-dev
commit f570475abb57a6527f861a083ddfccf451b3427b
Author: Sumir Kataria <sumir@google.com>
Date: Wed Aug 29 14:09:32 2018
Add ability to trigger timed work in TestDriver.
Bug: 113360060
Test: Added and ran new tests in TestSchedulerTest.
Change-Id: I681db88e3190b96e90a5d531b7b1fa053eaf8ab9
M work/workmanager-test/src/androidTest/java/androidx/work/test/TestSchedulerTest.java
A work/workmanager-test/src/androidTest/java/androidx/work/test/workers/CountingTestWorker.java
M work/workmanager-test/src/androidTest/java/androidx/work/test/workers/TestWorker.java
M work/workmanager-test/src/main/java/androidx/work/test/TestDriver.java
M work/workmanager-test/src/main/java/androidx/work/test/TestScheduler.java
M work/workmanager-test/src/main/java/androidx/work/test/WorkManagerTestInitHelper.java
to...@gmail.com <to...@gmail.com> #3
ti...@google.com <ti...@google.com>
to...@gmail.com <to...@gmail.com> #4
to...@gmail.com <to...@gmail.com> #5
If I add a .fillMaxSize()
to the modifier of the AnimatedContent
then the animation is different see video but also there's no more onSizeChanged
called just a single
2024-10-15 10:37:18.070 26417-26417 TAG app.symfonik.music.player.debug E ScreenTransition:1440 x 2812
for first render.
AnimatedContent(
targetState = navigator.lastItem,
transitionSpec = transition,
modifier = modifier.onSizeChanged {
Log.e("TAG", "ScreenTransition:$it ")
}.fillMaxSize(),
label = "",
) { screen ->
navigator.saveableState("transition", screen) {
content(screen)
}
}
to...@gmail.com <to...@gmail.com> #6
So after doing a tons of tests and removal and everything, the source cause is state restoration of the AnimatedContent
. When the state is restored, the internal state of AnimatedContent
is wrong. I suppose some things are remembered and not the others needed to go with it.
To solve this I just need to disable state saving / restoring in the tab navigator and then it works.
With that said I'll try to build a repro project now that I have the source issue.
to...@gmail.com <to...@gmail.com> #7
And here's an ugly quick repro attached (Requires latest AS canary by default)
Press toggle multiple times and see it works.
Press go next then go previous
Press toggle and see that it fails.
ti...@google.com <ti...@google.com> #8
Quick update:
I was able to repro and investigate the issue. It is indeed related to how the save and restore is set up. What I am seeing is the size change animation is accessing a stale AnimatedContentTransitionScope
instance and therefore it operates on the wrong info.
Now I'm in the process to create a minimal repro that can be added to the test to verify a potential fix.
ap...@google.com <ap...@google.com> #9
Project: platform/frameworks/support
Branch: androidx-main
Author: Doris Liu <
Link:
Update SizeAnimation internal state when transition is recreated
Expand for full commit details
Update SizeAnimation internal state when transition is recreated
This change ensures that the size animtion reads the up-to-date
target sizes when AnimatedContent is being
re-used for different transitions.
Test: New tests added
Bug: 372512085
Change-Id: I7b0569287fb5e7e59be5226d827fdbcf90e46733
Files:
- M
compose/animation/animation/src/androidInstrumentedTest/kotlin/androidx/compose/animation/AnimatedContentTest.kt
- M
compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/AnimatedContent.kt
Hash: 8a597f07a0b80ebeede28f5d2a0887820ff92bb0
Date: Wed Oct 16 16:56:24 2024
ti...@google.com <ti...@google.com> #10
Verified the fix above with repro in
to...@gmail.com <to...@gmail.com> #11
Can confirm it's fixed in my main app too.
pr...@google.com <pr...@google.com> #12
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.animation:animation:1.8.0-alpha05
androidx.compose.animation:animation-android:1.8.0-alpha05
androidx.compose.animation:animation-jvmstubs:1.8.0-alpha05
androidx.compose.animation:animation-linuxx64stubs:1.8.0-alpha05
Description
Jetpack Compose version: 1.8 snapshots starting with 12408595 (So included in alpha03)
I unfortunately have some trouble to build a small repro but that commit broke transitions handled by
AnimatedContent
in my app.See attached video.
There's also some details in slack in a thread with Doris.
To resume, there's some size resolution issues when removing and adding back screens that makes the
AnimatedContent
wrongly detect a size change and doing wrong size animations.You can see in the video that the fade transition does work, then when switching screen then going back it no more work correctly and animate the size for no reasons.
Forcing
.using(null)
does workaround the issue.When reaching the broken state, if both contents of
AnimatedContent
are boxes with.fillMaxSize()
then it just shows a black screen as is it was animating from 0 to 0 size. If one of the content does not have the.fillMaxSize()
then it leads to the size animations you can see in the video.