summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2011-01-24 15:33:46 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2011-01-24 15:33:46 -0800
commiteebc944fd13099945b04a99f15173cdaada1ecf2 (patch)
tree92b743098b7d53fbf6422aa8981b48fa0724d8a1 /policy
parentf6e7d592224851b7d623180bb2ea780234580cee (diff)
parentaaa55d3f45744814907d0809befb49281ced462e (diff)
downloadframeworks_base-eebc944fd13099945b04a99f15173cdaada1ecf2.zip
frameworks_base-eebc944fd13099945b04a99f15173cdaada1ecf2.tar.gz
frameworks_base-eebc944fd13099945b04a99f15173cdaada1ecf2.tar.bz2
am aaa55d3f: Merge "New orientation listener." into honeycomb
* commit 'aaa55d3f45744814907d0809befb49281ced462e': New orientation listener.
Diffstat (limited to 'policy')
-rwxr-xr-xpolicy/src/com/android/internal/policy/impl/PhoneWindowManager.java23
1 files changed, 15 insertions, 8 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 67e0e67..9b5c42e 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -389,6 +389,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
resolver.registerContentObserver(Settings.System.getUriFor(
Settings.System.SCREEN_OFF_TIMEOUT), false, this);
resolver.registerContentObserver(Settings.System.getUriFor(
+ Settings.System.WINDOW_ORIENTATION_LISTENER_LOG), false, this);
+ resolver.registerContentObserver(Settings.System.getUriFor(
Settings.System.POINTER_LOCATION), false, this);
resolver.registerContentObserver(Settings.Secure.getUriFor(
Settings.Secure.DEFAULT_INPUT_METHOD), false, this);
@@ -759,6 +761,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
updateOrientationListenerLp();
}
+ mOrientationListener.setLogEnabled(
+ Settings.System.getInt(resolver,
+ Settings.System.WINDOW_ORIENTATION_LISTENER_LOG, 0) != 0);
+
if (mSystemReady) {
int pointerLocation = Settings.System.getInt(resolver,
Settings.System.POINTER_LOCATION, 0);
@@ -2492,18 +2498,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
return mSeascapeRotation;
case ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE:
//return either landscape rotation based on the sensor
- mOrientationListener.setAllow180Rotation(
- isLandscapeOrSeascape(Surface.ROTATION_180));
return getCurrentLandscapeRotation(lastRotation);
case ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT:
- mOrientationListener.setAllow180Rotation(
- !isLandscapeOrSeascape(Surface.ROTATION_180));
return getCurrentPortraitRotation(lastRotation);
}
- mOrientationListener.setAllow180Rotation(mAllowAllRotations ||
- orientation == ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
-
// case for nosensor meaning ignore sensor and consider only lid
// or orientation sensor disabled
//or case.unspecified
@@ -2519,7 +2518,15 @@ public class PhoneWindowManager implements WindowManagerPolicy {
return mUserRotation;
} else {
if (useSensorForOrientationLp(orientation)) {
- return mOrientationListener.getCurrentRotation(lastRotation);
+ // Disable 180 degree rotation unless allowed by default for the device
+ // or explicitly requested by the application.
+ int rotation = mOrientationListener.getCurrentRotation(lastRotation);
+ if (rotation == Surface.ROTATION_180
+ && !mAllowAllRotations
+ && orientation != ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR) {
+ return lastRotation;
+ }
+ return rotation;
}
return Surface.ROTATION_0;
}