You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[camerax] Add fix for camera preview rotation on landscape-oriented devices and set up fix for Impeller support (flutter#7044)
Partially lands flutter/packages#6856. This PR specifically includes:
#### 1: A fix for correctly rotating the camera preview
This fix is required for `Surface`s 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 flutter/packages#6856 and will be turned on when flutter#149294 is fixed.
Part of 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.
Fixesflutter#149177.
Copy file name to clipboardExpand all lines: packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/Camera2CameraInfoHostApiImpl.java
+13-3
Original file line number
Diff line number
Diff line change
@@ -29,26 +29,30 @@ public class Camera2CameraInfoHostApiImpl implements Camera2CameraInfoHostApi {
29
29
30
30
/** Proxy for methods of {@link Camera2CameraInfo}. */
Copy file name to clipboardExpand all lines: packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java
Copy file name to clipboardExpand all lines: packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java
+9-1
Original file line number
Diff line number
Diff line change
@@ -95,7 +95,8 @@ public void stopListeningForDeviceOrientationChange() {
95
95
* for instance for more information on how this default value is used.
Copy file name to clipboardExpand all lines: packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java
Copy file name to clipboardExpand all lines: packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/SystemServicesHostApiImpl.java
Copy file name to clipboardExpand all lines: packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerWrapperTest.java
+12
Original file line number
Diff line number
Diff line change
@@ -93,4 +93,16 @@ public void getDefaultDisplayRotation_returnsExpectedRotation() {
Copy file name to clipboardExpand all lines: packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/SystemServicesTest.java
0 commit comments