Fixed
Status Update
Comments
kl...@google.com <kl...@google.com>
kl...@google.com <kl...@google.com>
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 1f6ac9030f4c1f7f7db494e7dbaf9a06a70721fa
Author: Zach Klippenstein <klippenstein@google.com>
Date: Fri Nov 17 10:48:03 2023
Allocate only a single instance for text-related composition locals.
Since these composition locals are static, when their values change it
forces the entire tree to recompose. Fixes that issue by just storing
the values inside the Owner implementations so they're always the same
instance for a given owner.
Fixes: b/310510985
Relnote: "Fixed extra downstream recompositions caused by
`LocalSoftwareKeyboardController` and `LocalTextInputService` being
provided new values every time a root recomposed."
Test: just moved the storage around, no behavior or API changes.
Change-Id: I421902984824a99a7d753bc3e515d8bbfd142032
M compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/input/pointer/HitPathTrackerTest.kt
M compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/input/pointer/PointerInputEventProcessorTest.kt
M compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/layout/Helpers.kt
M compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/node/NodeChainTester.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeView.android.kt
M compose/ui/ui/src/androidUnitTest/kotlin/androidx/compose/ui/node/LayoutNodeTest.kt
M compose/ui/ui/src/androidUnitTest/kotlin/androidx/compose/ui/node/ModifierLocalConsumerEntityTest.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/Owner.kt
M compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/SkiaBasedOwner.skiko.kt
https://android-review.googlesource.com/2836922
Branch: androidx-main
commit 1f6ac9030f4c1f7f7db494e7dbaf9a06a70721fa
Author: Zach Klippenstein <klippenstein@google.com>
Date: Fri Nov 17 10:48:03 2023
Allocate only a single instance for text-related composition locals.
Since these composition locals are static, when their values change it
forces the entire tree to recompose. Fixes that issue by just storing
the values inside the Owner implementations so they're always the same
instance for a given owner.
Fixes:
Relnote: "Fixed extra downstream recompositions caused by
`LocalSoftwareKeyboardController` and `LocalTextInputService` being
provided new values every time a root recomposed."
Test: just moved the storage around, no behavior or API changes.
Change-Id: I421902984824a99a7d753bc3e515d8bbfd142032
M compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/input/pointer/HitPathTrackerTest.kt
M compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/input/pointer/PointerInputEventProcessorTest.kt
M compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/layout/Helpers.kt
M compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/node/NodeChainTester.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeView.android.kt
M compose/ui/ui/src/androidUnitTest/kotlin/androidx/compose/ui/node/LayoutNodeTest.kt
M compose/ui/ui/src/androidUnitTest/kotlin/androidx/compose/ui/node/ModifierLocalConsumerEntityTest.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/Owner.kt
M compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/SkiaBasedOwner.skiko.kt
na...@google.com <na...@google.com> #3
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.ui:ui:1.6.0-beta03
androidx.compose.ui:ui-android:1.6.0-beta03
androidx.compose.ui:ui-desktop:1.6.0-beta03
Description
LocalSoftwareKeyboardController
,LocalTextInputService
ProvideCommonCompositionLocals
providesLocalSoftwareKeyboardController
andLocalTextInputService
, which are static composition locals. New classes are instantiated every time, which leads to recomposing the entire tree. (ProvideCommonCompositionLocals
gets called when changing language, for example.)Is this desired behavior for some reason, or could we either
LocalSoftwareKeyboardController
andLocalTextInputService
usecompositionLocalOf
instead?textInputService
andsoftwareKeyboardController
to always use the same value if new class instances are not needed?The instantiation of new classes are somewhat hidden in property getter functions here: