From 892bd76881e2df9b4915a30144efc5428f7ab5a3 Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Sun, 23 Jan 2011 13:05:44 -0800 Subject: [PATCH] Fix SENSOR_LANDSCAPE and SENSOR_PORTRAIT Fixed a bug in the handling of SENSOR_LANDSCAPE and SENSOR_PORTAIT on devices that have a natural landscape orientation. The old code was disabling 180 degree orientation detection when it shouldn't have. Change-Id: I484a0aa44b3b8267a7d3b74bdf39c296faa7c6e3 --- .../android/internal/policy/impl/PhoneWindowManager.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 747242f468cf2..0d0e89cc86de2 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -2481,10 +2481,12 @@ public class PhoneWindowManager implements WindowManagerPolicy { return mSeascapeRotation; case ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE: //return either landscape rotation based on the sensor - mOrientationListener.setAllow180Rotation(false); + mOrientationListener.setAllow180Rotation( + isLandscapeOrSeascape(Surface.ROTATION_180)); return getCurrentLandscapeRotation(lastRotation); case ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT: - mOrientationListener.setAllow180Rotation(true); + mOrientationListener.setAllow180Rotation( + !isLandscapeOrSeascape(Surface.ROTATION_180)); return getCurrentPortraitRotation(lastRotation); }