diff options
author | weijiew <weijiew@codeaurora.org> | 2016-09-08 10:59:12 +0800 |
---|---|---|
committer | weijiew <weijiew@codeaurora.org> | 2016-09-08 11:17:12 +0800 |
commit | 7ce697009dd1d29154a38bf78f37d6a8e9232c8e (patch) | |
tree | aa0c9a2847c89cf82652eadd6a7a9013a5f70e64 /src/com/android/camera/util | |
parent | 9159ebde9c1bc74e531bd0cc5e7e9379d1d235e6 (diff) | |
download | android_packages_apps_Snap-7ce697009dd1d29154a38bf78f37d6a8e9232c8e.tar.gz android_packages_apps_Snap-7ce697009dd1d29154a38bf78f37d6a8e9232c8e.tar.bz2 android_packages_apps_Snap-7ce697009dd1d29154a38bf78f37d6a8e9232c8e.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
Diffstat (limited to 'src/com/android/camera/util')
-rw-r--r-- | src/com/android/camera/util/CameraUtil.java | 15 |
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 172a54582..524595bcc 100644 --- a/src/com/android/camera/util/CameraUtil.java +++ b/src/com/android/camera/util/CameraUtil.java @@ -842,13 +842,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; } |