flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
166.83k stars 27.65k forks source link

[camera] Android 12 - camera plugin fails to take a photo, loads indefinitely #92973

Closed yurtemre7 closed 2 years ago

yurtemre7 commented 3 years ago

Steps to Reproduce

  1. Use a Google Pixel 6 with Android 12
  2. Open a flutter app with the camera plugin and an already set-up camera view with an initialized CameraController.
  3. Trigger the .takePicture() method via click on an actuator.

Expected results: Takes a picture and saves it to the device.

Actual results: its loading indefinitely in the CameraCaptureCallback STATE_CAPTURING.

Explain the flutter run --verbose

The dispose event is what I triggered myself when popping out of the camera view, after it there is no "crash" or error. If I had not popped out of the camera view, it would be loading indefinitely. Code-vise, its just the .takePicture() Function on a correctly initialized CameraController.

Logs ``` I/CameraManagerGlobal(18512): Connecting to camera service [ +105 ms] I/Camera (18512): startPreview [ +93 ms] I/Camera (18512): Updating builder settings [ ] D/Camera (18512): Updating builder with feature: ExposureLockFeature [ ] D/Camera (18512): Updating builder with feature: ExposurePointFeature [ +5 ms] D/Camera (18512): Updating builder with feature: ZoomLevelFeature [ ] D/Camera (18512): Updating builder with feature: AutoFocusFeature [ ] D/Camera (18512): Updating builder with feature: NoiseReductionFeature [ +2 ms] I/Camera (18512): updateNoiseReduction | currentSetting: fast [ ] D/Camera (18512): Updating builder with feature: FocusPointFeature [ ] D/Camera (18512): Updating builder with feature: ResolutionFeature [ ] D/Camera (18512): Updating builder with feature: SensorOrientationFeature [ ] D/Camera (18512): Updating builder with feature: FlashFeature [ ] D/Camera (18512): Updating builder with feature: ExposureOffsetFeature [ ] D/Camera (18512): Updating builder with feature: FpsRangeFeature [+1311 ms] Activating Dart DevTools... (completed in 4,7s) [ +165 ms] W/1.raster(18512): type=1400 audit(0.0:7033): avc: denied { getattr } for name="/" dev="dmabuf" ino=1 scontext=u:r:untrusted_app:s0:c79,c257,c512,c768 tcontext=u:object_r:unlabeled:s0 tclass=filesystem permissive=0 app=de.letztewerbung.melder.melder [ +304 ms] The Flutter DevTools debugger and profiler on Pixel 6 is available at: http://127.0.0.1:9102?uri=http://127.0.0.1:51433/rhPnXlYhngs=/ [+1874 ms] I/Camera (18512): runPictureAutoFocus [ ] I/Camera (18512): lockAutoFocus [ ] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 2 | aeState: 2 [ +19 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 2 | aeState: 2 [ +35 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 2 | aeState: 2 [ +23 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 2 | aeState: 2 [ +40 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 2 | aeState: 2 [ +24 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 2 | aeState: 2 [ +39 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 2 | aeState: 2 [ +69 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 4 | aeState: 2 [ ] I/Camera (18512): captureStillPicture [ +26 ms] D/Camera (18512): Updating builder with feature: ExposureLockFeature [ ] D/Camera (18512): Updating builder with feature: ExposurePointFeature [ ] D/Camera (18512): Updating builder with feature: ZoomLevelFeature [ ] D/Camera (18512): Updating builder with feature: AutoFocusFeature [ ] D/Camera (18512): Updating builder with feature: NoiseReductionFeature [ ] I/Camera (18512): updateNoiseReduction | currentSetting: fast [ +4 ms] D/Camera (18512): Updating builder with feature: FocusPointFeature [ ] D/Camera (18512): Updating builder with feature: ResolutionFeature [ ] D/Camera (18512): Updating builder with feature: SensorOrientationFeature [ ] D/Camera (18512): Updating builder with feature: FlashFeature [ ] D/Camera (18512): Updating builder with feature: ExposureOffsetFeature [ ] D/Camera (18512): Updating builder with feature: FpsRangeFeature [ +108 ms] I/Camera (18512): sending capture request [ ] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 4 | aeState: 2 [ +46 ms] I/Camera (18512): unlockAutoFocus [ +120 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +21 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +18 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +16 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +14 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +38 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +41 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +49 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +17 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +30 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +37 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +29 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +34 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +25 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +30 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +35 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +30 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +34 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +35 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +28 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +34 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +27 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +36 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +23 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +30 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +37 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +24 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +36 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +27 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +26 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +34 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +33 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +29 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +35 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +32 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +28 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +37 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +23 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +29 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +32 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +32 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 1 [ +34 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 1 [ +29 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 1 [ +35 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 1 [ +32 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 1 [ +30 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 1 [ +38 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 1 [ +22 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 1 [ +26 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 1 [ +36 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 1 [ +34 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 1 [ +27 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 1 [ +34 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 1 [ +29 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 1 [ +25 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 1 [ +34 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 1 [ +36 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 1 [ +29 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 1 [ +30 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 1 [ +30 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +24 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +36 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +38 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +28 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +24 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +36 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +37 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +36 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +22 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +31 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +38 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +26 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +37 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +35 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +38 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +28 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 [ +33 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 2 [ +31 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +27 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +33 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +33 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +29 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +27 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +37 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +24 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +35 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +32 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +34 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +22 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +28 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +34 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +39 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +29 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +25 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +32 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +35 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +33 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +24 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +30 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +38 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +24 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +36 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +30 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +34 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +29 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +27 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +29 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +30 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +29 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +34 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +29 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +37 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +28 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +33 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +30 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +32 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +37 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +26 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1 [ +22 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 2 | aeState: 1 [ +27 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 2 | aeState: 1 [ +37 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 2 | aeState: 1 [ +25 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 2 | aeState: 1 [ +37 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 2 | aeState: 1 [ +32 ms] D/CameraCaptureCallback(18512): CameraCaptureCallback | state: STATE_CAPTURING | afState: 2 | aeState: 1 [ +3 ms] I/Camera (18512): dispose [ ] I/Camera (18512): close [ ] I/Camera (18512): closeCaptureSession [ +200 ms] I/Camera (18512): open | onClosed ``` ``` [√] Flutter (Channel stable, 2.5.3, on Microsoft Windows [Version 10.0.22489.1000], locale de-DE) • Flutter version 2.5.3 at C:\Tools\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 18116933e7 (3 weeks ago), 2021-10-15 10:46:35 -0700 • Engine revision d3ea636dc5 • Dart version 2.14.4 [√] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at C:\Programme und Tools\SDK • Platform android-31, build-tools 31.0.0 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189) • All Android licenses accepted. [√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe [√] Android Studio (version 2020.3) • Android Studio at C:\Program Files\Android\Android Studio • 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 11.0.10+0-b96-7249189) [√] IntelliJ IDEA Community Edition (version 2021.1) • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.1.2 • 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.61.2) • VS Code at C:\Users\emrey\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.28.0 [√] Connected device (3 available) • Pixel 6 (mobile) • 192.168.2.112:45509 • android-arm64 • Android 12 (API 31) • Chrome (web) • chrome • web-javascript • Google Chrome 95.0.4638.69 • Edge (web) • edge • web-javascript • Microsoft Edge 95.0.1020.30 • No issues found! ```
maheshj01 commented 3 years ago

