Skip to content

[camerax] Retrieve exposure and zoom camera information #3798

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
May 1, 2023

Conversation

camsim99
Copy link
Contributor

@camsim99 camsim99 commented Apr 22, 2023

Implements retrieval of exposure and zoom camera information. Specifically, implements the following:

  • getMinExposureOffset()
  • getMaxExposureOffset()
  • getExposureOffsetStepSize()
  • getMaxZoomLevel()
  • getMinZoomLevel()

Part of flutter/flutter#115846.
Part of flutter/flutter#125371.
Part of flutter/flutter#120468.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

}

@Test
@SuppressWarnings("unchecked")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has to be used because I mock the generic type LiveData, even with the cast.

@camsim99 camsim99 marked this pull request as ready for review May 1, 2023 15:50
public Long getZoomState(@NonNull Long identifier) {
CameraInfo cameraInfo =
(CameraInfo) Objects.requireNonNull(instanceManager.getInstance(identifier));
// TODO(camsim99): Create/return LiveData<ZoomState> once https://github.com/flutter/packages/pull/3419 lands.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will fix this in that PR if this lands first if I have time. Otherwise, I'll file an issue and update this line in that PR.

@camsim99 camsim99 mentioned this pull request May 1, 2023
11 tasks
@@ -269,6 +276,45 @@ class AndroidCameraCameraX extends CameraPlatform {
});
}

/// Gets the minimum supported exposure offset for the selected camera in EV units.
@override
Future<double> getMinExposureOffset(int cameraId) async {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why pass in a cameraId if the value is going to be ignored?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added comments about it not being used. I honestly don't know what the idea was behind passing it to some functions was, even though it's not used. I assume it was included in case any platforms needed access to it? @bparrishMines any insight?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't involved when this feature was added, but I assume that it was included for other platform implementations and to follow the same pattern as the other methods.

@@ -42,14 +51,31 @@ class CameraInfoHostApiImpl extends CameraInfoHostApi {
/// Maintains instances stored to communicate with native language objects.
late final InstanceManager instanceManager;

/// Gets sensor orientation degrees of [CameraInfo].
/// Gets sensor orientation degrees of the specified [CameraInfo] instance.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider linking to the camerax documentation of sensor orientation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the actual class, the documentation is linked, so I'm going to leave as is to avoid redundancy.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the object that dart callers will interact with?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, they'll interact with the CameraInfo object.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class should probably be private, honestly

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, they'll interact with the CameraInfo object.

This is a little confusing since this is camera_info.dart but consider my comment resolved.

Nonblocking for this pr. You might want to consider a pass where you make objects like this private or reduce their scope. After this is published those will be breaking changes.

return;
}

final Range<Integer> exposureCompensationRangeFromState =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should block this PR, but I should move logic like this out of the create methods since they are constructor-adjacent.

@camsim99 camsim99 added the autosubmit Merge PR when tree becomes green via auto submit App label May 1, 2023
@auto-submit auto-submit bot merged commit f163786 into flutter:main May 1, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 2, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request May 2, 2023
flutter/packages@de6131d...f163786

2023-05-01 [email protected] [camerax] Retrieve exposure and zoom camera information (flutter/packages#3798)
2023-05-01 [email protected] Manual roll Flutter from 66fa4c5 to 828a040 (79 revisions) (flutter/packages#3874)
2023-05-01 [email protected] [video_player, google_sign_in] Updates functions without a prototype to avoid deprecation warning (flutter/packages#3873)
2023-05-01 [email protected] [various] Speed up build-examples (flutter/packages#3849)
2023-05-01 [email protected] [file_selector] Remove uses of `macUTIs` (flutter/packages#3859)
2023-05-01 [email protected] [file_selector] Add getDirectoryPaths implementation for macOS (flutter/packages#3703)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
nploi pushed a commit to nploi/packages that referenced this pull request Jul 16, 2023
Implements retrieval of exposure and zoom camera information. Specifically, implements the following:

- `getMinExposureOffset()`
- `getMaxExposureOffset()`
- `getExposureOffsetStepSize()`
- `getMaxZoomLevel()`
- `getMinZoomLevel()`

Part of flutter/flutter#115846.
Part of flutter/flutter#125371.
Part of flutter/flutter#120468.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App p: camera platform-android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants