Status Update
Comments
ja...@google.com <ja...@google.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
ja...@google.com <ja...@google.com> #5
There is no diff between beta07 and beta08/rc01 in the Compose code related to the Profile screen.
an...@google.com <an...@google.com>
ch...@google.com <ch...@google.com> #6
My initial investigation shows that the code for updating the a transparent snapshot is incorrect and has been incorrect since it was written (~1447 of Snapshots.kt).
It updates the transparent snapshot when the global snapshot is advanced but this is not necessary as the transparent snapshot, if it contains a null
parent snapshot, will use the current global snapshot, no need to create another one.
In this case this causes a problem as the global snapshot has been advanced (when the subcompose commits) but the transparent snapshot is not updated as it is not yet the current snapshot. My initial analysis is that this will work fine if the code to update a transparent snapshot is just removed out of advanceGlobalSnapshot
. As this code is old I suspect it was left over from prior to the refactoring I did to change transparent snapshots to use the current global snapshot instead of the current global when they are created.
As this is not a new problem, I suspect but have not verified, that this is a latent bug triggered by an unrelated change that introduced a call to advanceGlobalSnapshot()
that was not there in prior versions. Calling advanceGlobalSnspshot()
should be transparent but in this case it is not.
ap...@google.com <ap...@google.com> #7
Branch: androidx-main
commit beeb84e7be604088ad40e080a8d0adb1bacbf695
Author: Chuck Jazdzewski <chuckj@google.com>
Date: Thu Jul 08 10:04:28 2021
Remove updating the transparent snapshot
A transparent snapshot is create for the block exeucted by
`Snapshot.observe()` which registers read and write observers
but without creating a snapshot. The code to advance the
global snapshot, however, created a new transparent snapshot in
an attempt to update it to the new global snapshot it just
created. This is not necessary, however, as the transparent
snapshot will retrieve the current global snapshot from
`currentGlobalSnapshot` instead of `previousSnapshot` if
`previousSnapshot` is `null`. With the previous code, if the
global snapshot is advanced by applying a new snapshot the
"updated" transparent snapshot will be left referring to an
older snapshot instead of the most recent global snapshot.
Any snapshot object created in the newly applied snapshot
will throw an exception when it is accessed, as reported in
the bugs. The solution is to remove the apparent vetiagal code.
Test: ./gradlew :compose:r:r:tDUT
Fixes:
Change-Id: I2c0d0b8f57bf70e5a98ea36ed141d97142a5e53e
M compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/Snapshot.kt
M compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/snapshots/SnapshotTests.kt
Description
Jetpack Compose release version: 1.0.0-rc01
androidGradlePlugin "com.android.tools.build:gradle:7.1.0-alpha02" and "com.android.tools.build:gradle:7.0.0-beta04"
Accompanist version = "0.13.0"
Android Studio Build: Bumblebee canary 2 and AF beta3
Jetchat version v1.0.0-rc01 ->
Emulator used: Pixel 2 API 30
Steps to Reproduce:
1. Open Jetchat
2. Open Profile screen (through drawer or clicking on avatar)
3. Rotate device
This is a regression.
Crash:
java.lang.IllegalStateException: Reading a state that was created after the snapshot was taken or in a snapshot that has not yet been applied
at androidx.compose.runtime.snapshots.SnapshotKt.readError(Snapshot.kt:1530)
at androidx.compose.runtime.snapshots.SnapshotKt.readable(Snapshot.kt:1526)
at androidx.compose.runtime.snapshots.SnapshotKt.readable(Snapshot.kt:1517)
at androidx.compose.runtime.SnapshotMutableStateImpl.getValue(SnapshotState.kt:143)
at com.google.accompanist.insets.InsetsPaddingValues.getAdditionalStart-D9Ej5fM(Padding.kt:345)
at com.google.accompanist.insets.InsetsPaddingValues.calculateLeftPadding-u2uoSUM(Padding.kt:299)
at androidx.compose.foundation.layout.PaddingValuesModifier$measure$2.invoke(Padding.kt:423)
at androidx.compose.foundation.layout.PaddingValuesModifier$measure$2.invoke(Padding.kt:421)
at androidx.compose.ui.layout.MeasureScope$layout$1.placeChildren(MeasureScope.kt:68)
at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.placeAt-f8xVGno(DelegatingLayoutNodeWrapper.kt:111)
at androidx.compose.ui.layout.Placeable.access$placeAt-f8xVGno(Placeable.kt:31)
at androidx.compose.ui.layout.Placeable$PlacementScope.placeRelative(Placeable.kt:359)
at androidx.compose.ui.layout.Placeable$PlacementScope.placeRelative$default(Placeable.kt:179)
at androidx.compose.foundation.layout.PaddingModifier$measure$1.invoke(Padding.kt:370)
at androidx.compose.foundation.layout.PaddingModifier$measure$1.invoke(Padding.kt:368)
(full trace attached)