Merge "Override app requested orientation when docked." into ics-mr1
This commit is contained in:
@@ -3097,7 +3097,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
sensorRotation = lastRotation;
|
sensorRotation = lastRotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
int preferredRotation = -1;
|
final int preferredRotation;
|
||||||
if (mHdmiPlugged) {
|
if (mHdmiPlugged) {
|
||||||
// Ignore sensor when plugged into HDMI.
|
// Ignore sensor when plugged into HDMI.
|
||||||
preferredRotation = mHdmiRotation;
|
preferredRotation = mHdmiRotation;
|
||||||
@@ -3146,28 +3146,39 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
} else if (mUserRotationMode == WindowManagerPolicy.USER_ROTATION_LOCKED) {
|
} else if (mUserRotationMode == WindowManagerPolicy.USER_ROTATION_LOCKED) {
|
||||||
// Apply rotation lock.
|
// Apply rotation lock.
|
||||||
preferredRotation = mUserRotation;
|
preferredRotation = mUserRotation;
|
||||||
|
} else {
|
||||||
|
// No overriding preference.
|
||||||
|
// We will do exactly what the application asked us to do.
|
||||||
|
preferredRotation = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Sometimes, we might want to override the application-requested
|
|
||||||
// orientation, such as when HDMI is plugged in or when docked.
|
|
||||||
// We can do that by modifying the appropriate cases above to return
|
|
||||||
// the preferred orientation directly instead of continuing on down here.
|
|
||||||
|
|
||||||
switch (orientation) {
|
switch (orientation) {
|
||||||
case ActivityInfo.SCREEN_ORIENTATION_PORTRAIT:
|
case ActivityInfo.SCREEN_ORIENTATION_PORTRAIT:
|
||||||
// Always return portrait if orientation set to portrait.
|
// Return portrait unless overridden.
|
||||||
|
if (isAnyPortrait(preferredRotation)) {
|
||||||
|
return preferredRotation;
|
||||||
|
}
|
||||||
return mPortraitRotation;
|
return mPortraitRotation;
|
||||||
|
|
||||||
case ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE:
|
case ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE:
|
||||||
// Always return landscape if orientation set to landscape.
|
// Return landscape unless overridden.
|
||||||
|
if (isLandscapeOrSeascape(preferredRotation)) {
|
||||||
|
return preferredRotation;
|
||||||
|
}
|
||||||
return mLandscapeRotation;
|
return mLandscapeRotation;
|
||||||
|
|
||||||
case ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT:
|
case ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT:
|
||||||
// Always return portrait if orientation set to portrait.
|
// Return reverse portrait unless overridden.
|
||||||
|
if (isAnyPortrait(preferredRotation)) {
|
||||||
|
return preferredRotation;
|
||||||
|
}
|
||||||
return mUpsideDownRotation;
|
return mUpsideDownRotation;
|
||||||
|
|
||||||
case ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE:
|
case ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE:
|
||||||
// Always return seascape if orientation set to reverse landscape.
|
// Return seascape unless overridden.
|
||||||
|
if (isLandscapeOrSeascape(preferredRotation)) {
|
||||||
|
return preferredRotation;
|
||||||
|
}
|
||||||
return mSeascapeRotation;
|
return mSeascapeRotation;
|
||||||
|
|
||||||
case ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE:
|
case ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE:
|
||||||
|
|||||||
Reference in New Issue
Block a user