summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
authorSteve Howard <showard@google.com>2010-08-16 11:41:58 -0700
committerSteve Howard <showard@google.com>2010-08-18 14:22:19 -0700
commit5eb49583e2f0b82d7a48182ffed5f409b4f85dc5 (patch)
tree2c91210ef2921794ac55e7488accb1cc2e6138c2 /policy
parentbaf3869b88ab4e31f792dbe08f61725bc3619ea8 (diff)
downloadframeworks_base-5eb49583e2f0b82d7a48182ffed5f409b4f85dc5.zip
frameworks_base-5eb49583e2f0b82d7a48182ffed5f409b4f85dc5.tar.gz
frameworks_base-5eb49583e2f0b82d7a48182ffed5f409b4f85dc5.tar.bz2
Improve orientation sensing when waking up while flat.
This change makes the window manager pass the currently displayed orientation to the WindowOrientationListener each time to calls to get the currently sensed orientation. Now, when the WindowOrientationListener doesn't know for sure what the orientation of the device should be (for example, if the sensed orientation is flat on a table), then it trusts the already-displayed orientation, rather than trusting whatever sensors reading it most recently received. The main use case this addresses is: * user uses device in portrait * user turns off device, puts it in pocket * while in pocket, screen gets turned on, activating orientaiton sensor, which senses landscape orientation * screen timed out * user takes device out, places it on a table (or looks down at it, holding it flat), and unlocks it Previously, when the device was unlocked, the WindowOrientationListener would return landscape orientation based on its previous sensor readings. Now, it will override those previous readings because it knows they never actually took effect and the device is presently flat. This change also slightly modifies the way we handle flat orientation, now completely ignoring data when the tilt distrust is nonzero (even if the current sensor reading shows non-tilted). Change-Id: Ia4950a41827f8c53a80487d0c2e83b556df781b9
Diffstat (limited to 'policy')
-rwxr-xr-xpolicy/src/com/android/internal/policy/impl/PhoneWindowManager.java4
1 files changed, 1 insertions, 3 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index e2e6f1a..274124b 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -2076,9 +2076,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
return mDeskDockRotation;
} else {
if (useSensorForOrientationLp(orientation)) {
- // If the user has enabled auto rotation by default, do it.
- int curRotation = mOrientationListener.getCurrentRotation();
- return curRotation >= 0 ? curRotation : lastRotation;
+ return mOrientationListener.getCurrentRotation(lastRotation);
}
return Surface.ROTATION_0;
}