summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/util
diff options
context:
space:
mode:
authorPawit Pornkitprasan <p.pawit@gmail.com>2013-12-28 13:47:57 +0700
committerMichael Bestas <mikeioannina@gmail.com>2017-01-04 21:57:36 +0200
commit2a671f0626f710bf7494de5a2b765231a2a4ddf4 (patch)
tree299705dad911696fb3158fd2ad1286bf131e6c93 /src/com/android/camera/util
parent6278af426fc933837cf6a2f66defce951695b8c8 (diff)
downloadandroid_packages_apps_Snap-2a671f0626f710bf7494de5a2b765231a2a4ddf4.tar.gz
android_packages_apps_Snap-2a671f0626f710bf7494de5a2b765231a2a4ddf4.tar.bz2
android_packages_apps_Snap-2a671f0626f710bf7494de5a2b765231a2a4ddf4.zip
Camera: fix preview for landscape devices
Landscape devices have broken preview because PORTRAIT mode is being abused to check for screen rotation. Use proper rotation check to fix. Ported from cm-10.2 Change-Id: I75588cbce9843e180e4be7591f6a43bcec788506
Diffstat (limited to 'src/com/android/camera/util')
-rw-r--r--src/com/android/camera/util/CameraUtil.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/com/android/camera/util/CameraUtil.java b/src/com/android/camera/util/CameraUtil.java
index 705e94924..4299dd6c8 100644
--- a/src/com/android/camera/util/CameraUtil.java
+++ b/src/com/android/camera/util/CameraUtil.java
@@ -439,6 +439,12 @@ public class CameraUtil {
return 0;
}
+ public static boolean isScreenRotated(Activity activity) {
+ int rotation = activity.getWindowManager().getDefaultDisplay()
+ .getRotation();
+ return rotation != Surface.ROTATION_0 && rotation != Surface.ROTATION_180;
+ }
+
/**
* Calculate the default orientation of the device based on the width and
* height of the display when rotation = 0 (i.e. natural width and height)