diff options
| author | Daniel Sandler <dsandler@google.com> | 2010-11-04 14:15:56 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-11-04 14:15:56 -0700 |
| commit | 084f3ae952da2fa173a88ecdcd8055154e2683ec (patch) | |
| tree | 8b3077f0e6d44ea059a586228b58c20cdba98054 /core/java | |
| parent | 43f40fe968f5437c67887c40fdd05716106690f4 (diff) | |
| parent | b73617de462579f7c12c25a4c2747c576f00f6a2 (diff) | |
Merge "Rotation lock."
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/provider/Settings.java | 11 | ||||
| -rw-r--r-- | core/java/android/view/IWindowManager.aidl | 13 | ||||
| -rw-r--r-- | core/java/android/view/WindowManagerPolicy.java | 17 |
3 files changed, 41 insertions, 0 deletions
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 2229964a16fd..9c72dec7d29b 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -1573,6 +1573,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, diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl index d4dd05c19adc..a54f342b65bd 100644 --- a/core/java/android/view/IWindowManager.aidl +++ b/core/java/android/view/IWindowManager.aidl @@ -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(); } diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java index 1a341e11d8b8..e78d6a8cd8cc 100644 --- a/core/java/android/view/WindowManagerPolicy.java +++ b/core/java/android/view/WindowManagerPolicy.java @@ -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); } |
