Disable IME connection for flaky text field screenshot

Bug: b/352910162
Test: updating
Change-Id: I8000655c305a1f7402c09a4d76667539e80f9619
diff --git a/compose/material/material/src/androidInstrumentedTest/kotlin/androidx/compose/material/textfield/OutlinedTextFieldScreenshotTest.kt b/compose/material/material/src/androidInstrumentedTest/kotlin/androidx/compose/material/textfield/OutlinedTextFieldScreenshotTest.kt
index 9ffe003..17b1500 100644
--- a/compose/material/material/src/androidInstrumentedTest/kotlin/androidx/compose/material/textfield/OutlinedTextFieldScreenshotTest.kt
+++ b/compose/material/material/src/androidInstrumentedTest/kotlin/androidx/compose/material/textfield/OutlinedTextFieldScreenshotTest.kt
@@ -40,9 +40,12 @@
 import androidx.compose.runtime.mutableStateOf
 import androidx.compose.runtime.remember
 import androidx.compose.testutils.assertAgainstGolden
+import androidx.compose.ui.ExperimentalComposeUiApi
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.platform.InterceptPlatformTextInput
 import androidx.compose.ui.platform.LocalLayoutDirection
+import androidx.compose.ui.platform.PlatformTextInputInterceptor
 import androidx.compose.ui.platform.testTag
 import androidx.compose.ui.test.SemanticsNodeInteraction
 import androidx.compose.ui.test.captureToImage
@@ -58,6 +61,7 @@
 import androidx.test.filters.LargeTest
 import androidx.test.filters.SdkSuppress
 import androidx.test.screenshot.AndroidXScreenshotTestRule
+import kotlinx.coroutines.awaitCancellation
 import org.junit.Rule
 import org.junit.Test
 import org.junit.runner.RunWith
@@ -138,18 +142,24 @@
         assertAgainstGolden("outlined_textField_focused_rtl")
     }
 
+    @OptIn(ExperimentalComposeUiApi::class)
     @Test
     fun outlinedTextField_error_focused() {
+        // No-op interceptor to prevent interference from actual IME
+        val inputInterceptor = PlatformTextInputInterceptor { _, _ -> awaitCancellation() }
+
         // stop animation of blinking cursor
         rule.mainClock.autoAdvance = false
         rule.setMaterialContent {
             val text = "Input"
-            OutlinedTextField(
-                state = rememberTextFieldState(text, TextRange(text.length)),
-                label = { Text("Label") },
-                isError = true,
-                modifier = Modifier.testTag(TextFieldTag).requiredWidth(280.dp)
-            )
+            InterceptPlatformTextInput(inputInterceptor) {
+                OutlinedTextField(
+                    state = rememberTextFieldState(text, TextRange(text.length)),
+                    label = { Text("Label") },
+                    isError = true,
+                    modifier = Modifier.testTag(TextFieldTag).requiredWidth(280.dp)
+                )
+            }
         }
 
         rule.onNodeWithTag(TextFieldTag).focus()