Skip to content
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

[camerax] Add fix for camera preview rotation on landscape-oriented devices and set up fix for Impeller support #7044

Merged
merged 25 commits into from
Jul 5, 2024

Conversation

camsim99
Copy link
Contributor

@camsim99 camsim99 commented Jul 2, 2024

Partially lands #6856. This PR specifically includes:

1: A fix for correctly rotating the camera preview

This fix is required for Surfaces not backed by a SurfaceTexture because they don't contain the transformation information needed to correctly rotate the camera preview. In that case, we use the logic described in https://developer.android.com/media/camera/camera2/camera-preview#orientation_calculation.

The fix is not currently used (the logic is not reachable) as Impeller support has not been added back to the plugin, but has been tested in #6856 and will be turned on when flutter/flutter#149294 is fixed.

Part of flutter/flutter#149294.

2: A fix for correctly rotating the camera preview on naturally landscape-oriented devices

I believe this issue was caused because we assume that the natural orientation of the device is portrait up. We fix this here by adding an extra rotation for the camera preview based on the natural orientation of the device.

Fixes flutter/flutter#149177.

Pre-launch Checklist

@camsim99 camsim99 marked this pull request as ready for review July 2, 2024 19:16
@camsim99 camsim99 requested a review from matanlurey as a code owner July 2, 2024 19:16
_subscriptionForDeviceOrientationChanges = onDeviceOrientationChanged()
.listen((DeviceOrientationChangedEvent event) {
currentDeviceOrientation = event.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.

@matanlurey if you have a suggestion as to how to make these run in parallel, do let me know!

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I didn't notice you already had Future.wait, honestly this is fine. LGTM.

_subscriptionForDeviceOrientationChanges = onDeviceOrientationChanged()
.listen((DeviceOrientationChangedEvent event) {
currentDeviceOrientation = event.orientation;
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I didn't notice you already had Future.wait, honestly this is fine. LGTM.

@camsim99 camsim99 added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 5, 2024
@auto-submit auto-submit bot merged commit 97bad7e into flutter:main Jul 5, 2024
74 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 5, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 5, 2024
…#151350)

flutter/packages@754de19...97bad7e

2024-07-05 43054281 [email protected] [camerax] Add fix for camera preview rotation on landscape-oriented devices and set up fix for Impeller support (flutter/packages#7044)

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://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/ doc/main/autoroll/README.md
TahaTesser pushed a commit to TahaTesser/flutter that referenced this pull request Jul 8, 2024
…#151350)

flutter/packages@754de19...97bad7e

2024-07-05 43054281 [email protected] [camerax] Add fix for camera preview rotation on landscape-oriented devices and set up fix for Impeller support (flutter/packages#7044)

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://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/ doc/main/autoroll/README.md
victorsanni pushed a commit to victorsanni/flutter that referenced this pull request Jul 8, 2024
…#151350)

flutter/packages@754de19...97bad7e

2024-07-05 43054281 [email protected] [camerax] Add fix for camera preview rotation on landscape-oriented devices and set up fix for Impeller support (flutter/packages#7044)

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://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/ doc/main/autoroll/README.md
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
2 participants