Skip to content

Commit

Permalink
[camerax] Modifies initialized camera info to reflect default AF/AE m…
Browse files Browse the repository at this point in the history
…odes and the ability to set focus points for each (#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 #6059 so that these values reflect what is actually implemented on our end~ Done :)
  • Loading branch information
camsim99 authored Feb 21, 2024
1 parent 83d7fc6 commit 784190c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
5 changes: 5 additions & 0 deletions packages/camera/camera_android_camerax/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.5.0+35

* Modifies `CameraInitializedEvent` that is sent when the camera is initialized to indicate that the initial focus
and exposure modes are auto and that developers may set focus and exposure points.

## 0.5.0+34

* Implements `setFocusPoint`, `setExposurePoint`, and `setExposureOffset`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,16 +347,13 @@ class AndroidCameraCameraX extends CameraPlatform {
final ResolutionInfo previewResolutionInfo =
await preview!.getResolutionInfo();

// Retrieve exposure and focus mode configurations:
// TODO(camsim99): Implement support for retrieving exposure mode configuration.
// https://github.com/flutter/flutter/issues/120468
// Mark auto-focus, auto-exposure and setting points for focus & exposure
// as available operations as CameraX does its best across devices to
// support these by default.
const ExposureMode exposureMode = ExposureMode.auto;
const bool exposurePointSupported = false;

// TODO(camsim99): Implement support for retrieving focus mode configuration.
// https://github.com/flutter/flutter/issues/120467
const FocusMode focusMode = FocusMode.auto;
const bool focusPointSupported = false;
const bool exposurePointSupported = true;
const bool focusPointSupported = true;

cameraEventStreamController.add(CameraInitializedEvent(
cameraId,
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera_android_camerax/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: camera_android_camerax
description: Android implementation of the camera plugin using the CameraX library.
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android_camerax
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
version: 0.5.0+34
version: 0.5.0+35

environment:
sdk: ^3.1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -755,19 +755,15 @@ void main() {
startListeningForDeviceOrientationChange: (_, __) {},
);

// TODO(camsim99): Modify this when camera configuration is supported and
// default values no longer being used.
// https://github.com/flutter/flutter/issues/120468
// https://github.com/flutter/flutter/issues/120467
final CameraInitializedEvent testCameraInitializedEvent =
CameraInitializedEvent(
cameraId,
resolutionWidth.toDouble(),
resolutionHeight.toDouble(),
ExposureMode.auto,
false,
true,
FocusMode.auto,
false);
true);

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

0 comments on commit 784190c

Please sign in to comment.