[camerax] Add fix for camera preview rotation on landscape-oriented devices and set up fix for Impeller support
Partially lands https://github.com/flutter/packages/pull/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 https://github.com/flutter/packages/pull/6856 and will be turned on when https://github.com/flutter/flutter/issues/149294 is fixed.
Part of https://github.com/flutter/flutter/issues/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 https://github.com/flutter/flutter/issues/149177.
Pre-launch Checklist
- [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [x] I read the Tree Hygiene page, which explains my responsibilities.
- [x] 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.) - [x] I signed the CLA.
- [x] The title of the PR starts with the name of the package surrounded by square brackets, e.g.
[shared_preferences] - [x] I linked to at least one issue that this PR fixes in the description above.
- [x] I updated
pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes. - [x] I updated
CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or this PR is exempt from CHANGELOG changes. - [x] I updated/added relevant documentation (doc comments with
///). - [x] I added new tests to check the change I am making, or this PR is test-exempt.
- [x] All existing and new tests are passing.