Merge "Rotation lock."

This commit is contained in:
Daniel Sandler
2010-11-04 14:15:56 -07:00
committed by Android (Google) Code Review
15 changed files with 234 additions and 2 deletions

View File

@@ -1572,6 +1572,16 @@ public final class Settings {
*/
public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation";
/**
* Default screen rotation when no other policy applies.
* When {@link #ACCELEROMETER_ROTATION} is zero and no on-screen Activity expresses a
* preference, this rotation value will be used. Must be one of the
* {@link android.view.Surface#ROTATION_0 Surface rotation constants}.
*
* @see Display#getRotation
*/
public static final String USER_ROTATION = "user_rotation";
/**
* Whether the audible DTMF tones are played by the dialer when dialing. The value is
* boolean (1 or 0).
@@ -1806,6 +1816,7 @@ public final class Settings {
TIME_12_24,
DATE_FORMAT,
ACCELEROMETER_ROTATION,
USER_ROTATION,
DTMF_TONE_WHEN_DIALING,
DTMF_TONE_TYPE_WHEN_DIALING,
EMERGENCY_TONE,

View File

@@ -156,4 +156,17 @@ interface IWindowManager
* calls back when it changes.
*/
int watchRotation(IRotationWatcher watcher);
/**
* Lock the device orientation to the current rotation. Sensor input will
* be ignored until thawRotation() is called.
* @hide
*/
void freezeRotation();
/**
* Release the orientation lock imposed by freezeRotation().
* @hide
*/
void thawRotation();
}

View File

@@ -362,6 +362,13 @@ public interface WindowManagerPolicy {
* modify the rotation.
*/
public final int USE_LAST_ROTATION = -1000;
/** When not otherwise specified by the activity's screenOrientation, rotation should be
* determined by the system (that is, using sensors). */
public final int USER_ROTATION_FREE = 0;
/** When not otherwise specified by the activity's screenOrientation, rotation is set by
* the user. */
public final int USER_ROTATION_LOCKED = 1;
/**
* Perform initialization of the policy.
@@ -787,4 +794,14 @@ public interface WindowManagerPolicy {
* Return false to disable key repeat events from being generated.
*/
public boolean allowKeyRepeat();
/**
* Inform the policy that the user has chosen a preferred orientation ("rotation lock").
*
* @param mode One of {@link WindowManagerPolicy#USER_ROTATION_LOCKED} or
* {@link * WindowManagerPolicy#USER_ROTATION_FREE}.
* @param rotation One of {@link Surface#ROTATION_0}, {@link Surface#ROTATION_90},
* {@link Surface#ROTATION_180}, {@link Surface#ROTATION_270}.
*/
public void setUserRotationMode(int mode, int rotation);
}