Repository: flutter
Issue: [Android] Autofillhints keeps showing on other apps keyboard
Labels: a: text input,platform-android,engine,has reproducible steps,P2,found in release: 3.0,found in release: 3.1,team-android,triaged-android

When you change from a flutter app to another one on Android, the autofill hints of the focused inputs keeps showing on the other app:

## Steps to Reproduce
I implemented a basic form that contains one text input with AutofillHints.email and opened it on a physical Motorola G20 with Android 11 in debug mode:

<img src="https://user-images.githubusercontent.com/8863054/177020375-a5c03fe7-306a-4a71-89a3-07344d8b7eae.jpg" width="250">

Tap on input:
<img src="https://user-images.githubusercontent.com/8863054/177020516-9319b49d-a4d5-4986-afd6-02fca897f223.jpg" width="250">

Switch to another app and try to use the keyboard, in this case, I switched to Telegram:
<img src="https://user-images.githubusercontent.com/8863054/177020628-d6a332cf-a4ec-44ef-8387-0e0d26684ebf.jpg" width="250">

The hints show as if the text input was still on the screen (the same happens if AutofillHints.password is used). If you click on the hint, the apps automatically switch to the flutter app and autocomplete the input.

I would expect these hints to disappear if I switch to another app instead of this happening

<details>
<summary>Code sample</summary>


```dart
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final form = GlobalKey<FormState>();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
        ),
        body: Form(
              key: form,
              child: Padding(
                padding: const EdgeInsets.all(20),
                // Text Form Field with AutofillHints.email
                child: TextFormField(
                  decoration: const InputDecoration(
                    hintText: 'Enter your email',
                  ),
                  autofocus: true,
                  keyboardType: TextInputType.emailAddress,
                  autofillHints: const [AutofillHints.email],
                ),
              )),
        );
  }
}
```

</details>

<details>
<summary>Logs</summary>
   `flutter run --verbose`