Hi @yurtemre7, thanks for filing the issue. I was able to reproduce this issue on a pixel4 emulator (Api 31). on clicking the picture the app freezes, I verified this with the official camera example from the pub. The app works fine on Android 11 so it looks like this issue is Android 12 specific.

flutter doctor -v ``` [√] Flutter (Channel stable, 2.5.3, on Microsoft Windows [Version 10.0.19042.1288], locale en-US) • Flutter version 2.5.3 at C:\flutter_sdk\stable • Upstream repository https://github.com/flutter/flutter.git • Framework revision 18116933e7 (3 weeks ago), 2021-10-15 10:46:35 -0700 • Engine revision d3ea636dc5 • Dart version 2.14.4 [√] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at C:\Users\mahesh\AppData\Local\Android\sdk • Platform android-31, build-tools 31.0.0 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189) • All Android licenses accepted. [√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.4) • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community • Visual Studio Community 2019 version 16.11.31727.386 • Windows 10 SDK version 10.0.19041.0 [√] Android Studio (version 2020.3) • Android Studio at C:\Program Files\Android\Android Studio • 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 11.0.10+0-b96-7249189) [√] VS Code (version 1.61.2) • VS Code at C:\Users\mahesh\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.28.0 [√] Connected device (4 available) • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 12 (API 31) (emulator) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19042.1288] • Chrome (web) • chrome • web-javascript • Google Chrome 95.0.4638.69 • Edge (web) • edge • web-javascript • Microsoft Edge 95.0.1020.40 • No issues found! ``` ``` [√] Flutter version 2.6.0-12.0.pre.555 at C:\flutter_sdk\master • Upstream repository https://github.com/flutter/flutter.git • Framework revision 067386d706 (2 days ago), 2021-11-02 05:13:04 -0400 • Engine revision 76b4caeafe • Dart version 2.15.0 (build 2.15.0-268.0.dev) [√] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at C:\Users\mahesh\AppData\Local\Android\sdk • Platform android-31, build-tools 31.0.0 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189) • All Android licenses accepted. [√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.4) • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community • Visual Studio Community 2019 version 16.11.31727.386 • Windows 10 SDK version 10.0.19041.0 [√] Android Studio (version 2020.3) • Android Studio at C:\Program Files\Android\Android Studio • 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 11.0.10+0-b96-7249189) [√] VS Code (version 1.61.2) • VS Code at C:\Users\mahesh\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.28.0 [√] Connected device (4 available) • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 12 (API 31) (emulator) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19042.1288] • Chrome (web) • chrome • web-javascript • Google Chrome 95.0.4638.69 • Edge (web) • edge • web-javascript • Microsoft Edge 95.0.1020.40 • No issues found! ```
logs ```console Launching lib\main.dart on sdk gphone64 x86 64 in debug mode... √ Built build\app\outputs\flutter-apk\app-debug.apk. W/FlutterActivityAndFragmentDelegate( 2638): A splash screen was provided to Flutter, but this is deprecated. See flutter.dev/go/android-splash-migration for migration steps. Connecting to VM Service at ws://127.0.0.1:62372/cAj76sCA-e4=/ws I/CameraManagerGlobal( 2638): Connecting to camera service D/EGL_emulation( 2638): app_time_stats: avg=628.11ms min=2.59ms max=13732.80ms count=24 E/BLASTBufferQueue( 2638): [SurfaceView[com.example.ads/com.example.ads.MainActivity]#1](f:0,a:0) rejecting buffer:active_size=1080x2148, requested_size=1080x2148 buffer{size=1080x2280 transform=0} D/EGL_emulation( 2638): app_time_stats: avg=90.49ms min=2.64ms max=2269.04ms count=29 D/EGL_emulation( 2638): app_time_stats: avg=72.09ms min=3.14ms max=1444.08ms count=26 D/EGL_emulation( 2638): app_time_stats: avg=1078.13ms min=1063.28ms max=1092.97ms count=2 I/com.example.ad( 2638): Background young concurrent copying GC freed 8589(538KB) AllocSpace objects, 4(208KB) LOS objects, 48% free, 2830KB/5478KB, paused 5.989ms,90us total 44.785ms I/Camera ( 2638): startPreview I/Camera ( 2638): Updating builder settings D/Camera ( 2638): Updating builder with feature: ExposureLockFeature D/Camera ( 2638): Updating builder with feature: ExposurePointFeature D/Camera ( 2638): Updating builder with feature: ZoomLevelFeature D/Camera ( 2638): Updating builder with feature: AutoFocusFeature D/Camera ( 2638): Updating builder with feature: NoiseReductionFeature I/Camera ( 2638): updateNoiseReduction | currentSetting: fast D/Camera ( 2638): Updating builder with feature: FocusPointFeature D/Camera ( 2638): Updating builder with feature: ResolutionFeature D/Camera ( 2638): Updating builder with feature: SensorOrientationFeature D/Camera ( 2638): Updating builder with feature: FlashFeature D/Camera ( 2638): Updating builder with feature: ExposureOffsetFeature D/Camera ( 2638): Updating builder with feature: FpsRangeFeature D/EGL_emulation( 2638): app_time_stats: avg=28120.60ms min=28120.60ms max=28120.60ms count=1 D/EGL_emulation( 2638): app_time_stats: avg=1068.46ms min=1068.46ms max=1068.46ms count=1 D/EGL_emulation( 2638): app_time_stats: avg=264.82ms min=58.05ms max=615.24ms count=4 D/EGL_emulation( 2638): app_time_stats: avg=91.20ms min=17.46ms max=202.96ms count=11 I/Camera ( 2638): runPrecaptureSequence D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_START | afState: 0 | aeState: 2 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 0 | aeState: 2 I/Camera ( 2638): captureStillPicture D/Camera ( 2638): Updating builder with feature: ExposureLockFeature D/Camera ( 2638): Updating builder with feature: ExposurePointFeature D/Camera ( 2638): Updating builder with feature: ZoomLevelFeature D/Camera ( 2638): Updating builder with feature: AutoFocusFeature D/Camera ( 2638): Updating builder with feature: NoiseReductionFeature I/Camera ( 2638): updateNoiseReduction | currentSetting: fast D/Camera ( 2638): Updating builder with feature: FocusPointFeature D/Camera ( 2638): Updating builder with feature: ResolutionFeature D/Camera ( 2638): Updating builder with feature: SensorOrientationFeature D/Camera ( 2638): Updating builder with feature: FlashFeature D/Camera ( 2638): Updating builder with feature: ExposureOffsetFeature D/Camera ( 2638): Updating builder with feature: FpsRangeFeature I/Camera ( 2638): sending capture request D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 I/Camera ( 2638): unlockAutoFocus D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/EGL_emulation( 2638): app_time_stats: avg=199.39ms min=35.19ms max=614.24ms count=6 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/EGL_emulation( 2638): app_time_stats: avg=145.49ms min=28.88ms max=529.72ms count=7 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 D/CameraCaptureCallback( 2638): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5 I/Camera ( 2638): open | onError I/Camera ( 2638): close I/Camera ( 2638): closeCaptureSession E/CameraCaptureSession( 2638): Session 0: Exception while stopping repeating: E/CameraCaptureSession( 2638): android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): The camera device has encountered a serious error E/CameraCaptureSession( 2638): at android.hardware.camera2.impl.CameraDeviceImpl.checkIfCameraClosedOrInError(CameraDeviceImpl.java:2350) E/CameraCaptureSession( 2638): at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:1277) E/CameraCaptureSession( 2638): at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:579) E/CameraCaptureSession( 2638): at io.flutter.plugins.camera.Camera.closeCaptureSession(Camera.java:1085) E/CameraCaptureSession( 2638): at io.flutter.plugins.camera.Camera.close(Camera.java:1092) E/CameraCaptureSession( 2638): at io.flutter.plugins.camera.Camera$1.onError(Camera.java:291) E/CameraCaptureSession( 2638): at android.hardware.camera2.impl.CameraDeviceImpl.notifyError(CameraDeviceImpl.java:1748) E/CameraCaptureSession( 2638): at android.hardware.camera2.impl.CameraDeviceImpl.$r8$lambda$KBQCqQRdhVVn7uHI9Xdha6OqnsU(Unknown Source:0) E/CameraCaptureSession( 2638): at android.hardware.camera2.impl.CameraDeviceImpl$$ExternalSyntheticLambda0.accept(Unknown Source:8) E/CameraCaptureSession( 2638): at com.android.internal.util.function.pooled.PooledLambdaImpl.doInvoke(PooledLambdaImpl.java:281) E/CameraCaptureSession( 2638): at com.android.internal.util.function.pooled.PooledLambdaImpl.invoke(PooledLambdaImpl.java:204) E/CameraCaptureSession( 2638): at com.android.internal.util.function.pooled.OmniFunction.run(OmniFunction.java:97) E/CameraCaptureSession( 2638): at android.os.Handler.handleCallback(Handler.java:938) E/CameraCaptureSession( 2638): at android.os.Handler.dispatchMessage(Handler.java:99) E/CameraCaptureSession( 2638): at android.os.Looper.loopOnce(Looper.java:201) E/CameraCaptureSession( 2638): at android.os.Looper.loop(Looper.java:288) E/CameraCaptureSession( 2638): at android.os.HandlerThread.run(HandlerThread.java:67) I/Camera ( 2638): [refreshPreviewCaptureSession] captureSession not yet initialized, skipping preview capture session refresh. I/Camera ( 2638): [refreshPreviewCaptureSession] captureSession not yet initialized, skipping preview capture session refresh. I/Camera ( 2638): unlockAutoFocus I/Camera ( 2638): [unlockAutoFocus] captureSession null, returning D/EGL_emulation( 2638): app_time_stats: avg=578.43ms min=10.06ms max=6183.95ms count=12 I/Camera ( 2638): dispose I/Camera ( 2638): close I/com.example.ad( 2638): Thread[2,tid=2644,WaitingInMainSignalCatcherLoop,Thread*=0x790348e9c6f0,peer=0x12e80238,"Signal Catcher"]: reacting to signal 3 I/com.example.ad( 2638): I/com.example.ad( 2638): Wrote stack traces to tombstoned Lost connection to device. Exited (sigterm) ```
maheshj01 commented 3 years ago

