summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorweijiew <weijiew@codeaurora.org>2016-09-08 10:59:12 +0800
committerSteve Kondik <steve@cyngn.com>2016-11-13 23:48:27 -0800
commit14dface2f352ed0dc815884d18e22ef79dfcbbbf (patch)
treec857ec2c33dc9b3fd48d2c7e5fcae121f4c843ab
parentd5211e7b1efb8b3c64a302fbe79799f353e272a1 (diff)
downloadandroid_packages_apps_Snap-14dface2f352ed0dc815884d18e22ef79dfcbbbf.tar.gz
android_packages_apps_Snap-14dface2f352ed0dc815884d18e22ef79dfcbbbf.tar.bz2
android_packages_apps_Snap-14dface2f352ed0dc815884d18e22ef79dfcbbbf.zip
SnapdragonCamera: Pictures were rotated when the device is in flat position
Normally, the picture taken by front camera needs to rotate 270 degree and the picture taken by rear camera needs to rotate 90 degree. Launch camera app when the device is in a close to flat position, camera app can’t get device’s orientation. The picture will not be rotated when the orientation is unknown. Change-Id: I41d19f162f28aa6838b0246f14475480c8703e06 CRs-Fixed: 1063452
-rw-r--r--src/com/android/camera/util/CameraUtil.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/com/android/camera/util/CameraUtil.java b/src/com/android/camera/util/CameraUtil.java
index 5af83bcf9..bda83a1d9 100644
--- a/src/com/android/camera/util/CameraUtil.java
+++ b/src/com/android/camera/util/CameraUtil.java
@@ -882,13 +882,14 @@ public class CameraUtil {
// See android.hardware.Camera.Parameters.setRotation for
// documentation.
int rotation = 0;
- if (orientation != OrientationEventListener.ORIENTATION_UNKNOWN) {
- CameraInfo info = CameraHolder.instance().getCameraInfo()[cameraId];
- if (info.facing == CameraInfo.CAMERA_FACING_FRONT) {
- rotation = (info.orientation - orientation + 360) % 360;
- } else { // back-facing camera
- rotation = (info.orientation + orientation) % 360;
- }
+ if (orientation == OrientationEventListener.ORIENTATION_UNKNOWN) {
+ orientation = 0;
+ }
+ CameraInfo info = CameraHolder.instance().getCameraInfo()[cameraId];
+ if (info.facing == CameraInfo.CAMERA_FACING_FRONT) {
+ rotation = (info.orientation - orientation + 360) % 360;
+ } else { // back-facing camera
+ rotation = (info.orientation + orientation) % 360;
}
return rotation;
}