Status Update
Comments
ma...@google.com <ma...@google.com>
th...@gmail.com <th...@gmail.com> #2
Branch: androidx-main
commit 700259f0afe267dfe78b93db932a3cfd827a119d
Author: Sherry Hu <shuanghu@google.com>
Date: Mon May 10 14:23:09 2021
Add transition motion between fold and unfold.
Bug: 186211031
Test: manual
Change-Id: Id60f07311eca2d94ef91dc28ae45823a475160b4
M slidingpanelayout/slidingpanelayout/build.gradle
M slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/FoldTest.kt
M slidingpanelayout/slidingpanelayout/src/main/java/androidx/slidingpanelayout/widget/SlidingPaneLayout.java
an...@google.com <an...@google.com> #3
The smallest repro I was able to come up with
var flag by remember { mutableStateOf(true) }
val compositionLocal = remember { compositionLocalOf<Boolean> { error("") } }
println("MYTEST flag=$flag")
CompositionLocalProvider(compositionLocal provides flag) {
Text(
"Toggle",
Modifier
.fillMaxSize()
.drawBehind {
println("MYTEST drawing")
}
.clickable(remember { MutableInteractionSource() }, null) {
flag = !flag
}
)
println("MYTEST value outside ${compositionLocal.current}")
SubcomposeLayout {
subcompose(Unit) {
println("MYTEST value inside ${compositionLocal.current}")
}
layout(100, 100) {}
}
}
The logs after I click and switch the flag:
2021-05-11 15:12:37.224 9894-9894/androidx.compose.integration.demos I/System.out: MYTEST flag=false
2021-05-11 15:12:37.249 9894-9894/androidx.compose.integration.demos I/System.out: MYTEST value outside false
2021-05-11 15:12:37.267 9894-9894/androidx.compose.integration.demos I/System.out: MYTEST drawing
2021-05-11 15:12:37.278 9894-9894/androidx.compose.integration.demos I/System.out: MYTEST value inside false
The issue is that the subcomposition recomposition is happening on the next frame after the main composition(there is a drawing pass between them). This results in the ui being drawn in the inconsistent partially updated state. Not sure why, but when I tried to write a test with pretty much the same code the test was passing, maybe there is a difference in how we synchronize recompositon/drawing in our test infra.
Chuck, I would need your help to understand why it happens
ch...@google.com <ch...@google.com> #4
The issue is that the invalidated compositions are calculated in the Recompose as a single step. If a composition modifies a value that requires another composition that was not previously invalidated to become invalid we don't add it to the list of compositions to be composed in this frame, but leave it to the next frame.
Discussing with Adam about the best way to fix this.
ap...@google.com <ap...@google.com> #5
Branch: androidx-main
commit de27354b08213ee30616d35b2f894527125cd28a
Author: Chuck Jazdzewski <chuckj@google.com>
Date: Wed May 12 10:37:30 2021
Recompose late arriving changes immediately
If a composition changes a value observed by another composition
then the propagation of the change can be delayed by a frame. This
can cause noticible flicker as seen in
This change recomposes affected compositions immediately instead.
Relnote: """ControlledComposition API change to enable recomposing
changes in a recompose single pass."""
Fixes:
Test: ./gradlew :compose:r:r:tDUT
Change-Id: Iaafd1d5f11e2ee2b499745b9f111f7442563a4ce
M compose/runtime/runtime/api/1.0.0-beta08.txt
M compose/runtime/runtime/api/current.ignore
M compose/runtime/runtime/api/current.txt
M compose/runtime/runtime/api/public_plus_experimental_1.0.0-beta08.txt
M compose/runtime/runtime/api/public_plus_experimental_current.txt
M compose/runtime/runtime/api/restricted_1.0.0-beta08.txt
M compose/runtime/runtime/api/restricted_current.ignore
M compose/runtime/runtime/api/restricted_current.txt
M compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composer.kt
M compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composition.kt
M compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Recomposer.kt
M compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IdentityArraySet.kt
M compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IdentityScopeMap.kt
M compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/CompositionTests.kt
M compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/collection/IdentityArraySetTest.kt
M compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/collection/IdentityScopeMapTest.kt
M compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/mock/CompositionTest.kt
Description
Jetpack Compose release version:
Description: The content inside a
BoxWithConstraints
will not be updated immediately when changing the Theme between light and dark.Steps to Reproduce: