Skip to content

Commit 784190c

Browse files
authored
[camerax] Modifies initialized camera info to reflect default AF/AE modes and the ability to set focus points for each (flutter#6109)
Modifies `CameraInitializedEvent` to 1. Set the initial exposure and focus modes to auto, since CameraX defaults to auto exposure mode and only supports auto focus mode without Camera2 interop 2. Sets the ability to set focus and exposure points to be true, since CameraX supports these by default ~Should land after flutter/packages#6059 so that these values reflect what is actually implemented on our end~ Done :)
1 parent 83d7fc6 commit 784190c

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

packages/camera/camera_android_camerax/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.5.0+35
2+
3+
* Modifies `CameraInitializedEvent` that is sent when the camera is initialized to indicate that the initial focus
4+
and exposure modes are auto and that developers may set focus and exposure points.
5+
16
## 0.5.0+34
27

38
* Implements `setFocusPoint`, `setExposurePoint`, and `setExposureOffset`.

packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -347,16 +347,13 @@ class AndroidCameraCameraX extends CameraPlatform {
347347
final ResolutionInfo previewResolutionInfo =
348348
await preview!.getResolutionInfo();
349349

350-
// Retrieve exposure and focus mode configurations:
351-
// TODO(camsim99): Implement support for retrieving exposure mode configuration.
352-
// https://github.com/flutter/flutter/issues/120468
350+
// Mark auto-focus, auto-exposure and setting points for focus & exposure
351+
// as available operations as CameraX does its best across devices to
352+
// support these by default.
353353
const ExposureMode exposureMode = ExposureMode.auto;
354-
const bool exposurePointSupported = false;
355-
356-
// TODO(camsim99): Implement support for retrieving focus mode configuration.
357-
// https://github.com/flutter/flutter/issues/120467
358354
const FocusMode focusMode = FocusMode.auto;
359-
const bool focusPointSupported = false;
355+
const bool exposurePointSupported = true;
356+
const bool focusPointSupported = true;
360357

361358
cameraEventStreamController.add(CameraInitializedEvent(
362359
cameraId,

packages/camera/camera_android_camerax/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: camera_android_camerax
22
description: Android implementation of the camera plugin using the CameraX library.
33
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android_camerax
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
5-
version: 0.5.0+34
5+
version: 0.5.0+35
66

77
environment:
88
sdk: ^3.1.0

packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -755,19 +755,15 @@ void main() {
755755
startListeningForDeviceOrientationChange: (_, __) {},
756756
);
757757

758-
// TODO(camsim99): Modify this when camera configuration is supported and
759-
// default values no longer being used.
760-
// https://github.com/flutter/flutter/issues/120468
761-
// https://github.com/flutter/flutter/issues/120467
762758
final CameraInitializedEvent testCameraInitializedEvent =
763759
CameraInitializedEvent(
764760
cameraId,
765761
resolutionWidth.toDouble(),
766762
resolutionHeight.toDouble(),
767763
ExposureMode.auto,
768-
false,
764+
true,
769765
FocusMode.auto,
770-
false);
766+
true);
771767

772768
// Call createCamera.
773769
when(mockPreview.setSurfaceProvider()).thenAnswer((_) async => cameraId);

0 commit comments

Comments
 (0)