Repository navigation
Camera first photo is overexposed when using startImageStream #134300
Copy link
Copy link
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work liste: device-specificOnly manifests on certain devicesOnly manifests on certain devicesfound in release: 3.13Found to occur in 3.13Found to occur in 3.13found in release: 3.14Found to occur in 3.14Found to occur in 3.14has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: cameraThe camera pluginThe camera pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyAndroid applications specificallyr: solvedIssue is closed as solvedIssue is closed as solvedteam-androidOwned by Android platform teamOwned by Android platform teamtriaged-androidTriaged by Android platform teamTriaged by Android platform team
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
- Open the app
- Take a picture
- Take a picture of the same scene
- Exit to the home screen of your device
- Open the app again
- Repeat 2-3
Expected results
EV is always +- the same
Actual results
The first picture is overexposed sometimes
Code sample
Code sample
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'dart:developer';
import 'dart:io';
import 'dart:math' as math;
import 'package:camera/camera.dart';
import 'package:exif/exif.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
runApp(const CameraApp());
}
/// CameraApp is the Main Application.
class CameraApp extends StatelessWidget {
/// Default Constructor
const CameraApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: CameraExampleHome(),
);
}
}
/// Camera example home widget.
class CameraExampleHome extends StatefulWidget {
/// Default Constructor
const CameraExampleHome({Key? key}) : super(key: key);
@override
State<CameraExampleHome> createState() {
return _CameraExampleHomeState();
}
}
class _CameraExampleHomeState extends State<CameraExampleHome> with WidgetsBindingObserver, TickerProviderStateMixin {
CameraController? controller;
@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
initialize();
}
@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}
// #docregion AppLifecycle
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
final CameraController? cameraController = controller;
// App state changed before we got the chance to initialize.
if (cameraController == null || !cameraController.value.isInitialized) {
return;
}
if (state == AppLifecycleState.inactive) {
cameraController.dispose();
} else if (state == AppLifecycleState.resumed) {
initialize();
}
}
// #enddocregion AppLifecycle
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Camera example'),
),
body: Column(
children: <Widget>[
Expanded(
child: Container(
decoration: const BoxDecoration(color: Colors.black),
child: Padding(
padding: const EdgeInsets.all(1.0),
child: Center(
child: controller == null || !controller!.value.isInitialized
? const SizedBox.shrink()
: Stack(
children: [
CameraPreview(controller!),
CameraHistogram(controller: controller!),
],
),
),
),
),
),
IconButton(
icon: const Icon(Icons.camera_alt),
color: Colors.blue,
onPressed: controller != null && controller!.value.isInitialized && !controller!.value.isRecordingVideo
? takePicture
: null,
),
],
),
);
}
Future<void> initialize() async {
try {
final List<CameraDescription> cameras = await availableCameras();
if (cameras.isEmpty) {
return;
}
controller = CameraController(
cameras.firstWhere(
(CameraDescription camera) => camera.lensDirection == CameraLensDirection.back,
orElse: () => cameras.last,
),
ResolutionPreset.low,
enableAudio: false,
);
await controller!.initialize();
await controller!.setFlashMode(FlashMode.off);
setState(() {});
} catch (e) {
log(e.toString());
}
}
Future<XFile?> takePicture() async {
final CameraController? cameraController = controller;
if (cameraController == null || !cameraController.value.isInitialized) {
return null;
}
if (cameraController.value.isTakingPicture) {
// A capture is already pending, do nothing.
return null;
}
try {
await cameraController.setFocusMode(FocusMode.locked);
await cameraController.setExposureMode(ExposureMode.locked);
final XFile file = await cameraController.takePicture();
await cameraController.setFocusMode(FocusMode.auto);
await cameraController.setExposureMode(ExposureMode.auto);
final Uint8List bytes = await file.readAsBytes();
Directory(file.path).deleteSync(recursive: true);
final Map<String, IfdTag> tags = await readExifFromBytes(bytes);
final double? iso = double.tryParse("${tags["EXIF ISOSpeedRatings"]}");
final Ratio? apertureValueRatio = (tags['EXIF FNumber']?.values as IfdRatios?)?.ratios.first;
final Ratio? speedValueRatio = (tags['EXIF ExposureTime']?.values as IfdRatios?)?.ratios.first;
if (iso == null || apertureValueRatio == null || speedValueRatio == null) {
log('Error parsing EXIF: ${tags.keys}');
return null;
}
final double aperture = apertureValueRatio.numerator / apertureValueRatio.denominator;
final double speed = speedValueRatio.numerator / speedValueRatio.denominator;
double log2(num x) => math.log(x) / math.log(2);
final double ev = log2(math.pow(aperture, 2)) - log2(speed) - log2(iso / 100);
showInSnackBar('Photo taken. EV: $ev');
return file;
} on CameraException catch (e) {
log('Error: ${e.code}${e.description == null ? '' : '\nError Message: ${e.description}'}');
return null;
}
}
void showInSnackBar(String message) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(message)));
}
}
class CameraHistogram extends StatefulWidget {
final CameraController controller;
const CameraHistogram({required this.controller, super.key});
@override
_CameraHistogramState createState() => _CameraHistogramState();
}
class _CameraHistogramState extends State<CameraHistogram> {
List<int> histogramR = List.filled(256, 0);
List<int> histogramG = List.filled(256, 0);
List<int> histogramB = List.filled(256, 0);
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
_startImageStream();
});
}
@override
void didUpdateWidget(covariant CameraHistogram oldWidget) {
super.didUpdateWidget(oldWidget);
WidgetsBinding.instance.addPostFrameCallback((_) {
_startImageStream();
});
}
@override
void dispose() {
/// There is no need to stop image stream here,
/// because this widget will be disposed when CameraController is disposed
widget.controller.stopImageStream();
super.dispose();
}
@override
Widget build(BuildContext context) {
return const SizedBox();
}
void _startImageStream() {
widget.controller.startImageStream((CameraImage image) {});
}
}
pubspec.yaml
name: camera_example
description: Demonstrates how to use the camera plugin.
publish_to: none
environment:
sdk: ">=3.0.0 <4.0.0"
dependencies:
camera: 0.10.5+2
exif: 3.1.4
flutter:
sdk: flutter
flutter:
uses-material-design: true
Screenshots or Video
Logs
Logs
Restarted application in 2,457ms.
I/Camera (15651): close
I/Camera (15651): open | onClosed
W/Camera (15651): The selected imageFormatGroup is not supported by Android. Defaulting to yuv420
I/Camera (15651): startPreview
I/Camera (15651): CameraCaptureSession onConfigured
I/Camera (15651): Updating builder settings
D/Camera (15651): Updating builder with feature: ExposureLockFeature
D/Camera (15651): Updating builder with feature: ExposurePointFeature
D/Camera (15651): Updating builder with feature: ZoomLevelFeature
D/Camera (15651): Updating builder with feature: AutoFocusFeature
D/Camera (15651): Updating builder with feature: NoiseReductionFeature
I/Camera (15651): updateNoiseReduction | currentSetting: fast
D/Camera (15651): Updating builder with feature: FocusPointFeature
D/Camera (15651): Updating builder with feature: ResolutionFeature
D/Camera (15651): Updating builder with feature: SensorOrientationFeature
D/Camera (15651): Updating builder with feature: FlashFeature
D/Camera (15651): Updating builder with feature: ExposureOffsetFeature
D/Camera (15651): Updating builder with feature: FpsRangeFeature
I/Camera (15651): refreshPreviewCaptureSession
I/Camera (15651): refreshPreviewCaptureSession
I/Camera (15651): startPreviewWithImageStream
I/Camera (15651): CameraCaptureSession onConfigured
I/Camera (15651): Updating builder settings
D/Camera (15651): Updating builder with feature: ExposureLockFeature
D/Camera (15651): Updating builder with feature: ExposurePointFeature
D/Camera (15651): Updating builder with feature: ZoomLevelFeature
D/Camera (15651): Updating builder with feature: AutoFocusFeature
D/Camera (15651): Updating builder with feature: NoiseReductionFeature
I/Camera (15651): updateNoiseReduction | currentSetting: fast
D/Camera (15651): Updating builder with feature: FocusPointFeature
D/Camera (15651): Updating builder with feature: ResolutionFeature
D/Camera (15651): Updating builder with feature: SensorOrientationFeature
D/Camera (15651): Updating builder with feature: FlashFeature
D/Camera (15651): Updating builder with feature: ExposureOffsetFeature
D/Camera (15651): Updating builder with feature: FpsRangeFeature
I/Camera (15651): refreshPreviewCaptureSession
I/Camera (15651): CameraCaptureSession onClosed
W/1.raster(15651): type=1400 audit(0.0:112468): avc: denied { getattr } for name="/" dev="dmabuf" ino=1 scontext=u:r:untrusted_app_27:s0:c37,c257,c512,c768 tcontext=u:object_r:unlabeled:s0 tclass=filesystem permissive=0 app=io.flutter.plugins.cameraexample
W/1.raster(15651): type=1400 audit(0.0:112469): avc: denied { getattr } for name="/" dev="dmabuf" ino=1 scontext=u:r:untrusted_app_27:s0:c37,c257,c512,c768 tcontext=u:object_r:unlabeled:s0 tclass=filesystem permissive=0 app=io.flutter.plugins.cameraexample
W/1.raster(15651): type=1400 audit(0.0:112470): avc: denied { getattr } for name="/" dev="dmabuf" ino=1 scontext=u:r:untrusted_app_27:s0:c37,c257,c512,c768 tcontext=u:object_r:unlabeled:s0 tclass=filesystem permissive=0 app=io.flutter.plugins.cameraexample
W/1.raster(15651): type=1400 audit(0.0:112471): avc: denied { getattr } for name="/" dev="dmabuf" ino=1 scontext=u:r:untrusted_app_27:s0:c37,c257,c512,c768 tcontext=u:object_r:unlabeled:s0 tclass=filesystem permissive=0 app=io.flutter.plugins.cameraexample
W/1.raster(15651): type=1400 audit(0.0:112472): avc: denied { getattr } for name="/" dev="dmabuf" ino=1 scontext=u:r:untrusted_app_27:s0:c37,c257,c512,c768 tcontext=u:object_r:unlabeled:s0 tclass=filesystem permissive=0 app=io.flutter.plugins.cameraexample
W/System (15651): A resource failed to call Surface.release.
I/Camera (15651): lockAutoFocus
I/Camera (15651): refreshPreviewCaptureSession
I/Camera (15651): runPrecaptureSequence
I/Camera (15651): refreshPreviewCaptureSession
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_START | afState: 2 | aeState: 2
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 2 | aeState: 2
I/Camera (15651): captureStillPicture
D/Camera (15651): Updating builder with feature: ExposureLockFeature
D/Camera (15651): Updating builder with feature: ExposurePointFeature
D/Camera (15651): Updating builder with feature: ZoomLevelFeature
D/Camera (15651): Updating builder with feature: AutoFocusFeature
D/Camera (15651): Updating builder with feature: NoiseReductionFeature
I/Camera (15651): updateNoiseReduction | currentSetting: fast
D/Camera (15651): Updating builder with feature: FocusPointFeature
D/Camera (15651): Updating builder with feature: ResolutionFeature
D/Camera (15651): Updating builder with feature: SensorOrientationFeature
D/Camera (15651): Updating builder with feature: FlashFeature
D/Camera (15651): Updating builder with feature: ExposureOffsetFeature
D/Camera (15651): Updating builder with feature: FpsRangeFeature
I/Camera (15651): sending capture request
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 2 | aeState: 2
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 2 | aeState: 2
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 2 | aeState: 2
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 2 | aeState: 2
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 2 | aeState: 2
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 2 | aeState: 2
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 5 | aeState: 5
I/Camera (15651): onImageAvailable
I/Camera (15651): unlockAutoFocus
I/Camera (15651): refreshPreviewCaptureSession
I/Camera (15651): unlockAutoFocus
I/Camera (15651): refreshPreviewCaptureSession
I/Camera (15651): refreshPreviewCaptureSession
W/1.raster(15651): type=1400 audit(0.0:112473): avc: denied { getattr } for name="/" dev="dmabuf" ino=1 scontext=u:r:untrusted_app_27:s0:c37,c257,c512,c768 tcontext=u:object_r:unlabeled:s0 tclass=filesystem permissive=0 app=io.flutter.plugins.cameraexample
W/System (15651): A resource failed to call Surface.release.
E/System (15651): Uncaught exception thrown by finalizer
E/System (15651): java.util.concurrent.RejectedExecutionException: Task android.hardware.camera2.impl.CallbackProxies$SessionStateCallbackProxy$$ExternalSyntheticLambda0@bdeae47 rejected from java.util.concurrent.ThreadPoolExecutor@8d40674[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 11]
E/System (15651): at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2072)
E/System (15651): at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:834)
E/System (15651): at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1364)
E/System (15651): at java.util.concurrent.Executors$DelegatedExecutorService.execute(Executors.java:644)
E/System (15651): at android.hardware.camera2.impl.CallbackProxies$SessionStateCallbackProxy.onClosed(CallbackProxies.java:104)
E/System (15651): at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:588)
E/System (15651): at android.hardware.camera2.impl.CameraCaptureSessionImpl.finalize(CameraCaptureSessionImpl.java:894)
E/System (15651): at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:319)
E/System (15651): at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:306)
E/System (15651): at java.lang.Daemons$Daemon.run(Daemons.java:140)
E/System (15651): at java.lang.Thread.run(Thread.java:1012)
I/Camera (15651): lockAutoFocus
I/Camera (15651): refreshPreviewCaptureSession
I/Camera (15651): runPrecaptureSequence
I/Camera (15651): refreshPreviewCaptureSession
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_START | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 3 | aeState: 3
I/Camera (15651): captureStillPicture
D/Camera (15651): Updating builder with feature: ExposureLockFeature
D/Camera (15651): Updating builder with feature: ExposurePointFeature
D/Camera (15651): Updating builder with feature: ZoomLevelFeature
D/Camera (15651): Updating builder with feature: AutoFocusFeature
D/Camera (15651): Updating builder with feature: NoiseReductionFeature
I/Camera (15651): updateNoiseReduction | currentSetting: fast
D/Camera (15651): Updating builder with feature: FocusPointFeature
D/Camera (15651): Updating builder with feature: ResolutionFeature
D/Camera (15651): Updating builder with feature: SensorOrientationFeature
D/Camera (15651): Updating builder with feature: FlashFeature
D/Camera (15651): Updating builder with feature: ExposureOffsetFeature
D/Camera (15651): Updating builder with feature: FpsRangeFeature
I/Camera (15651): sending capture request
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
I/Camera (15651): onImageAvailable
I/Camera (15651): unlockAutoFocus
I/Camera (15651): refreshPreviewCaptureSession
I/Camera (15651): unlockAutoFocus
I/Camera (15651): refreshPreviewCaptureSession
I/Camera (15651): refreshPreviewCaptureSession
I/Camera (15651): lockAutoFocus
I/Camera (15651): refreshPreviewCaptureSession
I/Camera (15651): runPrecaptureSequence
I/Camera (15651): refreshPreviewCaptureSession
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_START | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_WAITING_PRECAPTURE_DONE | afState: 3 | aeState: 3
I/Camera (15651): captureStillPicture
D/Camera (15651): Updating builder with feature: ExposureLockFeature
D/Camera (15651): Updating builder with feature: ExposurePointFeature
D/Camera (15651): Updating builder with feature: ZoomLevelFeature
D/Camera (15651): Updating builder with feature: AutoFocusFeature
D/Camera (15651): Updating builder with feature: NoiseReductionFeature
I/Camera (15651): updateNoiseReduction | currentSetting: fast
D/Camera (15651): Updating builder with feature: FocusPointFeature
D/Camera (15651): Updating builder with feature: ResolutionFeature
D/Camera (15651): Updating builder with feature: SensorOrientationFeature
D/Camera (15651): Updating builder with feature: FlashFeature
D/Camera (15651): Updating builder with feature: ExposureOffsetFeature
D/Camera (15651): Updating builder with feature: FpsRangeFeature
I/Camera (15651): sending capture request
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 5 | aeState: 5
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
D/CameraCaptureCallback(15651): CameraCaptureCallback | state: STATE_CAPTURING | afState: 3 | aeState: 3
I/Camera (15651): onImageAvailable
I/Camera (15651): unlockAutoFocus
I/Camera (15651): refreshPreviewCaptureSession
I/Camera (15651): unlockAutoFocus
I/Camera (15651): refreshPreviewCaptureSession
I/Camera (15651): refreshPreviewCaptureSession
Application finished.
Exited
Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.10.0, on macOS 13.4 22F66 darwin-arm64, locale en-BY)
• Flutter version 3.10.0 on channel stable at /Users/vodemn/Development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 84a1e904f4 (4 months ago), 2023-05-09 07:41:44 -0700
• Engine revision d44b5a94c9
• Dart version 3.0.0
• DevTools version 2.23.1
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
• Android SDK at /Users/vodemn/Library/Android/sdk
• Platform android-33, build-tools 33.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14C18
• CocoaPods version 1.12.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.1)
• Android Studio at /Applications/Android Studio.app/Contents
• 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.15+0-b2043.56-8887301)
[✓] VS Code (version 1.81.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.72.0
[✓] Connected device (4 available)
• Pixel 6 (mobile) • 192.168.96.106:38813 • android-arm64 • Android 13 (API 33)
• SM G985F (mobile) • 192.168.96.107:32997 • android-arm64 • Android 13 (API 33)
• macOS (desktop) • macos • darwin-arm64 • macOS 13.4 22F66 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 116.0.5845.179
[✓] Network resources
• All expected network resources are available.Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work liste: device-specificOnly manifests on certain devicesOnly manifests on certain devicesfound in release: 3.13Found to occur in 3.13Found to occur in 3.13found in release: 3.14Found to occur in 3.14Found to occur in 3.14has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: cameraThe camera pluginThe camera pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyAndroid applications specificallyr: solvedIssue is closed as solvedIssue is closed as solvedteam-androidOwned by Android platform teamOwned by Android platform teamtriaged-androidTriaged by Android platform teamTriaged by Android platform team
Type
Projects
- StatusShow more project fields[CONFIRMED] camera_android issues solved by camera_android_camerax

Activity
Karthikeyanarla commentedon Sep 9, 2023
What is meant by overexposure?
Sorry to say. I could not see any difference in your video, at least. Every time. Could you please come again?
rightsaidfred99 commentedon Sep 9, 2023
@Karthikeyanarla , the first image will be completely white because the exposure is wrong
huycozy commentedon Sep 11, 2023
Hi @vodemn
I checked this issue on my device Realme 6, Android 11 but can't see the overexposed as you observed. The EV values are changed a bit between tests but not too much.
Are you seeing this issue on your all devices in
flutter doctoroutput? (SM G985F, Pixel 6) Which is the device modelSM G985F? Do you also see this issue on iOS?Also, can you share the EV values between tests in text format here? Your demo gif above is not quite clear. Thank you!
vodemn commentedon Sep 11, 2023
@huycozy
huycozy commentedon Sep 12, 2023
I can see the issue on
Pixel 7, Android 13as well. The EV values between tests:I also check this on
iPhone 7, iOS 15.7.2but the issue does not appear. Labeling this issue as a device-specific issue on Android. Thanks!Maybe related: #83549
flutter doctor -v (stable and master)
[✓] Flutter (Channel stable, 3.13.3, on macOS 13.5 22G74 darwin-x64, locale en-VN) • Flutter version 3.13.3 on channel stable at /Users/huynq/Documents/GitHub/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 2524052335 (32 hours ago), 2023-09-06 14:32:31 -0700 • Engine revision b8d35810e9 • Dart version 3.1.1 • DevTools version 2.25.0 [✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0) • Android SDK at /Users/huynq/Library/Android/sdk • Platform android-34, build-tools 32.0.0 • ANDROID_HOME = /Users/huynq/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.0) • Xcode at /Applications/Xcode15-beta8.app/Contents/Developer • Build 15A5229m • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2022.2) • Android Studio at /Applications/Android Studio.app/Contents • 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 17.0.6+0-17.0.6b802.4-9586694) [✓] VS Code (version 1.81.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.70.0 [✓] Connected device (4 available) • RMX2001 (mobile) • EUYTFEUSQSRGDA6D • android-arm64 • Android 11 (API 30) • iPhone (mobile) • d9a94afe2b649fef56ba0bfeb052f0f2a7dae95e • ios • iOS 15.7.2 19H218 • macOS (desktop) • macos • darwin-x64 • macOS 13.5 22G74 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 116.0.5845.179 [✓] Network resources • All expected network resources are available. • No issues found!5 remaining items
reidbaker commentedon Sep 18, 2023
Thank you both for trying the camerax plugin and reporting the features that need to be added for you to migrate. Feel free to file features request bugs for camerax so that we have the option of adding the features you need to migrate.
@camsim99 @mariamhas fyi.
aakarapetyan commentedon Dec 8, 2023
We have the same problem. So we really need to migrate to another pub library?
reidbaker commentedon Dec 11, 2023
Locking focus is being worked on in flutter/packages#5285 I do not have an update on the exposure related features at this time.
If you cannot use the camerax implementation and you have this issue you can either submit a pull request to fix the issue in the camera_android implementation or migrate to another pub package. Android camera development is difficult to get right on every camera manufactured and we have made the decision to put our effort into expanding the use of the camerax libraries since that library/team has the focus and mission to make android cameras as reliable as possible.
camsim99 commentedon Dec 13, 2023
That PR is related to locking the capture orientation. However, work on exposure & focus controls is in progress and I will update #120468 and #120467 as I move along :)
camsim99 commentedon Mar 27, 2024
The CameraX implementation of the camera plugin is finished, so we would greatly appreciate it if you try it out to see if it fixes this issue :)
If you find a similar issue with that implementation (or any other issues), please feel free to file a separate issue.
vodemn commentedon Apr 4, 2024
@camsim99 I've rechecked this issue and it still persists
camsim99 commentedon Apr 4, 2024
@vodemn To clarify, with the CameraX plugin being used?
vodemn commentedon Apr 5, 2024
@camsim99 My bad. I've retested this issue today and everything is fine.
Tested on
github-actions commentedon Apr 22, 2024
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 -vand a minimal reproduction of the issue.