diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-04-10 18:53:54 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-04-10 18:53:54 +0000 |
commit | a886cfe86852600d131eb7fa1ec8b7d0a8fc1e6b (patch) | |
tree | 7273dfe4d39b1ecb834cda06c36fd86dc2e3255a | |
parent | 917ada96acf0ac343128c3f4af9bd67a4b80b99c (diff) | |
parent | 4ee0ae7442d49d4d54b3e77d4131050384f2b5d2 (diff) | |
download | support-a886cfe86852600d131eb7fa1ec8b7d0a8fc1e6b.tar.gz |
Merge "Merge cherrypicks of ['android-review.googlesource.com/3035134', 'android-review.googlesource.com/3034218', 'android-review.googlesource.com/3032825'] into androidx-compose-release." into androidx-compose-release
6 files changed, 43 insertions, 6 deletions
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/VersionChecker.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/VersionChecker.kt index 0ede3d01930..79d9671bab2 100644 --- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/VersionChecker.kt +++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/VersionChecker.kt @@ -138,6 +138,7 @@ class VersionChecker(val context: IrPluginContext) { 12014 to "1.6.3", 12015 to "1.6.4", 12016 to "1.6.5", + 12017 to "1.6.6", ) /** diff --git a/compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/textfield/TextFieldTest.kt b/compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/textfield/TextFieldTest.kt index 2b2514de5e9..262a6e00d35 100644 --- a/compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/textfield/TextFieldTest.kt +++ b/compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/textfield/TextFieldTest.kt @@ -1690,6 +1690,40 @@ class TextFieldTest : FocusedWindowTest { assertThat(value.text).isEqualTo(tfvAfterBackspace.text) assertThat(value.selection).isEqualTo(tfvAfterBackspace.selection) } + + // Regression test for b/322835187 + @Test + fun whenToggleReadOnly_onTypedTextField_noChangeNorCrash() { + val tag = "tag" + + var value by mutableStateOf(TextFieldValue()) + var readOnly by mutableStateOf(false) + rule.setTextFieldTestContent { + BasicTextField( + value = value, + onValueChange = { value = it }, + readOnly = readOnly, + modifier = Modifier.testTag(tag), + ) + } + rule.onNodeWithTag(tag) + .requestFocus() + .performTextInput("Hello") + + rule.runOnIdle { + assertThat(value.text).isEqualTo("Hello") + assertThat(value.selection).isEqualTo(TextRange(5)) + } + + rule.runOnUiThread { readOnly = true } + rule.waitForIdle() + rule.runOnUiThread { readOnly = false } + + rule.runOnIdle { + assertThat(value.text).isEqualTo("Hello") + assertThat(value.selection).isEqualTo(TextRange(5)) + } + } } private fun SemanticsNodeInteraction.assertEditableTextEquals( diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/CoreTextField.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/CoreTextField.kt index 0c4fb97b21d..7c98df81606 100644 --- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/CoreTextField.kt +++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/CoreTextField.kt @@ -354,7 +354,7 @@ internal fun CoreTextField( state, manager.value, imeOptions, - offsetMapping + manager.offsetMapping ) } else { endInputSession(state) diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ComposeVersion.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ComposeVersion.kt index ecdc29f1ca2..0eb881af294 100644 --- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ComposeVersion.kt +++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ComposeVersion.kt @@ -28,5 +28,5 @@ internal object ComposeVersion { * IMPORTANT: Whenever updating this value, please make sure to also update `versionTable` and * `minimumRuntimeVersionInt` in `VersionChecker.kt` of the compiler. */ - const val version: Int = 12016 + const val version: Int = 12017 } diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/CursorAnchorInfoController.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/CursorAnchorInfoController.android.kt index 808bcc45d4d..316ed40db21 100644 --- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/CursorAnchorInfoController.android.kt +++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/CursorAnchorInfoController.android.kt @@ -27,6 +27,8 @@ internal class CursorAnchorInfoController( private val rootPositionCalculator: PositionCalculator, private val inputMethodManager: InputMethodManager ) { + private val lock = Any() + private var monitorEnabled = false private var hasPendingImmediateRequest = false @@ -70,7 +72,7 @@ internal class CursorAnchorInfoController( includeCharacterBounds: Boolean, includeEditorBounds: Boolean, includeLineBounds: Boolean - ) { + ) = synchronized(lock) { this.includeInsertionMarker = includeInsertionMarker this.includeCharacterBounds = includeCharacterBounds this.includeEditorBounds = includeEditorBounds @@ -105,7 +107,7 @@ internal class CursorAnchorInfoController( textFieldToRootTransform: (Matrix) -> Unit, innerTextFieldBounds: Rect, decorationBoxBounds: Rect - ) { + ) = synchronized(lock) { this.textFieldValue = textFieldValue this.offsetMapping = offsetMapping this.textLayoutResult = textLayoutResult @@ -125,7 +127,7 @@ internal class CursorAnchorInfoController( * position data is no longer valid. [CursorAnchorInfo] updates will not be sent until new * layout and position data is received. */ - fun invalidate() { + fun invalidate() = synchronized(lock) { textFieldValue = null offsetMapping = null textLayoutResult = null diff --git a/libraryversions.toml b/libraryversions.toml index 272ac61906d..c4a389e706f 100644 --- a/libraryversions.toml +++ b/libraryversions.toml @@ -20,7 +20,7 @@ CAMERA_TESTING = "1.0.0-alpha01" CARDVIEW = "1.1.0-alpha01" CAR_APP = "1.7.0-alpha01" COLLECTION = "1.4.0" -COMPOSE = "1.6.5" +COMPOSE = "1.6.6" COMPOSE_COMPILER = "1.5.4" COMPOSE_MATERIAL3 = "1.2.0-alpha11" COMPOSE_MATERIAL3_ADAPTIVE = "1.0.0-alpha01" |