Status Update
Comments
se...@google.com <se...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
Author: Louis Pullen-Freilich <
Link:
Fixes NPE when recording drawContent to a GraphicsLayer
Expand for full commit details
Fixes NPE when recording drawContent to a GraphicsLayer
In some cases (for example when software rendering the graphics layer is required on API levels where the graphics layer implementation doesn't support software rendering) drawing a graphics layer requires drawing the drawBlock passed to record, outside of the draw pass. Since we use a shared draw scope for all draw modifier nodes, this means that we capture a reference to the scope but we don't have the node information anymore to be able to draw it. This CL fixes this issue by making sure that our ContentDrawScope implementation properly restores the node state when drawing a previously recorded drawBlock.
To avoid this issue it is important to use the record function inside DrawScope for this specific use case, and avoid capturing the draw scope in a lambda otherwise.
This CL also updates the CacheDrawScope to use the record function provided by the DrawScope to avoid this issue from occuring inside cache drawing nodes.
Test: DrawModifierTest
Fixes: b/389046242
Relnote: "Fixed an occasional NPE when using `GraphicsLayer.record { this@ContentDrawScope.drawContent() }`. If you are recording drawContent() in this way, make sure to use the GraphicsLayer#record extension function inside DrawScope, and not the member function on GraphicsLayer."
Change-Id: I75fc026069666b61cdd7e5c377fa4da706f985d8
Files:
- M
compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/draw/DrawModifierTest.kt
- M
compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/draw/DrawModifier.kt
- M
compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutNodeDrawScope.kt
Hash: 8025e8c6128dd3cf148684111953fbac71b55ac2
Date: Fri Jan 10 16:53:20 2025
po...@gmail.com <po...@gmail.com> #3
Project: platform/frameworks/support
Branch: androidx-main
Author: Louis Pullen-Freilich <
Link:
Revert^2 "Fixes issue with dragAndDropSource preventing child invalidations"
Expand for full commit details
Revert^2 "Fixes issue with dragAndDropSource preventing child invalidations"
This reverts commit 3d5fd7d04bdd7f02ee2b215af68b2832e06134bf.
Reason for revert: Underlying bug b/389046242 is now resolved
Fixes: b/379682458
Test: DragAndDropSourceTest
Test: AndroidDragAndDropIntegrationTest
Change-Id: I07cb2a4091b46d862628bf17625ae9d9eb087641
Files:
- A
compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/draganddrop/DragAndDropSourceTest.kt
- M
compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/draganddrop/AndroidDragAndDropSource.android.kt
Hash: 3c48a0fbd3c2902a6a7acb6c8b474a4928b1be41
Date: Mon Jan 13 09:46:38 2025
se...@google.com <se...@google.com> #4
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.foundation:foundation:1.8.0-beta01
androidx.compose.foundation:foundation-android:1.8.0-beta01
androidx.compose.foundation:foundation-jvmstubs:1.8.0-beta01
androidx.compose.foundation:foundation-linuxx64stubs:1.8.0-beta01
androidx.compose.ui:ui-android:1.8.0-beta01
androidx.compose.ui:ui-jvmstubs:1.8.0-beta01
androidx.compose.ui:ui-linuxx64stubs:1.8.0-beta01
se...@google.com <se...@google.com> #5
This is the minimal TextStyle to repro
se...@google.com <se...@google.com> #6
TextStyle(
textAlign = TextAlign.Center,
letterSpacing = 1.sp,
lineHeight = 24.sp,
lineHeightStyle = LineHeightStyle(
alignment = LineHeightStyle.Alignment.Center,
trim = LineHeightStyle.Trim.None,
mode = LineHeightStyle.Mode.Fixed
),
)
se...@google.com <se...@google.com> #7
Fix coming. Will see if I can get it into 1.8-beta01.
po...@gmail.com <po...@gmail.com> #8
Amazing! That was super quick)
se...@google.com <se...@google.com> #9
Excellent bug report and I had some idle cycles this week :)
Description
Jetpack Compose version: 1.7.6
Jetpack Compose component used:
Android Studio Build: Ladybug Feature Drop 2024.2.2
Kotlin version: 2.1.0
Devices/Android versions reproduced on: Phone Emulator (API 34)
Keyboard (i.e. Gboard, Samsung, etc): AOSP Keyboard
If you have Material text
inside the layout with
Modifier.imePadding()
applied to it, and trigger the appearance of the soft keyboard, then text starts to move to the right of the screen.This bug is very similar to this one and is probably related to this code (it was introduced here ).
Screenshots and video attached.