@yurtemre7, This issue looks like a duplicate of https://github.com/flutter/flutter/issues/92762. Closing in favour of the linked issue, if you disagree feel free to write in the comments and I will reopen it.

Thank you.

yurtemre7 commented 3 years ago

I saw that issue too, but my error does not include the camera exception part. I hope fixing the one will fix the other but they could not be related. Mines was tested on a real device too.

maheshj01 commented 3 years ago

I saw that issue too, but my error does not include the camera exception part. I hope fixing the one will fix the other but they could not be related. Mines was tested on a real device too.

Aliright, Keeping this issue open.

acoutts commented 3 years ago

This is a different bug than #92762 - on the pixel 6, calling capture picture never actually captures the picture and instead stays stuck in the capture routine.

Here is what the debug log looks like:

I/Camera  ( 9091): captureStillPicture
D/Camera  ( 9091): Updating builder with feature: ExposureLockFeature
D/Camera  ( 9091): Updating builder with feature: ExposurePointFeature
D/Camera  ( 9091): Updating builder with feature: ZoomLevelFeature
D/Camera  ( 9091): Updating builder with feature: AutoFocusFeature
D/Camera  ( 9091): Updating builder with feature: NoiseReductionFeature
I/Camera  ( 9091): updateNoiseReduction | currentSetting: fast
D/Camera  ( 9091): Updating builder with feature: FocusPointFeature
D/Camera  ( 9091): Updating builder with feature: ResolutionFeature
D/Camera  ( 9091): Updating builder with feature: SensorOrientationFeature
D/Camera  ( 9091): Updating builder with feature: FlashFeature
D/Camera  ( 9091): Updating builder with feature: ExposureOffsetFeature
D/Camera  ( 9091): Updating builder with feature: FpsRangeFeature
I/Camera  ( 9091): sending capture request
D/CameraCaptureCallback( 9091): CameraCaptureCallback | state: STATE_CAPTURING | afState: 4 | aeState: 2
I/Camera  ( 9091): unlockAutoFocus
5
D/CameraCaptureCallback( 9091): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2
29
D/CameraCaptureCallback( 9091): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 1
6
D/CameraCaptureCallback( 9091): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2
7
D/CameraCaptureCallback( 9091): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 1
21
D/CameraCaptureCallback( 9091): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1
11
D/CameraCaptureCallback( 9091): CameraCaptureCallback | state: STATE_CAPTURING | afState: 2 | aeState: 1
2
D/CameraCaptureCallback( 9091): CameraCaptureCallback | state: STATE_CAPTURING | afState: 2 | aeState: 2
3
D/CameraCaptureCallback( 9091): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 2
146
D/CameraCaptureCallback( 9091): CameraCaptureCallback | state: STATE_CAPTURING | afState: 2 | aeState: 2
10
D/CameraCaptureCallback( 9091): CameraCaptureCallback | state: STATE_CAPTURING | afState: 2 | aeState: 1
D/CameraCaptureCallback( 9091): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 2
69
D/CameraCaptureCallback( 9091): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1
W/1.raster( 9091): type=1400 audit(0.0:521): avc: denied { getattr } for name="/" dev="dmabuf" ino=1 scontext=u:r:untrusted_app:s0:c243,c256,c512,c768 tcontext=u:object_r:unlabeled:s0 tclass=filesystem permissive=0 app=com.bottlepay.sandbox
22
D/CameraCaptureCallback( 9091): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1
6
D/CameraCaptureCallback( 9091): CameraCaptureCallback | state: STATE_CAPTURING | afState: 6 | aeState: 1
16
D/CameraCaptureCallback( 9091): CameraCaptureCallback | state: STATE_CAPTURING | afState: 1 | aeState: 1
58
D/CameraCaptureCallback( 9091): CameraCaptureCallback | state: STATE_CAPTURING | afState: 2 | aeState: 1

