DO NOT MERGE libcameraservice: Provide flag for overriding camera output to portrait.
Apps commonly do not handle landscape orientation cameras correctly. In
order to prevent stretching and rotation issues in these apps, this
patch adds a flag to override the behavior of these landscape cameras
to produce a portrait image instead by changing the SENSOR_ORIENTATION
reported by CameraCharacteristics and applying a 90 degree rotate and
crop.
Change-Id: I64ed52812326edc11f1cdb6bfbdbe75fcb8b1fb8
Bug: 250678880
Test: Ran on foldable device with several camera apps to verify behavior.
diff --git a/camera/aidl/android/hardware/ICameraService.aidl b/camera/aidl/android/hardware/ICameraService.aidl
index 1e748c7..01baba1 100644
--- a/camera/aidl/android/hardware/ICameraService.aidl
+++ b/camera/aidl/android/hardware/ICameraService.aidl
@@ -67,7 +67,7 @@
/**
* Fetch basic camera information for a camera device
*/
- CameraInfo getCameraInfo(int cameraId);
+ CameraInfo getCameraInfo(int cameraId, boolean overrideToPortrait);
/**
* Default UID/PID values for non-privileged callers of
@@ -83,7 +83,8 @@
int cameraId,
String opPackageName,
int clientUid, int clientPid,
- int targetSdkVersion);
+ int targetSdkVersion,
+ boolean overrideToPortrait);
/**
* Open a camera device through the new camera API
@@ -94,7 +95,8 @@
String opPackageName,
@nullable String featureId,
int clientUid, int oomScoreOffset,
- int targetSdkVersion);
+ int targetSdkVersion,
+ boolean overrideToPortrait);
/**
* Add listener for changes to camera device and flashlight state.
@@ -135,7 +137,8 @@
* Read the static camera metadata for a camera device.
* Only supported for device HAL versions >= 3.2
*/
- CameraMetadataNative getCameraCharacteristics(String cameraId, int targetSdkVersion);
+ CameraMetadataNative getCameraCharacteristics(String cameraId, int targetSdkVersion,
+ boolean overrideToPortrait);
/**
* Read in the vendor tag descriptors from the camera module HAL.