[camerax] Modifies initialized camera info to reflect default AF/AE modes 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 https://github.com/flutter/packages/pull/6059 so that these values reflect what is actually implemented on our end~ Done :)
This commit is contained in:
Camille Simon
2024-02-21 18:08:05 -05:00
committed by GitHub
parent 83d7fc613e
commit 784190cd59
4 changed files with 13 additions and 15 deletions

View File

@ -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`.

View File

@ -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,

View File

@ -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

View File

@ -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);