Repository: flutter
Issue: Flutter integration with native android ActivityResultLauncher return null object reference 
Labels: platform-android,engine,has reproducible steps,P2,a: plugins,team-android,triaged-android,found in release: 3.13,found in release: 3.14

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

```
      ActivityResultLauncher<String> mGetContent = registerForActivityResult(new ActivityResultContracts.GetContent(),
              uri -> {
                // Handle the returned Uri
              });

      mGetContent.launch("image/*");
```

when i `mGetContent.launch` i get Exception with this message

Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference
or 
Attempt to invoke virtual method 'android.app.ActivityThread$ApplicationThread android.app.ActivityThread.getApplicationThread()' on a null object reference

This error appear with me when use `launch` always


I am using context like that and already i get package name

```
  private Context context;

  @Override
  public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
    channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), CHANNEL);
    channel.setMethodCallHandler(this);
    context = flutterPluginBinding.getApplicationContext();
  }
```



### Expected results

content work fine when using ActivityResultLauncher with registerForActivityResult

### Actual results

Attempt to invoke virtual method 'android.app.ActivityThread$ApplicationThread android.app.ActivityThread.getApplicationThread()' on a null object reference

Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference


### Code sample

<details><summary>Code sample</summary>

```
      ActivityResultLauncher<String> mGetContent = registerForActivityResult(new ActivityResultContracts.GetContent(),
              uri -> {
                // Handle the returned Uri
              });

      mGetContent.launch("image/*");
```

I am using context like that and already i get package name

```
  private Context context;

  @Override
  public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
    channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), CHANNEL);
    channel.setMethodCallHandler(this);
    context = flutterPluginBinding.getApplicationContext();
  }
```



</details>


### Screenshots or Video

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


### Logs

Attempt to invoke virtual method 'android.app.ActivityThread$ApplicationThread android.app.ActivityThread.getApplicationThread()' on a null object reference


Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference



### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
[√] Flutter (Channel stable, 3.13.1, on Microsoft Windows [Version 10.0.19045.3324], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)

```

</details>