Status Update
Comments
mi...@perplexity.ai <mi...@perplexity.ai> #2
Branch: androidx-master-dev
commit c60f33e229e31ab328ef6b59dab63b264954831c
Author: Alexandre Elias <aelias@google.com>
Date: Fri Jul 10 16:23:09 2020
Semantics no-op cleanups
Partly in response to lmr's broad code review, I did a pass of
superficial API/implementation cleanup. The main changes are:
- I changed each Boolean SemanticsProperty where false is equivalent to
not being present to take "Unit" instead. This is conceptually
clearer: it avoids questions like "can I cancel out a semantics from a
merged child by setting it to false?" Because "property = Unit" looks
weird, I also changed the style of these to "property()".
- I moved the Semantics id generator closer to where it's used, in
SemanticsModifierCore. I made it internal and an AtomicInt.
(Note that integer ids are heavily used in the Android
AccessibilityNodeInfo APIs so I can't simply remove them entirely.)
- I deleted dead code. Some examples include SemanticsHintOverrides,
a public API not connected to anything, and SemanticsPropertyKey
merge() open method which is never called. (In both cases I have
a different plan in mind for accessibility.)
Fixes: 145951226
Fixes: 145955412
Test: existing tests
Relnote: "Single-value semantics properties now use a calling style.
For example, 'semantics { hidden = true }' is now written as:
'semantics { hidden() }'."
Change-Id: Ic1afd12ea22c926babc9662f1804d80b33aa0cfc
M ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/LayoutNodeModifierBenchmark.kt
M ui/ui-core/api/0.1.0-dev15.txt
M ui/ui-core/api/current.txt
M ui/ui-core/api/public_plus_experimental_0.1.0-dev15.txt
M ui/ui-core/api/public_plus_experimental_current.txt
M ui/ui-core/api/restricted_0.1.0-dev15.txt
M ui/ui-core/api/restricted_current.txt
M ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/graphics/vector/VectorTest.kt
M ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/semantics/SemanticsTests.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidActuals.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidComposeView.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidComposeViewAccessibilityDelegateCompat.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidPopup.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/Expect.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsConfiguration.kt
D ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsHintOverrides.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsModifier.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsNode.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsOwner.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsWrapper.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/semantics/SemanticsProperties.kt
M ui/ui-foundation/api/0.1.0-dev15.txt
M ui/ui-foundation/api/current.txt
M ui/ui-foundation/api/public_plus_experimental_0.1.0-dev15.txt
M ui/ui-foundation/api/public_plus_experimental_current.txt
M ui/ui-foundation/api/restricted_0.1.0-dev15.txt
M ui/ui-foundation/api/restricted_current.txt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Clickable.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Dialog.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/Selectable.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/Toggleable.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/semantics/FoundationSemanticsProperties.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/CardTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/CheckboxScreenshotTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/RadioButtonScreenshotTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/ScaffoldTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/SurfaceTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/ripple/RippleIndicationTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/textfield/TextFieldScreenshotTest.kt
M ui/ui-material/src/main/java/androidx/ui/material/AppBar.kt
M ui/ui-material/src/main/java/androidx/ui/material/TextFieldImpl.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/AssertsTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/CallSemanticsActionTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/ErrorMessagesTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/FindersTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/PrintToStringTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/ScrollToTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/TextActionsTest.kt
M ui/ui-test/src/main/java/androidx/ui/test/Actions.kt
M ui/ui-test/src/main/java/androidx/ui/test/Filters.kt
M ui/ui-text/api/0.1.0-dev15.txt
M ui/ui-text/api/current.txt
M ui/ui-text/api/public_plus_experimental_0.1.0-dev15.txt
M ui/ui-text/api/public_plus_experimental_current.txt
M ui/ui-text/api/restricted_0.1.0-dev15.txt
M ui/ui-text/api/restricted_current.txt
M ui/ui-text/src/commonMain/kotlin/androidx/ui/text/CoreTextField.kt
M ui/ui-text/src/commonMain/kotlin/androidx/ui/text/TextSemanticsProperties.kt
ti...@google.com <ti...@google.com> #3
In your BoxWithConstraints
do you do any conditional composition? Things like:
if (constraintsExceedsCertainThreshold) composeSomeContent() else someOtherContent()
mi...@perplexity.ai <mi...@perplexity.ai> #4
Also note `sharedElement` is put on `BoxWithContraints` now, not on the content.
Thanks!
ti...@google.com <ti...@google.com> #5
Based on the stacktrace, it seems like the item in question is composed but never placed. Do you use custom precompose
or prefetch logic in your lazy list?
mi...@perplexity.ai <mi...@perplexity.ai> #6
There is also one `AnimatedContent` above the `BoxWithConstraints`. Could this cause issues?
Thank you for looking into this.
ti...@google.com <ti...@google.com> #7
The AnimatedContent never skips measuring/placing children after it composes them. So I don't expect that to be the issue.
Since you mentioned the modifier is on BoxWithConstraints
rather than on the children of BoxWithConstraints
, my guess is it's most likely related to LazyList.
Can you clarify what type of LazyList you are using? Is it LazyColumn/Row or LazyGrid, or something else?
mi...@perplexity.ai <mi...@perplexity.ai> #8
It's a LazyColumn.
ti...@google.com <ti...@google.com>
mi...@perplexity.ai <mi...@perplexity.ai> #9
One interesting observation is that this stack trace did not seem to come from the ComposeView
with our app's Activity
content. Because I did a release with copy pasted setContent
+ ComposeView
subclass that is catching exceptions in dispatchDraw
and it did not catch this crash. Is the animations framework doing content composition outside the app's composition context? One note: at the time I tried this exception catching, sharedElement
was applied to the content of BoxWithConstraints
(rather than to the BoxWithConstraints
itself), but I don't think this would have caused the exception catching not to work.
mi...@perplexity.ai <mi...@perplexity.ai> #10
Hey, sorry to insist - any more ideas here?
ti...@google.com <ti...@google.com> #11
I'm investigating what would cause items to be composed but not placed.
We'll submit a fix in shared element in 1.8 to account for that scenario if that's an intended behavior.
Have you tried a recent 1.8 release and see if it's reproducible?
mi...@perplexity.ai <mi...@perplexity.ai> #12
Thank you!
Unfortunately we cannot release publicly with 1.8 alpha, and we never reproed this issue locally even with 1.7.x.
ti...@google.com <ti...@google.com> #13
I'll prepare a fix to account for the use case where content may be composed but never participate in either measurement or placement. Keep in mind, the fix likely will only land in 1.8.
mi...@perplexity.ai <mi...@perplexity.ai> #14
Awesome, thank you! If there's any chance to have it in 1.7.6, would be absolutely amazing, but no worries if not. Thanks a lot again for the help!
ap...@google.com <ap...@google.com> #15
Project: platform/frameworks/support
Branch: androidx-main
Author: Doris Liu <
Link:
Require shared element to draw in place before drawing in overlay
Expand for full commit details
Require shared element to draw in place before drawing in overlay
This change fixes a rare issue where a shared element is composed
in both incoming and outgoing content, but measured and placed in
neither. The fix involves checking the shared element has been
drawn for at least frame before drawing it in the overlay. This
accounts for not only the requirement to measure and place shared
elements, but also ensured that when the draw is skipped by
a parent, shared element will not draw.
Fixes: 371802474
Test: New test added
Change-Id: I35108ce255cf4728a9ca3ef7834d6962abcc94c0
Files:
- M
compose/animation/animation/src/androidInstrumentedTest/kotlin/androidx/compose/animation/SharedTransitionTest.kt
- M
compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/SharedContentNode.kt
- M
compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/SharedElement.kt
Hash: baae6769d3323d141b17e0d916323cf6487034ea
Date: Wed Nov 13 15:27:39 2024
pr...@google.com <pr...@google.com> #16
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.animation:animation:1.8.0-alpha07
androidx.compose.animation:animation-android:1.8.0-alpha07
androidx.compose.animation:animation-jvmstubs:1.8.0-alpha07
androidx.compose.animation:animation-linuxx64stubs:1.8.0-alpha07
Description
Jetpack Compose component used: Modifier.sharedElement
Hey! We added a shared element transition to the app, using Compose 1.7.3. We are seeing this crash in firebase, however I could not reproduce the issue locally.
Our layout hierarchy looks like this:
NavHost -> ... -> AnimatedVisibility -> ... -> BoxWithConstraints -> First layout with sharedElement
\> ... -> AnimatedVisibility -> ... -> BoxWithConstraints -> Second layout with sharedElement
With "..." I replaced series of "normal" layouts.
The crash is due to this precondition failing:
It seems somehow one of the elements gets drawn without having had layout before.
Any idea if I am doing something wrong, or any workarounds? Thank you!!
Stack trace:
SharedElementInternalState.drawInOverlay
java.lang.IllegalArgumentException - Error: current bounds not set yet.
androidx.compose.animation.SharedElementInternalState.drawInOverlay (SharedElementInternalState.java:196)
androidx.compose.animation.SharedTransitionScopeImpl.drawInOverlay$animation_release (SharedTransitionScopeImpl.java:1086)
androidx.compose.animation.SharedTransitionScopeKt$SharedTransitionScope$1$2$1.invoke (SharedTransitionScope.kt:161)
androidx.compose.animation.SharedTransitionScopeKt$SharedTransitionScope$1$2$1.invoke (SharedTransitionScope.kt:159)
androidx.compose.ui.draw.DrawWithContentModifier.draw (DrawModifier.kt:422)
androidx.compose.ui.node.LayoutNodeDrawScope.drawDirect-eZhPAX0$ui_release (LayoutNodeDrawScope.kt:110)
androidx.compose.ui.node.LayoutNodeDrawScope.draw-eZhPAX0$ui_release (LayoutNodeDrawScope.kt:89)
androidx.compose.ui.node.NodeCoordinator.drawContainedDrawModifiers (NodeCoordinator.kt:450)
androidx.compose.ui.node.NodeCoordinator.draw (NodeCoordinator.kt:439)
androidx.compose.ui.node.LayoutModifierNodeCoordinator.performDraw (LayoutModifierNodeCoordinator.kt:280)
androidx.compose.ui.node.NodeCoordinator.drawContainedDrawModifiers (NodeCoordinator.kt:447)
androidx.compose.ui.node.NodeCoordinator.draw (NodeCoordinator.kt:439)
androidx.compose.ui.node.LayoutNode.draw$ui_release (LayoutNode.kt:1000)
androidx.compose.ui.node.InnerNodeCoordinator.performDraw (InnerNodeCoordinator.kt:196)
androidx.compose.ui.node.LayoutNodeDrawScope.drawContent (LayoutNodeDrawScope.kt:68)
androidx.compose.foundation.BackgroundNode.draw (Background.kt:163)
androidx.compose.ui.node.LayoutNodeDrawScope.drawDirect-eZhPAX0$ui_release (LayoutNodeDrawScope.kt:110)
androidx.compose.ui.node.LayoutNodeDrawScope.draw-eZhPAX0$ui_release (LayoutNodeDrawScope.kt:89)
androidx.compose.ui.node.NodeCoordinator.drawContainedDrawModifiers (NodeCoordinator.kt:450)
androidx.compose.ui.node.NodeCoordinator.access$drawContainedDrawModifiers (NodeCoordinator.kt:58)
androidx.compose.ui.node.NodeCoordinator$drawBlock$1$1.invoke (NodeCoordinator.java:469)
androidx.compose.ui.node.NodeCoordinator$drawBlock$1$1.invoke (NodeCoordinator.java:468)
androidx.compose.runtime.snapshots.Snapshot$Companion.observe (Snapshot.java:2441)
androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe (SnapshotStateObserver.kt:502)
androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads (SnapshotStateObserver.kt:258)
androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release (OwnerSnapshotObserver.kt:133)
androidx.compose.ui.node.NodeCoordinator$drawBlock$1.invoke (NodeCoordinator.java:468)
androidx.compose.ui.node.NodeCoordinator$drawBlock$1.invoke (NodeCoordinator.java:466)
androidx.compose.ui.platform.GraphicsLayerOwnerLayer$recordLambda$1.invoke (GraphicsLayerOwnerLayer.java:291)
androidx.compose.ui.platform.GraphicsLayerOwnerLayer$recordLambda$1.invoke (GraphicsLayerOwnerLayer.java:289)
androidx.compose.ui.graphics.layer.GraphicsLayerV29.record (GraphicsLayerV29.android.kt:245)
androidx.compose.ui.graphics.layer.GraphicsLayer.recordInternal (AndroidGraphicsLayer.android.kt:430)
androidx.compose.ui.graphics.layer.GraphicsLayer.record-mL-hObY (AndroidGraphicsLayer.android.kt:423)
androidx.compose.ui.platform.GraphicsLayerOwnerLayer.updateDisplayList (GraphicsLayerOwnerLayer.android.kt:284)
androidx.compose.ui.platform.GraphicsLayerOwnerLayer.drawLayer (GraphicsLayerOwnerLayer.android.kt:229)
androidx.compose.ui.node.NodeCoordinator.draw (NodeCoordinator.kt:434)
androidx.compose.ui.node.LayoutNode.draw$ui_release (LayoutNode.kt:1000)
androidx.compose.ui.node.InnerNodeCoordinator.performDraw (InnerNodeCoordinator.kt:196)
androidx.compose.ui.node.NodeCoordinator.drawContainedDrawModifiers (NodeCoordinator.kt:447)
androidx.compose.ui.node.NodeCoordinator.draw (NodeCoordinator.kt:439)
androidx.compose.ui.node.LayoutNode.draw$ui_release (LayoutNode.kt:1000)
androidx.compose.ui.platform.AndroidComposeView.dispatchDraw (AndroidComposeView.android.kt:1564)
android.view.View.draw (View.java:25180)
android.view.View.updateDisplayListIfDirty (View.java:24036)
android.view.ViewGroup.recreateChildDisplayList (ViewGroup.java:4764)
...