Repository: flutter
Issue: Textfield obscureText interaction exception
Labels: a: text input,e: device-specific,platform-android,f: material design,e: OS-version specific,P3,team-android,triaged-android

### Steps to reproduce

1. First click on a textfield whose obscureText is false(true)
2. Click again on a textfield whose obscureText is true (false)

### Expected results

The keyboard should not disappear and reappear. It should directly determine the keyboard type and focus on the new textfield.

### Actual results

The keyboard animation pops up and disappears abnormally. The cursor disappears and needs to be clicked again to focus.
 
Upgrading from 3.10.0 to 3.16.0 appears, in HarmonyOS 4,

### Code sample

<details open><summary>Code sample</summary>

```dart
class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: const Text('Demo'),
      ),
      body: const Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            TextField(
                key: Key('a'),
                keyboardType: TextInputType.numberWithOptions(signed: true),
                decoration: InputDecoration(hintText: ' a obscureText false')),
            TextField(
                key: Key('c'),
                keyboardType: TextInputType.text,
                obscureText: true,
                decoration: InputDecoration(hintText: ' c obscureText true')),
          ],
        ),
      ),
    );
  }
}
```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

[Upload media here]

</details>


### Logs

<details open><summary>Logs</summary>

```console
D/HwDragEnhancementImpl( 6838): handleTimerDrag: false
D/HwDragEnhancementImpl( 6838): handleTimerDrag: false
D/HwDragEnhancementImpl( 6838): Start long press for hw drag enhancement.
D/WebViewDragEnhancement( 6838): dragReset.
D/WebViewDragEnhancement( 6838): dragReset cacheSize = 0
I/InputMethodManager( 6838): Starting input: reason=APP_CALLED_RESTART_INPUT_API
W/HwRemoteInputMethodManager( 6838): isCasting false because IHwDistributedWindowManager is invalid.
I/InputMethodManager( 6838): Starting input: Bind resultString=SUCCESS_WITH_IME_SESSION
I/InputMethodManager( 6838): showSoftInput, displayId=-1,callers=android.view.inputmethod.InputMethodManager.showSoftInput:1785 android.view.inputmethod.InputMethodManager.showSoftInput:1723 io.flutter.plugin.editing.TextInputPlugin.showTextInput:401 io.flutter.plugin.editing.TextInputPlugin$2.show:102 
D/InputMethodManager( 6838): showSoftInput() view=io.flutter.embedding.android.FlutterView{fcfca67 VFE...... .F...... 0,0-1080,2340 #1 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
I/InsetsController( 6838): ViewUI_insets applyAnimation types:8,show:false, this:android.view.InsetsController@1dce6b2
I/InsetsController( 6838): ViewUI_insets controlAnimation types: 8
D/InsetsController( 6838): ViewUI_insets controlAnimation after canel existing types: 8
I/AssistStructure( 6838): Flattened final assist data: 480 bytes, containing 1 windows, 3 views
D/SceneHelper( 6838): notifyState ltpo1.0 push currentPackageName=com.example.flutter_demo ltpo10SceneState=3009 scene=IME
I/HwViewRootImpl( 6838): Add sceneId 96 topId: 10
I/InsetsController( 6838): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_STATUS_BAR, mFrame=[0,0][1080,114], mVisible=true}
I/InsetsController( 6838): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_NAVIGATION_BAR, mFrame=[0,0][0,0], mVisible=false}
D/InsetsSourceConsumer( 6838): ViewUI_insets setControl -> ITYPE_IME on com.example.flutter_demo/com.example.flutter_demo.MainActivity
I/InsetsAnimationCtrlImpl( 6838): Ime in switching, skipping updateSurfacePosition.
I/InsetsController( 6838): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_STATUS_BAR, mFrame=[0,0][1080,114], mVisible=true}
I/InsetsController( 6838): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_NAVIGATION_BAR, mFrame=[0,0][0,0], mVisible=false}
I/InsetsController( 6838): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_STATUS_BAR, mFrame=[0,0][1080,114], mVisible=true}
I/InsetsController( 6838): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_NAVIGATION_BAR, mFrame=[0,0][0,0], mVisible=false}
D/InsetsSourceConsumer( 6838): ViewUI_insets setControl -> ITYPE_IME on com.example.flutter_demo/com.example.flutter_demo.MainActivity
I/InsetsAnimationCtrlImpl( 6838): Ime in switching, skipping updateSurfacePosition.
D/InsetsController( 6838): ViewUI_insets show(ime(), fromIme=true)
I/InsetsController( 6838): ViewUI_insets applyAnimation types:8,show:true, this:android.view.InsetsController@1dce6b2
I/InsetsController( 6838): ViewUI_insets controlAnimation types: 8
D/SceneHelper( 6838): notifyState ltpo1.0 push currentPackageName=com.example.flutter_demo ltpo10SceneState=3010 scene=IME
I/HwViewRootImpl( 6838): remove sceneId 96 topId: 10
D/InsetsController( 6838): ViewUI_insets controlAnimation after canel existing types: 8
D/SceneHelper( 6838): notifyState ltpo1.0 push currentPackageName=com.example.flutter_demo ltpo10SceneState=3009 scene=IME
I/HwViewRootImpl( 6838): Add sceneId 96 topId: 10
I/InsetsController( 6838): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_STATUS_BAR, mFrame=[0,0][1080,114], mVisible=true}
I/InsetsController( 6838): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_NAVIGATION_BAR, mFrame=[0,0][0,0], mVisible=false}
D/SceneHelper( 6838): notifyState ltpo1.0 push currentPackageName=com.example.flutter_demo ltpo10SceneState=3010 scene=IME
I/HwViewRootImpl( 6838): remove sceneId 96 topId: 10
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[!] Flutter (Channel stable, 3.16.0, on macOS 13.5.1 22G90 darwin-arm64, locale zh-Hans-CN)
    • Flutter version 3.16.0 on channel stable at /Users/Baibinbu/fvm/versions/3.16.0
    ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/2.18.1/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/Baibinbu/fvm/versions/3.16.0. Consider adding /Users/Baibinbu/fvm/versions/3.16.0/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision db7ef5bf9f (5 weeks ago), 2023-11-15 11:25:44 -0800
    • Engine revision 74d16627b9
    • Dart version 3.2.0
    • DevTools version 2.28.2
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    • Android SDK at /Users/Baibinbu/Library/Android/sdk
    • Platform android-33, build-tools 33.0.2
    • ANDROID_HOME = /Users/Baibinbu/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A507
    • CocoaPods version 1.14.3
```

</details>