am 77216642: Merge "Implement #7341342 API request: way to determine current orientation..." into jb-mr2-dev

* commit '77216642884d5131290803776b0fce4d68128e97':
  Implement #7341342 API request: way to determine current orientation...
This commit is contained in:
Dianne Hackborn
2013-04-11 17:11:21 -07:00
committed by Android Git Automerger
4 changed files with 62 additions and 4 deletions

View File

@@ -6650,7 +6650,9 @@ package android.content.pm {
field public static final int LAUNCH_SINGLE_TOP = 1; // 0x1
field public static final int SCREEN_ORIENTATION_BEHIND = 3; // 0x3
field public static final int SCREEN_ORIENTATION_FULL_SENSOR = 10; // 0xa
field public static final int SCREEN_ORIENTATION_FULL_USER = 13; // 0xd
field public static final int SCREEN_ORIENTATION_LANDSCAPE = 0; // 0x0
field public static final int SCREEN_ORIENTATION_LOCKED = 14; // 0xe
field public static final int SCREEN_ORIENTATION_NOSENSOR = 5; // 0x5
field public static final int SCREEN_ORIENTATION_PORTRAIT = 1; // 0x1
field public static final int SCREEN_ORIENTATION_REVERSE_LANDSCAPE = 8; // 0x8
@@ -6660,6 +6662,8 @@ package android.content.pm {
field public static final int SCREEN_ORIENTATION_SENSOR_PORTRAIT = 7; // 0x7
field public static final int SCREEN_ORIENTATION_UNSPECIFIED = -1; // 0xffffffff
field public static final int SCREEN_ORIENTATION_USER = 2; // 0x2
field public static final int SCREEN_ORIENTATION_USER_LANDSCAPE = 11; // 0xb
field public static final int SCREEN_ORIENTATION_USER_PORTRAIT = 12; // 0xc
field public static final int UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW = 1; // 0x1
field public int configChanges;
field public int flags;

View File

@@ -278,6 +278,30 @@ public class ActivityInfo extends ComponentInfo
*/
public static final int SCREEN_ORIENTATION_FULL_SENSOR = 10;
/**
* Constant corresponding to <code>userLandscape</code> in
* the {@link android.R.attr#screenOrientation} attribute.
*/
public static final int SCREEN_ORIENTATION_USER_LANDSCAPE = 11;
/**
* Constant corresponding to <code>userPortrait</code> in
* the {@link android.R.attr#screenOrientation} attribute.
*/
public static final int SCREEN_ORIENTATION_USER_PORTRAIT = 12;
/**
* Constant corresponding to <code>fullUser</code> in
* the {@link android.R.attr#screenOrientation} attribute.
*/
public static final int SCREEN_ORIENTATION_FULL_USER = 13;
/**
* Constant corresponding to <code>locked</code> in
* the {@link android.R.attr#screenOrientation} attribute.
*/
public static final int SCREEN_ORIENTATION_LOCKED = 14;
/**
* The preferred screen orientation this activity would like to run in.
* From the {@link android.R.attr#screenOrientation} attribute, one of
@@ -292,7 +316,11 @@ public class ActivityInfo extends ComponentInfo
* {@link #SCREEN_ORIENTATION_SENSOR_PORTRAIT},
* {@link #SCREEN_ORIENTATION_REVERSE_LANDSCAPE},
* {@link #SCREEN_ORIENTATION_REVERSE_PORTRAIT},
* {@link #SCREEN_ORIENTATION_FULL_SENSOR}.
* {@link #SCREEN_ORIENTATION_FULL_SENSOR},
* {@link #SCREEN_ORIENTATION_USER_LANDSCAPE},
* {@link #SCREEN_ORIENTATION_USER_PORTRAIT},
* {@link #SCREEN_ORIENTATION_FULL_USER},
* {@link #SCREEN_ORIENTATION_LOCKED},
*/
public int screenOrientation = SCREEN_ORIENTATION_UNSPECIFIED;

View File

@@ -570,7 +570,8 @@
this activity. -->
<enum name="behind" value="3" />
<!-- Orientation is determined by a physical orientation sensor:
the display will rotate based on how the user moves the device. -->
the display will rotate based on how the user moves the device.
Ignores user's setting to turn off sensor-based rotation. -->
<enum name="sensor" value="4" />
<!-- Always ignore orientation determined by orientation sensor:
the display will not rotate when the user moves the device. -->
@@ -593,6 +594,22 @@
the device will normally do (for example some devices won't
normally use 180 degree rotation). -->
<enum name="fullSensor" value="10" />
<!-- Would like to have the screen in landscape orientation, but if
the user has enabled sensor-based rotation then we can use the
sensor to change which direction the screen is facing. -->
<enum name="userLandscape" value="11" />
<!-- Would like to have the screen in portrait orientation, but if
the user has enabled sensor-based rotation then we can use the
sensor to change which direction the screen is facing. -->
<enum name="userPortrait" value="12" />
<!-- Respect the user's sensor-based rotation preference, but if
sensor-based rotation is enabled then allow the screen to rotate
in all 4 possible directions regardless of what
the device will normally do (for example some devices won't
normally use 180 degree rotation). -->
<enum name="fullUser" value="13" />
<!-- Screen is locked to its current rotation, whatever that is. -->
<enum name="locked" value="14" />
</attr>
<!-- Specify one or more configuration changes that the activity will

View File

@@ -4203,9 +4203,15 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// Ignore sensor when plugged into HDMI.
// Note that the dock orientation overrides the HDMI orientation.
preferredRotation = mHdmiRotation;
} else if (orientation == ActivityInfo.SCREEN_ORIENTATION_LOCKED) {
// Application just wants to remain locked in the last rotation.
preferredRotation = lastRotation;
} else if ((mUserRotationMode == WindowManagerPolicy.USER_ROTATION_FREE
&& (orientation == ActivityInfo.SCREEN_ORIENTATION_USER
|| orientation == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED))
|| orientation == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
|| orientation == ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE
|| orientation == ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT
|| orientation == ActivityInfo.SCREEN_ORIENTATION_FULL_USER))
|| orientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR
|| orientation == ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR
|| orientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
@@ -4221,7 +4227,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
if (sensorRotation != Surface.ROTATION_180
|| mAllowAllRotations == 1
|| orientation == ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR) {
|| orientation == ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR
|| orientation == ActivityInfo.SCREEN_ORIENTATION_FULL_USER) {
preferredRotation = sensorRotation;
} else {
preferredRotation = lastRotation;
@@ -4269,6 +4276,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
return mSeascapeRotation;
case ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE:
case ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE:
// Return either landscape rotation.
if (isLandscapeOrSeascape(preferredRotation)) {
return preferredRotation;
@@ -4279,6 +4287,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
return mLandscapeRotation;
case ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT:
case ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT:
// Return either portrait rotation.
if (isAnyPortrait(preferredRotation)) {
return preferredRotation;