```
Launching lib/main.dart on moto g 20 in debug mode...
Running Gradle task 'assembleDebug'...
✓  Built build/app/outputs/flutter-apk/app-debug.apk.
Debug service listening on ws://127.0.0.1:39707/pD6DggM9nSI=/ws
Syncing files to device moto g 20...
I/gralloc4( 8501): register: id=23300000ee4
E/libc    ( 8501): Access denied finding property "persist.vendor.sf.fbc"
E/libc    ( 8501): Access denied finding property "persist.vendor.gpu.fbc"
E/libc    ( 8501): Access denied finding property "persist.vendor.vsp.fbc"
I/gralloc4( 8501): register: id=23300000ee5
E/OpenGLRenderer( 8501): reset ##### pid = 8523
I/AssistStructure( 8501): Flattened final assist data: 504 bytes, containing 1 windows, 3 views
I/gralloc4( 8501): register: id=23300000ee6
I/gralloc4( 8501): unregister: id=23300000ee6
I/gralloc4( 8501): unregister: id=23300000ee5
W/libEGL  ( 8501): EGLNativeWindowType 0xb400007cd5553530 disconnect failed
I/gralloc4( 8501): register: id=23300000ee8
I/gralloc4( 8501): register: id=23300000ee9
I/gralloc4( 8501): register: id=23300000eea
I/gralloc4( 8501): register: id=23300000eeb
I/gralloc4( 8501): register: id=23300000eec
I/gralloc4( 8501): register: id=23300000ef7
I/ThreeFingerSwipe( 8501): 0 ACTION_DOWN point count = 1
I/ThreeFingerSwipe( 8501): onPointDown... pointIndex = 0, pointId = 0
I/ThreeFingerSwipe( 8501): currentX = 149.0, currentY = 487.0
I/ThreeFingerSwipe( 8501): 0 ACTION_UP point count = 1
I/ThreeFingerSwipe( 8501): 0 ACTION_DOWN point count = 1
I/ThreeFingerSwipe( 8501): onPointDown... pointIndex = 0, pointId = 0
I/ThreeFingerSwipe( 8501): currentX = 119.0, currentY = 230.0
I/ThreeFingerSwipe( 8501): 0 ACTION_UP point count = 1
I/gralloc4( 8501): register: id=23300000f02
I/gralloc4( 8501): unregister: id=23300000ef7
I/gralloc4( 8501): unregister: id=23300000ee4
I/gralloc4( 8501): unregister: id=23300000eec
W/libEGL  ( 8501): EGLNativeWindowType 0xb400007cd5557950 disconnect failed
I/gralloc4( 8501): unregister: id=23300000ee8
I/gralloc4( 8501): unregister: id=23300000ee9
I/gralloc4( 8501): unregister: id=23300000eeb
I/gralloc4( 8501): unregister: id=23300000eea
I/gralloc4( 8501): unregister: id=23300000f02
W/libEGL  ( 8501): EGLNativeWindowType 0xb400007cd5553530 disconnect failed
I/ActivityThread( 8501): smart_link is  not supported!!!
I/gralloc4( 8501): register: id=23300000f1f
I/gralloc4( 8501): register: id=23300000f20
I/gralloc4( 8501): register: id=23300000f21
I/ThreeFingerSwipe( 8501): 0 ACTION_DOWN point count = 1
I/ThreeFingerSwipe( 8501): onPointDown... pointIndex = 0, pointId = 0
I/ThreeFingerSwipe( 8501): currentX = 116.0, currentY = 253.0
I/ThreeFingerSwipe( 8501): 0 ACTION_UP point count = 1
I/gralloc4( 8501): register: id=23300000f22
I/gralloc4( 8501): register: id=23300000f27
I/gralloc4( 8501): register: id=23300000f2b
I/gralloc4( 8501): register: id=23300000f2a
I/gralloc4( 8501): unregister: id=23300000f21
I/gralloc4( 8501): unregister: id=23300000f1f
I/gralloc4( 8501): unregister: id=23300000f2a
W/libEGL  ( 8501): EGLNativeWindowType 0xb400007cd55c6490 disconnect failed
I/gralloc4( 8501): unregister: id=23300000f20
I/gralloc4( 8501): unregister: id=23300000f27
I/gralloc4( 8501): unregister: id=23300000f2b
I/gralloc4( 8501): unregister: id=23300000f22
W/libEGL  ( 8501): EGLNativeWindowType 0xb400007cd5553530 disconnect failed

```
  `flutter analyze`

```
Analyzing modo_bugs...                                                  
No issues found! (ran in 1.2s)
```

`flutter doctor -v`

```
[✓] Flutter (Channel stable, 3.0.4, on Ubuntu 20.04.4 LTS 5.13.0-52-generic, locale en_US.UTF-8)
    • Flutter version 3.0.4 at /home/gian/snap/flutter/common/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 85684f9300 (2 days ago), 2022-06-30 13:22:47 -0700
    • Engine revision 6ba2af10bb
    • Dart version 2.17.5
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /home/gian/Android/Sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /home/gian/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
    • cmake version 3.10.2
    • ninja version 1.8.2
    • pkg-config version 0.29.1

[✓] Android Studio (version 2021.2)
    • Android Studio at /home/gian/android-studio
    • Flutter plugin version 68.1.2
    • Dart plugin version 212.5744
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.68.1)
    • VS Code at /usr/share/code
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available)
    • moto g 20 (mobile) • adb-ZY32D5G6JZ-mFAS4M._adb-tls-connect._tcp • android-arm64  • Android 11 (API 30)
    • Linux (desktop)    • linux                                       • linux-x64      • Ubuntu 20.04.4 LTS 5.13.0-52-generic
    • Chrome (web)       • chrome                                      • web-javascript • Google Chrome 103.0.5060.53

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
```

</details>