It just stays in STATE_CAPTURING and never completes the capture. @mvanbeusekom

jtmcdole commented 3 years ago

Ditto log on this:

I/Camera  (32534): runPictureAutoFocus
I/Camera  (32534): lockAutoFocus
D/CameraCaptureCallback(32534): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 2 | aeState: 4
D/CameraCaptureCallback(32534): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 2 | aeState: 4
D/CameraCaptureCallback(32534): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 2 | aeState: 4
D/CameraCaptureCallback(32534): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 2 | aeState: 4
D/CameraCaptureCallback(32534): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 2 | aeState: 4
D/CameraCaptureCallback(32534): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 2 | aeState: 4
D/CameraCaptureCallback(32534): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 2 | aeState: 4
D/CameraCaptureCallback(32534): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 4 | aeState: 4
I/Camera  (32534): runPrecaptureSequence
D/CameraCaptureCallback(32534): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_START | afState: 4 | aeState: 4
D/CameraCaptureCallback(32534): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 4 | aeState: 4
I/Camera  (32534): captureStillPicture
D/Camera  (32534): Updating builder with feature: ExposureLockFeature
D/Camera  (32534): Updating builder with feature: ExposurePointFeature
D/Camera  (32534): Updating builder with feature: ZoomLevelFeature
D/Camera  (32534): Updating builder with feature: AutoFocusFeature
D/Camera  (32534): Updating builder with feature: NoiseReductionFeature
I/Camera  (32534): updateNoiseReduction | currentSetting: fast
D/Camera  (32534): Updating builder with feature: FocusPointFeature
D/Camera  (32534): Updating builder with feature: ResolutionFeature
D/Camera  (32534): Updating builder with feature: SensorOrientationFeature
D/Camera  (32534): Updating builder with feature: FlashFeature
D/Camera  (32534): Updating builder with feature: ExposureOffsetFeature
D/Camera  (32534): Updating builder with feature: FpsRangeFeature
I/Camera  (32534): sending capture request
D/CameraCaptureCallback(32534): CameraCaptureCallback | state: STATE_CAPTURING | afState: 4 | aeState: 4
I/Camera  (32534): unlockAutoFocus
D/CameraCaptureCallback(32534): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5
jtmcdole commented 3 years ago

