Repository: flutter
Issue: [camera_android_camerax] Setting exposure compensation index was canceled due to the camera being closed or a new request being submitted
Labels: c: crash,platform-android,p: camera,package,has reproducible steps,P2,team-android,triaged-android,found in release: 3.22

### Steps to reproduce

1. Create a new flutter project and paste in the code from https://github.com/flutter/packages/blob/main/packages/camera/camera/example/lib/main.dart
2. Add camera, video_player, and permission_handler dependencies in pubspec.
3. Add CAMERA permission to AndroidManifest.xml.
4. Run the app in debug mode
5. Accept the permission
6. Tap on Exposure mode and slide the slider
7. The error ``Setting exposure compensation index was canceled due to the camera being closed or a new request being submitted`` stops the session.

This is on a Samsung Galaxy A53 running Android 14.

### Expected results

Adjusting the exposure (EV) slider should not cause errors.

### Actual results

Exception: ``Setting exposure compensation index was canceled due to the camera being closed or a new request being submitted``

### Code sample

[The camera example code.](https://github.com/flutter/packages/blob/main/packages/camera/camera/example/lib/main.dart)

### Screenshots or Video

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


### Logs

<details open><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.22.0, on Zorin OS 17.1 6.5.0-35-generic, locale
    en_US.UTF-8)
    • Flutter version 3.22.0 on channel stable at /home/noah/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5dcb86f68f (7 days ago), 2024-05-09 07:39:20 -0500
    • Engine revision f6344b75dc
    • Dart version 3.4.0
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /home/noah/Android/Sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /home/noah/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build
      17.0.10+0-17.0.10b1087.21-11572160)
    • 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.

[✗] Linux toolchain - develop for Linux desktop
    ✗ clang++ is required for Linux development.
      It is likely available from your distribution (e.g.: apt install clang),
      or can be downloaded from https://releases.llvm.org/
    ✗ CMake is required for Linux development.
      It is likely available from your distribution (e.g.: apt install cmake),
      or can be downloaded from https://cmake.org/download/
    ✗ ninja is required for Linux development.
      It is likely available from your distribution (e.g.: apt install
      ninja-build), or can be downloaded from
      https://github.com/ninja-build/ninja/releases
    • pkg-config version 0.29.2
    ✗ GTK 3.0 development libraries are required for Linux development.
      They are likely available from your distribution (e.g.: apt install
      libgtk-3-dev)

[✓] Android Studio (version 2023.3)
    • Android Studio at /home/noah/android-studio
    • Flutter plugin version 79.0.2
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      17.0.10+0-17.0.10b1087.21-11572160)

[✓] Connected device (2 available)
    • SM S536DL (mobile) • <unknown> • android-arm64 • Android 14 (API 34)
    • Linux (desktop)    • linux     • linux-x64     • Zorin OS 17.1
      6.5.0-35-generic

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 2 categories.

```

</details>