summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorweijiew <weijiew@codeaurora.org>2016-09-08 10:59:12 +0800
committerMichael Bestas <mikeioannina@gmail.com>2017-01-04 22:00:41 +0200
commit502f8a8789299725c4bba1c6ee661bd84aaa4323 (patch)
treebb5aacfb389548cddbd5cd0838add8cd647c807b
parent78d79c7db51c5142066c669ecc614c5f9e87b490 (diff)
downloadandroid_packages_apps_Snap-502f8a8789299725c4bba1c6ee661bd84aaa4323.tar.gz
android_packages_apps_Snap-502f8a8789299725c4bba1c6ee661bd84aaa4323.tar.bz2
android_packages_apps_Snap-502f8a8789299725c4bba1c6ee661bd84aaa4323.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;
}