I think I have the problem identified: In the Camera.java; the plugin is calling abortCaptures(). According to the android documentation:

Once all pending requests are either completed or thrown away, the StateCallback#onReady callback will be called

By adding some logging, I see that onCaptureCompleted is called before onReady, and no onImageAvailable callback is made. If I comment out the abort request, I get:

I/Camera  (18095): onCaptureStarted: 167
I/Camera  (18095): onCaptureCompleted
I/Camera  (18095): onImageAvailable
I/Camera  (18095): onReady: android.hardware.camera2.impl.CameraCaptureSessionImpl@939c119

And I get an image.

xiyulangzi commented 2 years ago

Reproducible with Pixel 6 with Flutter 2.8 and camera: ^0.9.4+5 still.

blopker commented 2 years ago

We tested with the fork here: https://github.com/YuKiO-output/plugins/commit/e00673a310e8af560c56c588454b421d3a66dff4

The fix works for our use case, but I'm not sure if that change affects other features negatively.

Does this mean all Flutter apps are not able to take pictures on the Pixel 6? Or maybe all Android 12 devices? This seems like a big issue. Should it be higher priority?

maheshj01 commented 2 years ago

This seems like a big issue. Should it be higher priority?

@blopker, Please see this to understand how the issues are prioritized https://github.com/flutter/flutter/wiki/Issue-hygiene#priorities. You can always upvote the original post with 👍🏻 to increase its priority.

