Merge "Rotation lock fix for sensor{Landscape,Portrait} activities."

This commit is contained in:
Daniel Sandler
2011-02-23 06:43:16 -08:00
committed by Android (Google) Code Review

View File

@@ -2570,6 +2570,16 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
private int getCurrentLandscapeRotation(int lastRotation) {
// if the user has locked rotation, we ignore the sensor
if (mUserRotationMode == WindowManagerPolicy.USER_ROTATION_LOCKED) {
if (isLandscapeOrSeascape(mUserRotation)) {
return mUserRotation;
} else {
// it seems odd to obey the sensor at all if rotation lock is enabled
return mLandscapeRotation;
}
}
int sensorRotation = mOrientationListener.getCurrentRotation(lastRotation);
if (isLandscapeOrSeascape(sensorRotation)) {
return sensorRotation;
@@ -2587,6 +2597,16 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
private int getCurrentPortraitRotation(int lastRotation) {
// if the user has locked rotation, we ignore the sensor
if (mUserRotationMode == WindowManagerPolicy.USER_ROTATION_LOCKED) {
if (isAnyPortrait(mUserRotation)) {
return mUserRotation;
} else {
// it seems odd to obey the sensor at all if rotation lock is enabled
return mPortraitRotation;
}
}
int sensorRotation = mOrientationListener.getCurrentRotation(lastRotation);
if (isAnyPortrait(sensorRotation)) {
return sensorRotation;