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
committerArne Coucheron <arco68@gmail.com>2018-01-26 00:51:22 +0100
commitb9afe5c37966869e29d996d981dacf7765195fca (patch)
treec643b1e8816e3681cfe9e7a5d57e1856c79dc351 /src/com/android/camera/util
parentfdd617e703a5174bf37d1f1be17f872ccf3bf229 (diff)
downloadandroid_packages_apps_Snap-b9afe5c37966869e29d996d981dacf7765195fca.tar.gz
android_packages_apps_Snap-b9afe5c37966869e29d996d981dacf7765195fca.tar.bz2
android_packages_apps_Snap-b9afe5c37966869e29d996d981dacf7765195fca.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 618bf2a8d..5954b6e41 100644
--- a/src/com/android/camera/util/CameraUtil.java
+++ b/src/com/android/camera/util/CameraUtil.java
@@ -469,6 +469,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)