Repository: flutter
Issue: RawKeyboardListener triggers soft keyboard on Android
Labels: a: text input,platform-android,framework,engine,f: focus,has reproducible steps,P2,team-android,triaged-android,found in release: 3.16,found in release: 3.19

This was spun off from https://github.com/flutter/flutter/issues/67915.

On Android, `RawKeyboardListener` triggers the soft keyboard when it receives input. This only happens after a TextField has received focus once. Until a TextField has received focus, the soft keyboard remains hidden.

## Steps to Reproduce

1. Run `flutter create bug`.
2. Replace `main.dart` with this:

```dart
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final FocusNode rawKbFocusNode = FocusNode();
  final FocusNode textFocusNode = FocusNode();

  bool renderTextField = true;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            RawKeyboardListener(
              onKey: (event) {
                print(event);
              },
              focusNode: rawKbFocusNode,
              autofocus: true,
              child: renderTextField
                  ? TextField(
                      focusNode: textFocusNode,
                    )
                  : Text('No textfield'),
            ),
            RaisedButton(
              child: Text('Focus RawKeyboardListener'),
              onPressed: () => rawKbFocusNode.requestFocus(),
            ),
            RaisedButton(
              child: Text('Toggle textfield'),
              onPressed: () => setState(() {
                renderTextField = !renderTextField;
              }),
            )
          ],
        ),
      ),
    );
  }
}
```

3. Use a hardware keyboard to enter text. Key events are printed, no soft keyboard is visible.
4. Focus the text field. Move focus back to `RawKeyboardListener`.
5. Use the hardware keyboard again to enter text. Now the soft keyboard will pop up.
6. Dismiss the soft keyboard and enter some more text. Soft keyboard will show again.
7. Even if the TextField is not rendered anymore, the same behavior keeps happening.

**Expected results:** <!-- what did you want to see? -->

I expected the soft keyboard to remain hidden. As long as no`TextField` receives focus, things behave as expected.
Only after a TextField has received focus once, the soft keyboard will keep popping up when the `RawKeyboardListener` receives input.

**Actual results:** <!-- what did you see? -->

The soft keyboard shows up.

Here's a gif showing the behavior.
All input is typed via a hardware keyboard.

![rawkeyboardlistener](https://user-images.githubusercontent.com/304603/99155542-09ca7300-26b9-11eb-9f59-355510ba8da6.gif)

<details>
  <summary>flutter doctor -v</summary>

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
[✓] Flutter (Channel master, 1.24.0-8.0.pre.230, on Mac OS X 10.15.7 19H15 darwin-x64, locale en-GB)
    • Flutter version 1.24.0-8.0.pre.230 at /Users/Pascal/.local/flutter-master
    • Framework revision af5eb3b987 (32 hours ago), 2020-11-13 19:57:15 +0800
    • Engine revision dddb532b5c
    • Dart version 2.12.0 (build 2.12.0-37.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
    • Android SDK at /Users/Pascal/Library/Android/sdk
    • Platform android-30, build-tools 30.0.1
    • ANDROID_HOME = /Users/Pascal/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.1, Build version 12A7403
    • CocoaPods version 1.9.3

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] IntelliJ IDEA Community Edition (version 2019.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.51.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.16.0

[✓] Connected device (2 available)
    • sdk gphone x86 64 (mobile) • emulator-5554 • android-x64 • Android 11 (API 30) (emulator)
    • macOS (desktop)            • macos         • darwin-x64  • Mac OS X 10.15.7 19H15 darwin-x64

• No issues found!
```

</details>