From 1b58b3ebeee8624f9f1e3c93eeb6d2c5a4d176b9 Mon Sep 17 00:00:00 2001 From: Joe Onorato Date: Tue, 22 Sep 2009 16:44:16 -0700 Subject: [PATCH] The nosensor flag wasn't being honored. --- .../policy/impl/PhoneWindowManager.java | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/policy/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/com/android/internal/policy/impl/PhoneWindowManager.java index 032e1f41d34c6..59283a23bcea7 100644 --- a/policy/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/com/android/internal/policy/impl/PhoneWindowManager.java @@ -321,18 +321,27 @@ public class PhoneWindowManager implements WindowManagerPolicy { MyOrientationListener mOrientationListener; boolean useSensorForOrientationLp(int appOrientation) { + // The app says use the sensor. if (appOrientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR) { return true; } - if ((mAccelerometerDefault != 0 || - (mCarDockEnablesAccelerometer && mDockState == Intent.EXTRA_DOCK_STATE_CAR) || - (mDeskDockEnablesAccelerometer && mDockState == Intent.EXTRA_DOCK_STATE_DESK)) - && (appOrientation == ActivityInfo.SCREEN_ORIENTATION_USER || - // dock overrides SCREEN_ORIENTATION_NOSENSOR - appOrientation == ActivityInfo. SCREEN_ORIENTATION_NOSENSOR || - appOrientation == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)) { + // The user preference says we can rotate, and the app is willing to rotate. + if (mAccelerometerDefault != 0 && + (appOrientation == ActivityInfo.SCREEN_ORIENTATION_USER + || appOrientation == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)) { return true; } + // We're in a dock that has a rotation affinity, an the app is willing to rotate. + if ((mCarDockEnablesAccelerometer && mDockState == Intent.EXTRA_DOCK_STATE_CAR) + || (mDeskDockEnablesAccelerometer && mDockState == Intent.EXTRA_DOCK_STATE_DESK)) { + // Note we override the nosensor flag here. + if (appOrientation == ActivityInfo.SCREEN_ORIENTATION_USER + || appOrientation == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED + || appOrientation == ActivityInfo.SCREEN_ORIENTATION_NOSENSOR) { + return true; + } + } + // Else, don't use the sensor. return false; }