Repository: flutter
Issue: When using `flutter drive`, Flutter's semantics tree doesn't produce virtual Android Views
Labels: platform-android,tool,t: flutter driver,has reproducible steps,P2,found in release: 3.3,found in release: 3.4,team-android,triaged-android

Semantic info about Flutter's widgets is propagated down to the platform so that the platform knows about Flutter widgets and can use this information e.g for accessibility purposes. But during `flutter drive` this process doesn't happen.


<!-- Thank you for using Flutter!

     If you are looking for support, please check out our documentation
     or consider asking a question on Stack Overflow:
      * https://flutter.dev/
      * https://api.flutter.dev/
      * https://stackoverflow.com/questions/tagged/flutter?sort=frequent

     If you have found a bug or if our documentation doesn't have an answer
     to what you're looking for, then fill out the template below. Please read
     our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports
-->

## Steps to Reproduce

### See that the native view hierarchy exists during `flutter run`

1. Clone the https://github.com/bartekpacia/missing_a11y repository.
2. Run the app normally:

    ```
    flutter run
    ```
3. While the app is running, open a new terminal tab and dump native Android view hierarchy:
    
    ```
    adb shell uiautomator dump
    ```

4. Copy the file containing the hierarchy dump from the Android device to your machine's `$PWD`:

    ```
    adb pull /sdcard/window_dump.xml .
    ```

5. Inspect the XML file. It will contain information about the Flutter widgets. [See the file here](https://github.com/bartekpacia/missing_a11y/blob/master/window_dump_run.xml).

### See that the native view hierarchy doesn't exist during `flutter drive`

1. Clone the https://github.com/bartekpacia/missing_a11y repository.
2. Run the app with `flutter_driver`:

    ```
    flutter drive --target integration_test/app_test.dart --driver test_driver/integration_test.dart
    ```
3. While the app is running, open a new terminal tab and dump native Android view hierarchy:
    
    ```
    adb shell uiautomator dump
    ```

4. Copy the file containing the hierarchy dump from the Android device to your machine's `$PWD`:

    ```
    adb pull /sdcard/window_dump.xml .
    ```

5. Inspect the XML file. It contains very little information, e.g about `View`s in the status bar, but no data about Flutter widgets is in it. [See the file here](https://github.com/bartekpacia/missing_a11y/blob/master/window_dump_drive.xml).


## Expected results

I'd expect the view hierarchy dump to be the same no matter if the app is started with `flutter run` or `flutter drive`.

## Device details

I'm pretty sure it occurs on all Android versions, but I verified the above behavior on:
- Motorola moto g6 with Android 9
- Pixel 5 emulator with Android 13
- Pixel 5 emulator with Android 12
- Samsung Galaxy Tab with Android 11

## Additional, random context

- I'm working on a tool which requires to be run with `flutter drive` and which needs access to the native view hierarchy, but this problem prevents me from doing so.
- I expect that the problem lies in one of the bindings. I've looked quite a lot in them but didn't find any workaround.
- If TalkBack is enabled, the view hierarchy exists even during `flutter drive`. But this is an ugly and annoying workaround.
- [AccessibilityBridge](https://api.flutter.dev/javadoc/io/flutter/view/AccessibilityBridge.html) class in the Android engine embedder translates Flutter widgets into native views.