blopker commented 2 years ago

Thanks @maheshmnj, I checked that link out. Although, I don't think I understand what I was supposed to learn there. I had already thumbs upped the original post. I was only wondering aloud if this should be a P3. I suppose the question isn't really helpful, however that document doesn't really tell me how P4s become P3s, so I was curious. Is more information needed to make this a higher priority, or is it only based on votes?

maheshj01 commented 2 years ago

@blopker The priority will be assigned based on the severity of the bug I agree this bug needs attention but I believe there are more serious bugs than this to be addressed atm.

I had already thumbs upped the original post.

The upvotes are one of the factors, a large number of votes indicates that this affects many users and is likely to get more attention from the team than other issues.

I was only wondering aloud if this should be a P3. I suppose the question isn't really helpful, however that document doesn't really tell me how P4s become P3s, so I was curious. Is more information needed to make this a higher priority, or is it only based on votes

I believe this is solely based on the severity of the bug, if this issue will be worked on you will see p3 label assigned as mentioned in the wiki

The P4 label indicates issues that we agree are important to work on, but not at the top of the work list. This is the default level for bugs. A bug at this priority level may not be fixed for a long time. Often a bug at this level will first migrate to P3 before we work on them.

sc-ot commented 2 years ago

We tested with the fork here: YuKiO-output/plugins@e00673a

The fix works for our use case, but I'm not sure if that change affects other features negatively.

Does this mean all Flutter apps are not able to take pictures on the Pixel 6? Or maybe all Android 12 devices? This seems like a big issue. Should it be higher priority?

No, not on all Android 12 Devices. I tested it on a Samsung with Android 12 and it worked there. It seems to be related to the Google Pixel. Commenting out the line also worked for me for the time being without any problem.

agent515 commented 2 years ago

Encountering the same issue on a real Android device (Realme X2) while it worked fine on the emulator (Pixel 3A).

Logs: ``` I/Camera (17561): runPictureAutoFocus I/Camera (17561): lockAutoFocus 7 D/CameraCaptureCallback(17561): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 2 | aeState: 4 D/CameraCaptureCallback(17561): CameraCaptureCallback | state: STATE_WAITING_FOCUS | afState: 4 | aeState: 4 I/Camera (17561): runPrecaptureSequence I/Camera (17561): refreshPreviewCaptureSession D/CameraCaptureCallback(17561): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_START | afState: 2 | aeState: 4 D/CameraCaptureCallback(17561): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 2 | aeState: 4 I/Camera (17561): captureStillPicture D/Camera (17561): Updating builder with feature: ExposureLockFeature D/Camera (17561): Updating builder with feature: ExposurePointFeature D/Camera (17561): Updating builder with feature: ZoomLevelFeature D/Camera (17561): Updating builder with feature: AutoFocusFeature D/Camera (17561): Updating builder with feature: NoiseReductionFeature I/Camera (17561): updateNoiseReduction | currentSetting: fast D/Camera (17561): Updating builder with feature: FocusPointFeature D/Camera (17561): Updating builder with feature: ResolutionFeature D/Camera (17561): Updating builder with feature: SensorOrientationFeature D/Camera (17561): Updating builder with feature: FlashFeature D/Camera (17561): Updating builder with feature: ExposureOffsetFeature D/Camera (17561): Updating builder with feature: FpsRangeFeature I/Camera (17561): sending capture request D/CameraCaptureCallback(17561): CameraCaptureCallback | state: STATE_CAPTURING | afState: 4 | aeState: 4 2 D/CameraCaptureCallback(17561): CameraCaptureCallback | state: STATE_CAPTURING | afState: null | aeState: null ```
SkywalkerDarren commented 2 years ago

We tested with the fork here: YuKiO-output/plugins@e00673a The fix works for our use case, but I'm not sure if that change affects other features negatively. Does this mean all Flutter apps are not able to take pictures on the Pixel 6? Or maybe all Android 12 devices? This seems like a big issue. Should it be higher priority?

No, not on all Android 12 Devices. I tested it on a Samsung with Android 12 and it worked there. It seems to be related to the Google Pixel. Commenting out the line also worked for me for the time being without any problem.

I tested it on Pixel 4a and Pixel 6 pro with Android 12, and Pixel 4a it worked but Pixel 6 can't work. Commenting out the line, they all work.

jeffaknine commented 2 years ago

