Repository: flutter
Issue: [Android 12][Keyboard] Display ID mismatch found.
Labels: a: text input,platform-android,engine,a: platform-views,e: OS-version specific,has reproducible steps,P2,platform-views: vd,found in release: 2.2,found in release: 2.6,team-android,triaged-android

Using Android 12 (API 31) with webview plugins such as [webview_flutter](https://pub.dev/packages/webview_flutter) or [flutter_inappwebview](https://pub.dev/packages/flutter_inappwebview) fail to show the keyboard with this exception:

```
[   +1 ms] V/InputMethodManager(10400): b/117267690: Display ID mismatch found. ViewRootImpl displayId=20 InputMethodManager displayId=0. Use the right InputMethodManager instance to avoid performance overhead.
[        ] V/InputMethodManager(10400): java.lang.Throwable
[        ] V/InputMethodManager(10400): 	at android.view.inputmethod.InputMethodManager.getFallbackInputMethodManagerIfNecessary(InputMethodManager.java:549)
[        ] V/InputMethodManager(10400): 	at android.view.inputmethod.InputMethodManager.restartInput(InputMethodManager.java:1843)
[        ] V/InputMethodManager(10400): 	at org.chromium.content.browser.input.ImeAdapterImpl.H(chromium-TrichromeWebViewGoogle6432.apk-stable-447211487:4)
[        ] V/InputMethodManager(10400): 	at org.chromium.content.browser.input.ImeAdapterImpl.updateState(chromium-TrichromeWebViewGoogle6432.apk-stable-447211487:30)
[        ] V/InputMethodManager(10400): 	at android.os.MessageQueue.nativePollOnce(Native Method)
[        ] V/InputMethodManager(10400): 	at android.os.MessageQueue.next(MessageQueue.java:335)
[        ] V/InputMethodManager(10400): 	at android.os.Looper.loopOnce(Looper.java:161)
[        ] V/InputMethodManager(10400): 	at android.os.Looper.loop(Looper.java:288)
[        ] V/InputMethodManager(10400): 	at android.app.ActivityThread.main(ActivityThread.java:7842)
[        ] V/InputMethodManager(10400): 	at java.lang.reflect.Method.invoke(Native Method)
[        ] V/InputMethodManager(10400): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
[        ] V/InputMethodManager(10400): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
[        ] V/InputMethodManager(10400): b/117267690: Display ID mismatch found. ViewRootImpl displayId=20 InputMethodManager displayId=0. Use the right InputMethodManager instance to avoid performance overhead.
[        ] V/InputMethodManager(10400): java.lang.Throwable
[        ] V/InputMethodManager(10400): 	at android.view.inputmethod.InputMethodManager.getFallbackInputMethodManagerIfNecessary(InputMethodManager.java:549)
[        ] V/InputMethodManager(10400): 	at android.view.inputmethod.InputMethodManager.showSoftInput(InputMethodManager.java:1625)
[        ] V/InputMethodManager(10400): 	at android.view.inputmethod.InputMethodManager.showSoftInput(InputMethodManager.java:1617)
[        ] V/InputMethodManager(10400): 	at sH.d(chromium-TrichromeWebViewGoogle6432.apk-stable-447211487:3)
[        ] V/InputMethodManager(10400): 	at org.chromium.content.browser.input.ImeAdapterImpl.L(chromium-TrichromeWebViewGoogle6432.apk-stable-447211487:20)
[        ] V/InputMethodManager(10400): 	at org.chromium.content.browser.input.ImeAdapterImpl.updateState(chromium-TrichromeWebViewGoogle6432.apk-stable-447211487:32)
[        ] V/InputMethodManager(10400): 	at android.os.MessageQueue.nativePollOnce(Native Method)
[        ] V/InputMethodManager(10400): 	at android.os.MessageQueue.next(MessageQueue.java:335)
[        ] V/InputMethodManager(10400): 	at android.os.Looper.loopOnce(Looper.java:161)
[        ] V/InputMethodManager(10400): 	at android.os.Looper.loop(Looper.java:288)
[        ] V/InputMethodManager(10400): 	at android.app.ActivityThread.main(ActivityThread.java:7842)
[        ] V/InputMethodManager(10400): 	at java.lang.reflect.Method.invoke(Native Method)
[        ] V/InputMethodManager(10400): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
[        ] V/InputMethodManager(10400): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
[        ] W/InputMethodManager(10400): Ignoring showSoftInput() as view=com.pichillilorenzo.flutter_inappwebview.in_app_webview.InAppWebView{c5bb4f2 VFEDHVCL. .F...... 0,0-1080,1911} is not served.
```

Steps to reproduce:
1. Create a new flutter app.
2. Add plugins to the **pubspec.yaml** file: **webview_flutter: ^2.0.13** or **flutter_inappwebview: ^5.3.2**
3. Add the webview to the widget tree:
```
InAppWebView(
        key: webViewKey,
        initialUrlRequest:
            URLRequest(url: Uri.parse("https://google.com")),
        onConsoleMessage: (controller, consoleMessage) {
          print(consoleMessage);
        },
      ),
```
or
```
WebView(
        initialUrl: 'https://google.com'
      ),
```
4. Build and launch the app.
5. Tap the google's search bar and you will see the exception in logs.

Flutter doctor:
```
[✓] Flutter (Channel stable, 2.2.2, on Linux, locale en_US.UTF-8)
    • Flutter version 2.2.2 at /home/holland/tools/flutter
    • Framework revision d79295af24 (3 months ago), 2021-06-11 08:56:01 -0700
    • Engine revision 91c9fc8fe0
    • Dart version 2.13.3

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /home/holland/Android/Sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at:
      /home/holland/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7
      351085/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+0-b944-P17168821)
    • All Android licenses accepted.

[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Android Studio (version 4.2)
    • Android Studio at /home/holland/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7351085
    • Flutter plugin version 60.1.1
    • Dart plugin version 202.8531
    • Java version OpenJDK Runtime Environment (build 11.0.8+0-b944-P17168821)

[✓] IntelliJ IDEA Ultimate Edition (version 2021.1)
    • IntelliJ at /home/holland/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/211.7442.40
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin version 211.7727

[✓] Connected device (1 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 12 (API 31) (emulator)

! Doctor found issues in 1 category.
```

Old issues: 
[43000](https://github.com/flutter/flutter/issues/43000)
[38375](https://github.com/flutter/flutter/issues/38375)