Merge "Rotation lock fix for sensor{Landscape,Portrait} activities."
This commit is contained in:
committed by
Android (Google) Code Review
commit
ad788884de
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user