Even when commenting //captureSession.abortCaptures();, it doesn't work for me with the back camera of an emulated pixel4 api 31

carman247 commented 2 years ago

Following! This is an issue for us ..

[EDIT] Can confirm that commenting out //captureSession.abortCaptures(); enables capture on Pixel 6. Will be testing other affected devices if possible.

Affected devices:

spotlmnop commented 2 years ago

Same problem here on a pixel 6 pro.

Sakib0604 commented 2 years ago

Even after commenting //captureSession.abortCaptures() , it doesn't work in Realme X2 (Android V#11)

Log: I/Camera ( 2722): sending capture request D/CameraCaptureCallback( 2722): CameraCaptureCallback | state: STATE_CAPTURING | afState: 2 | aeState: 2 D/CameraCaptureCallback( 2722): CameraCaptureCallback | state: STATE_CAPTURING | afState: 4 | aeState: 2 D/CameraCaptureCallback( 2722): CameraCaptureCallback | state: STATE_CAPTURING | afState: null | aeState: null

maxbaird commented 2 years ago

I have this issue too. It is a bit unfortunate that it is given such low priority given that it is a fundamental feature of the camera that is completely broken. And the only work around, commenting //captureSession.abortCaptures(), does not work for me either.

udaysingh2 commented 2 years ago

I am also facing same issue getting this on take picture click : sending capture request D/CameraCaptureCallback( 5143): CameraCaptureCallback | state: STATE_CAPTURING | afState: 2 | aeState: 2 2 D/CameraCaptureCallback( 5143): CameraCaptureCallback | state: STATE_CAPTURING | afState: null | aeState: null

AI-Stefan commented 2 years ago

I only get this error when I use the DEFAULT_BACK_CAMERA.

I fixed it for now for now by changing val cameraSelector = CameraSelector.DEFAULT_BACK_CAMERA to val cameraSelector = CameraSelector.DEFAULT_FRONT_CAMERA

maxbaird commented 2 years ago

I only get this error when I use the DEFAULT_BACK_CAMERA.

I fixed it for now for now by changing val cameraSelector = CameraSelector.DEFAULT_BACK_CAMERA to val cameraSelector = CameraSelector.DEFAULT_FRONT_CAMERA

Can you elaborate a bit more with an example? Thanks! :-)

udaysingh2 commented 2 years ago

these errors are coming from android native side on which I don't have control I think adding the code snippet using which I am using

final cameras = await availableCameras();
    final camera = (arguments.docType == DocType.PROFILE_PHOTO ||
            arguments.docType == DocType.COVID_SELFIE)
        ? cameras[1]
        : cameras.first;
    _controller =
        CameraController(camera, ResolutionPreset.medium , enableAudio: false);
    _initializeControllerFuture = _controller.initialize().then((value) async {
      // FlashMode currentFlashMode = _controller.value.flashMode;
      // if (currentFlashMode != null)
      try {
        await _controller.setFlashMode(FlashMode.off);
      } catch (error) {}
      setState(() {});
    });
kozhuhar commented 2 years ago

Camera is very important in out app and we are hoping that flutter team will give much more attention to this bug. Currently we are searching alternative implementation.

mccadi commented 2 years ago

Also experiencing the same issue for pixel 6.

tuanhwing commented 2 years ago

Even when commenting

//captureSession.abortCaptures();

It doesn't work for me with Emulator Pixel 4 (Android 12) Log:

