Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
Author: Nader Jawad <
Link:
Update Color callsites to accept color longs
Expand for full commit details
Update Color callsites to accept color longs
Relnote: "Update Compose support for wide gamut and HDR
colors when running on Android Q+"
Updated AndroidPaint and Shader implementations to
consume Color longs directly instead of converting to
color Ints via toArgb
Fixes: 379135036
Test: Added test to verify ColorLongs in Paint and ShaderTest
Change-Id: Icd8bea0a02aeea8ac8a06cda9684eed39dc4b990
Files:
- M
compose/ui/ui-graphics/src/androidInstrumentedTest/kotlin/androidx/compose/ui/graphics/PaintTest.kt
- M
compose/ui/ui-graphics/src/androidInstrumentedTest/kotlin/androidx/compose/ui/graphics/ShaderTest.kt
- M
compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidPaint.android.kt
- M
compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidShader.android.kt
Hash: dd374f50cccbde2dce64658f9fd5ba0f65e46df5
Date: Wed Nov 20 18:01:00 2024
pr...@google.com <pr...@google.com> #3
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.ui:ui-graphics:1.8.0-alpha07
androidx.compose.ui:ui-graphics-android:1.8.0-alpha07
androidx.compose.ui:ui-graphics-jvmstubs:1.8.0-alpha07
androidx.compose.ui:ui-graphics-linuxx64stubs:1.8.0-alpha07
to...@gmail.com <to...@gmail.com> #4
Hi,
This cause a crash on some devices in older Android versions like Xiaomi Redmi on Android 10/11 at least
Fatal Exception: java.lang.IllegalArgumentException: Invalid ID, must be in the range [0..16)
at android.graphics.ColorSpace.get(ColorSpace.java:1390)
at android.graphics.Color.colorSpace(Color.java:704)
at android.graphics.Paint.setColor(Paint.java:1086)
at androidx.compose.ui.graphics.WrapperVerificationHelperMethods.setColor-4WTKRHQ(AndroidPaint.android.kt:281)
at androidx.compose.ui.graphics.AndroidPaint_androidKt.setNativeColor-4WTKRHQ(AndroidPaint.android.kt:171)
at androidx.compose.ui.graphics.AndroidPaint.setColor-8_81llA(AndroidPaint.android.kt:63)
at androidx.compose.ui.graphics.drawscope.CanvasDrawScope.configurePaint-2qPWKa0(CanvasDrawScope.kt:632)
at androidx.compose.ui.graphics.drawscope.CanvasDrawScope.configurePaint-2qPWKa0$default(CanvasDrawScope.kt:620)
at androidx.compose.ui.graphics.drawscope.CanvasDrawScope.drawRect-n-J9OG0(CanvasDrawScope.kt:199)
at androidx.compose.ui.node.LayoutNodeDrawScope.drawRect-n-J9OG0(LayoutNodeDrawScope.kt)
at androidx.compose.ui.graphics.drawscope.DrawScope.drawRect-n-J9OG0$default(DrawScope.kt:454)
at androidx.compose.foundation.BackgroundNode.drawRect(Background.kt:171)
at androidx.compose.foundation.BackgroundNode.draw(Background.kt:152)
at androidx.compose.ui.node.LayoutNodeDrawScope.drawDirect-eZhPAX0$ui_release(LayoutNodeDrawScope.kt:96)
at androidx.compose.ui.node.LayoutNodeDrawScope.draw-eZhPAX0$ui_release(LayoutNodeDrawScope.kt:83)
at androidx.compose.ui.node.NodeCoordinator.drawContainedDrawModifiers(NodeCoordinator.kt:445)
at androidx.compose.ui.node.NodeCoordinator.draw(NodeCoordinator.kt:434)
at androidx.compose.ui.node.LayoutModifierNodeCoordinator.performDraw(LayoutModifierNodeCoordinator.kt:271)
at androidx.compose.ui.node.NodeCoordinator.drawContainedDrawModifiers(NodeCoordinator.kt:442)
at androidx.compose.ui.node.NodeCoordinator.draw(NodeCoordinator.kt:434)
at androidx.compose.ui.node.LayoutNode.draw$ui_release(LayoutNode.kt:940)
at androidx.compose.ui.node.InnerNodeCoordinator.performDraw(InnerNodeCoordinator.kt:177)
at androidx.compose.ui.node.NodeCoordinator.drawContainedDrawModifiers(NodeCoordinator.kt:442)
at androidx.compose.ui.node.NodeCoordinator.access$drawContainedDrawModifiers(NodeCoordinator.kt:63)
at androidx.compose.ui.node.NodeCoordinator$drawBlock$drawBlockCallToDrawModifiers$1.invoke(NodeCoordinator.kt:468)
at androidx.compose.ui.node.NodeCoordinator$drawBlock$drawBlockCallToDrawModifiers$1.invoke(NodeCoordinator.kt:467)
at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2489)
at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(SnapshotStateObserver.kt:460)
at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:244)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(OwnerSnapshotObserver.kt:124)
at androidx.compose.ui.node.NodeCoordinator$drawBlock$1.invoke(NodeCoordinator.kt:474)
at androidx.compose.ui.node.NodeCoordinator$drawBlock$1.invoke(NodeCoordinator.kt:470)
at androidx.compose.ui.platform.GraphicsLayerOwnerLayer$recordLambda$1.invoke(GraphicsLayerOwnerLayer.android.kt:261)
at androidx.compose.ui.platform.GraphicsLayerOwnerLayer$recordLambda$1.invoke(GraphicsLayerOwnerLayer.android.kt:259)
at androidx.compose.ui.graphics.layer.GraphicsLayer$clipDrawBlock$1.invoke(AndroidGraphicsLayer.android.kt:72)
at androidx.compose.ui.graphics.layer.GraphicsLayer$clipDrawBlock$1.invoke(AndroidGraphicsLayer.android.kt:67)
at androidx.compose.ui.graphics.layer.GraphicsLayerV29.record(GraphicsLayerV29.android.kt:251)
at androidx.compose.ui.graphics.layer.GraphicsLayer.recordInternal(AndroidGraphicsLayer.android.kt:438)
at androidx.compose.ui.graphics.layer.GraphicsLayer.record-mL-hObY(AndroidGraphicsLayer.android.kt:431)
at androidx.compose.ui.platform.GraphicsLayerOwnerLayer.updateDisplayList(GraphicsLayerOwnerLayer.android.kt:254)
at androidx.compose.ui.platform.AndroidComposeView.dispatchDraw(AndroidComposeView.android.kt:1697)
at android.view.View.draw(View.java:22670)
at android.view.View.updateDisplayListIfDirty(View.java:21491)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4579)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4552)
at android.view.View.updateDisplayListIfDirty(View.java:21441)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4579)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4552)
at android.view.View.updateDisplayListIfDirty(View.java:21441)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4579)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4552)
at android.view.View.updateDisplayListIfDirty(View.java:21441)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4579)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4552)
at android.view.View.updateDisplayListIfDirty(View.java:21441)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:559)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:565)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:642)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:4363)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:4073)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3331)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2131)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8605)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:976)
at android.view.Choreographer.doCallbacks(Choreographer.java:799)
at android.view.Choreographer.doFrame(Choreographer.java:734)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:961)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:236)
at android.app.ActivityThread.main(ActivityThread.java:8031)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:620)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1011)
Maybe there should be a brand test for this well know bug on some brands or only use that on 12+ ?
Description
Currently consumption of Color instances converts the color long to an int via the
toArgb
APIInstead on supported Android platform levels, we should consume the Color long directly with the following: