From 3abc7511b881e3fcc3de8c8c87093bd661bd0f91 Mon Sep 17 00:00:00 2001 From: Emilian Peev Date: Wed, 28 Mar 2018 11:22:26 +0100 Subject: [PATCH] Camera: Update external camera orientation guidelines The external camera orientation and facing should not be used for the jpeg orientation calculation. Bug: 72261912 Test: Android compiles without errors Change-Id: I552c09ae8dada2122396128011f7b82a9889e126 --- core/java/android/hardware/camera2/CaptureRequest.java | 6 ++++-- core/java/android/hardware/camera2/CaptureResult.java | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java index b0cbec71dfe6a..982e79cf20314 100644 --- a/core/java/android/hardware/camera2/CaptureRequest.java +++ b/core/java/android/hardware/camera2/CaptureRequest.java @@ -2105,8 +2105,8 @@ public final class CaptureRequest extends CameraMetadata> * the thumbnail data will also be rotated.

*

Note that this orientation is relative to the orientation of the camera sensor, given * by {@link CameraCharacteristics#SENSOR_ORIENTATION android.sensor.orientation}.

- *

To translate from the device orientation given by the Android sensor APIs, the following - * sample code may be used:

+ *

To translate from the device orientation given by the Android sensor APIs for camera + * sensors which are not EXTERNAL, the following sample code may be used:

*
private int getJpegOrientation(CameraCharacteristics c, int deviceOrientation) {
      *     if (deviceOrientation == android.view.OrientationEventListener.ORIENTATION_UNKNOWN) return 0;
      *     int sensorOrientation = c.get(CameraCharacteristics.SENSOR_ORIENTATION);
@@ -2125,6 +2125,8 @@ public final class CaptureRequest extends CameraMetadata>
      *     return jpegOrientation;
      * }
      * 
+ *

For EXTERNAL cameras the sensor orientation will always be set to 0 and the facing will + * also be set to EXTERNAL. The above code is not relevant in such case.

*

Units: Degrees in multiples of 90

*

Range of valid values:
* 0, 90, 180, 270

diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java index 633194243512f..a09d72182c07d 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -2422,8 +2422,8 @@ public class CaptureResult extends CameraMetadata> { * the thumbnail data will also be rotated.

*

Note that this orientation is relative to the orientation of the camera sensor, given * by {@link CameraCharacteristics#SENSOR_ORIENTATION android.sensor.orientation}.

- *

To translate from the device orientation given by the Android sensor APIs, the following - * sample code may be used:

+ *

To translate from the device orientation given by the Android sensor APIs for camera + * sensors which are not EXTERNAL, the following sample code may be used:

*
private int getJpegOrientation(CameraCharacteristics c, int deviceOrientation) {
      *     if (deviceOrientation == android.view.OrientationEventListener.ORIENTATION_UNKNOWN) return 0;
      *     int sensorOrientation = c.get(CameraCharacteristics.SENSOR_ORIENTATION);
@@ -2442,6 +2442,8 @@ public class CaptureResult extends CameraMetadata> {
      *     return jpegOrientation;
      * }
      * 
+ *

For EXTERNAL cameras the sensor orientation will always be set to 0 and the facing will + * also be set to EXTERNAL. The above code is not relevant in such case.

*

Units: Degrees in multiples of 90

*

Range of valid values:
* 0, 90, 180, 270