I/Camera  (15119): runPrecaptureSequence
I/Camera  (15119): refreshPreviewCaptureSession
D/CameraCaptureCallback(15119): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_START | afState: 0 | aeState: 2
D/CameraCaptureCallback(15119): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 0 | aeState: 2
I/Camera  (15119): captureStillPicture
D/Camera  (15119): Updating builder with feature: ExposureLockFeature
D/Camera  (15119): Updating builder with feature: ExposurePointFeature
D/Camera  (15119): Updating builder with feature: ZoomLevelFeature
D/Camera  (15119): Updating builder with feature: AutoFocusFeature
D/Camera  (15119): Updating builder with feature: NoiseReductionFeature
I/Camera  (15119): updateNoiseReduction | currentSetting: fast
D/Camera  (15119): Updating builder with feature: FocusPointFeature
D/Camera  (15119): Updating builder with feature: ResolutionFeature
D/Camera  (15119): Updating builder with feature: SensorOrientationFeature
D/Camera  (15119): Updating builder with feature: FlashFeature
D/Camera  (15119): Updating builder with feature: ExposureOffsetFeature
D/Camera  (15119): Updating builder with feature: FpsRangeFeature
I/Camera  (15119): sending capture request
D/CameraCaptureCallback(15119): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2
D/CameraCaptureCallback(15119): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 2
D/CameraCaptureCallback(15119): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5
D/CameraCaptureCallback(15119): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5
I/Camera  (15119): unlockAutoFocus
I/Camera  (15119): refreshPreviewCaptureSession
D/CameraCaptureCallback(15119): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5
D/CameraCaptureCallback(15119): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5
D/CameraCaptureCallback(15119): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5
D/CameraCaptureCallback(15119): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5
D/CameraCaptureCallback(15119): CameraCaptureCallback | state: STATE_CAPTURING | afState: 0 | aeState: 5
I/Camera  (15119): open | onError
I/Camera  (15119): close
I/Camera  (15119): closeCaptureSession
E/CameraCaptureSession(15119): Session 0: Exception while stopping repeating: 
E/CameraCaptureSession(15119): android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): The camera device has encountered a serious error
E/CameraCaptureSession(15119):  at android.hardware.camera2.impl.CameraDeviceImpl.checkIfCameraClosedOrInError(CameraDeviceImpl.java:2350)
E/CameraCaptureSession(15119):  at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:1277)
E/CameraCaptureSession(15119):  at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:579)
E/CameraCaptureSession(15119):  at io.flutter.plugins.camera.Camera.closeCaptureSession(Camera.java:1115)
E/CameraCaptureSession(15119):  at io.flutter.plugins.camera.Camera.close(Camera.java:1122)
E/CameraCaptureSession(15119):  at io.flutter.plugins.camera.Camera$1.onError(Camera.java:302)
E/CameraCaptureSession(15119):  at android.hardware.camera2.impl.CameraDeviceImpl.notifyError(CameraDeviceImpl.java:1748)
E/CameraCaptureSession(15119):  at android.hardware.camera2.impl.CameraDeviceImpl.$r8$lambda$KBQCqQRdhVVn7uHI9Xdha6OqnsU(Unknown Source:0)
E/CameraCaptureSession(15119):  at android.hardware.camera2.impl.CameraDeviceImpl$$ExternalSyntheticLambda0.accept(Unknown Source:8)
E/CameraCaptureSession(15119):  at com.android.internal.util.function.pooled.PooledLambdaImpl.doInvoke(PooledLambdaImpl.java:281)
E/CameraCaptureSession(15119):  at com.android.internal.util.function.pooled.PooledLambdaImpl.invoke(PooledLambdaImpl.java:204)
E/CameraCaptureSession(15119):  at com.android.internal.util.function.pooled.OmniFunction.run(OmniFunction.java:97)
E/CameraCaptureSession(15119):  at android.os.Handler.handleCallback(Handler.java:938)
E/CameraCaptureSession(15119):  at android.os.Handler.dispatchMessage(Handler.java:99)
E/CameraCaptureSession(15119):  at android.os.Looper.loopOnce(Looper.java:201)
E/CameraCaptureSession(15119):  at android.os.Looper.loop(Looper.java:288)
E/CameraCaptureSession(15119):  at android.os.HandlerThread.run(HandlerThread.java:67)
maheshj01 commented 2 years ago

@tuanhwing please follow up here https://github.com/flutter/flutter/issues/92762 regarding your issue.

ccadieux commented 2 years ago

@maheshmnj We have a doctor not able to take pictures of his patients due to this issue. When can we expect a fix for this.

maxbaird commented 2 years ago

@maheshmnj We have a doctor not able to take pictures of his patients due to this issue. When can we expect a fix for this.

Yep. We've had to re-write an entire part of our application because of this. You can try using the image_picker plugin for camera access. It does not depend on the camera plugin. This is what we ended up using. Not perfect for our use case, but better than nothing.

I'm quite surprised that this bug has remained open for so long given that it breaks (via their own example) on recent devices. It makes me question if/how tests are done.

acoutts commented 2 years ago

@maxbaird there are not currently any driver tests for the camera plugin but PRs are always welcome if you want to help us all make it better. The camera is very complex and extremely device-specific in android.

I have even found bugs due to manufacturers not following the android spec, and those need to be handled as they come up: https://issuetracker.google.com/issues/189237151?pli=1

acoutts commented 2 years ago

There is a PR currently in review which fixes this issue submitted here: https://github.com/flutter/plugins/pull/4572

maheshj01 commented 2 years ago

@ccadieux Unfortunately we cannot provide you with any eta about when a bug will be fixed Please see https://github.com/flutter/flutter/wiki/Issue-hygiene#when-will-my-bug-be-fixed

And since there is a PR waiting for a review, we might get a fix soon. Please be patient.

markfili commented 2 years ago

if you have the time you can test this attempt at CameraX implementation and run the example app to see if it's working https://github.com/markfili/camerax it's a fork of he camerax plugin available on pub.dev which only offers barcode scanning. this fork maintains barcode scanning and adds picture capture feature, but not much else. it is still a work in progress, you would have to handle permissions manually before accessing the camera, but the photo capturing works really well, it's used in our production apps. feel free to provide feedback in the repo.

stuartmorgan commented 2 years ago

Fixed by https://github.com/flutter/plugins/pull/4572

For any issues still reproducible with the latest camera plugin, please file new issues with details.

github-actions[bot] commented 2 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.