diff options
| -rw-r--r-- | core/java/android/view/IWindowManager.aidl | 8 | ||||
| -rwxr-xr-x | core/java/android/view/WindowOrientationListener.java | 6 | ||||
| -rw-r--r-- | services/java/com/android/server/WindowManagerService.java | 24 |
3 files changed, 20 insertions, 18 deletions
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl index 15e7eb2269d3..5607d4bb6783 100644 --- a/core/java/android/view/IWindowManager.aidl +++ b/core/java/android/view/IWindowManager.aidl @@ -59,6 +59,8 @@ interface IWindowManager void pauseKeyDispatching(IBinder token); void resumeKeyDispatching(IBinder token); void setEventDispatching(boolean enabled); + void addWindowToken(IBinder token, int type); + void removeWindowToken(IBinder token); void addAppToken(int addPos, IApplicationToken token, int groupId, int requestedOrientation, boolean fullscreen); void setAppGroupId(IBinder token, int groupId); @@ -81,8 +83,6 @@ interface IWindowManager void moveAppToken(int index, IBinder token); void moveAppTokensToTop(in List<IBinder> tokens); void moveAppTokensToBottom(in List<IBinder> tokens); - void addWindowToken(IBinder token, int type); - void removeWindowToken(IBinder token); // these require DISABLE_KEYGUARD permission void disableKeyguard(IBinder token, String tag); @@ -119,9 +119,9 @@ interface IWindowManager * @param alwaysSendConfiguration Flag to force a new configuration to * be evaluated. This can be used when there are other parameters in * configuration that are changing. - * {@link android.view.Surface}. + * @param animFlags Animation flags as per {@link android.view.Surface}. */ - void setRotation(int rotation, boolean alwaysSendConfiguration); + void setRotation(int rotation, boolean alwaysSendConfiguration, int animFlags); /** * Retrieve the current screen orientation, constants as per diff --git a/core/java/android/view/WindowOrientationListener.java b/core/java/android/view/WindowOrientationListener.java index ac321dbd1e49..13606e7454b8 100755 --- a/core/java/android/view/WindowOrientationListener.java +++ b/core/java/android/view/WindowOrientationListener.java @@ -80,6 +80,7 @@ public abstract class WindowOrientationListener { } if (mEnabled == false) { if (localLOGV) Log.d(TAG, "WindowOrientationListener enabled"); + mSensorRotation = -1; mSensorManager.registerListener(mSensorEventListener, mSensor, mRate); mEnabled = true; } @@ -95,11 +96,16 @@ public abstract class WindowOrientationListener { } if (mEnabled == true) { if (localLOGV) Log.d(TAG, "WindowOrientationListener disabled"); + mSensorRotation = -1; mSensorManager.unregisterListener(mSensorEventListener); mEnabled = false; } } + public int getCurrentRotation() { + return mSensorRotation; + } + class SensorEventListenerImpl implements SensorEventListener { private static final int _DATA_X = 0; private static final int _DATA_Y = 1; diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index 19ab21d822c4..48cbf99152d3 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -2166,7 +2166,7 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo if (changed) { changed = setRotationUncheckedLocked( - WindowManagerPolicy.USE_LAST_ROTATION); + WindowManagerPolicy.USE_LAST_ROTATION, 1); if (changed) { if (freezeThisOneIfNeeded != null) { AppWindowToken wtoken = findAppWindowToken( @@ -3258,7 +3258,7 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo mPolicy.enableScreenAfterBoot(); // Make sure the last requested orientation has been applied. - setRotationUnchecked(WindowManagerPolicy.USE_LAST_ROTATION, false); + setRotationUnchecked(WindowManagerPolicy.USE_LAST_ROTATION, false, 0); } public void setInTouchMode(boolean mode) { @@ -3268,23 +3268,24 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo } public void setRotation(int rotation, - boolean alwaysSendConfiguration) { + boolean alwaysSendConfiguration, int animFlags) { if (!checkCallingPermission(android.Manifest.permission.SET_ORIENTATION, - "setOrientation()")) { + "setRotation()")) { return; } - setRotationUnchecked(rotation, alwaysSendConfiguration); + setRotationUnchecked(rotation, alwaysSendConfiguration, animFlags); } - public void setRotationUnchecked(int rotation, boolean alwaysSendConfiguration) { + public void setRotationUnchecked(int rotation, + boolean alwaysSendConfiguration, int animFlags) { if(DEBUG_ORIENTATION) Log.v(TAG, "alwaysSendConfiguration set to "+alwaysSendConfiguration); long origId = Binder.clearCallingIdentity(); boolean changed; synchronized(mWindowMap) { - changed = setRotationUncheckedLocked(rotation); + changed = setRotationUncheckedLocked(rotation, animFlags); } if (changed) { @@ -3301,7 +3302,7 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo Binder.restoreCallingIdentity(origId); } - public boolean setRotationUncheckedLocked(int rotation) { + public boolean setRotationUncheckedLocked(int rotation, int animFlags) { boolean changed; if (rotation == WindowManagerPolicy.USE_LAST_ROTATION) { rotation = mRequestedRotation; @@ -3326,6 +3327,7 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo mH.sendMessageDelayed(mH.obtainMessage(H.WINDOW_FREEZE_TIMEOUT), 2000); startFreezingDisplayLocked(); + Log.i(TAG, "Setting rotation to " + rotation + ", animFlags=" + animFlags); mQueue.setOrientation(rotation); if (mDisplayEnabled) { Surface.setOrientation(0, rotation); @@ -6976,7 +6978,6 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo public static final int REMOVE_STARTING = 6; public static final int FINISHED_STARTING = 7; public static final int REPORT_APPLICATION_TOKEN_WINDOWS = 8; - public static final int UPDATE_ORIENTATION = 10; public static final int WINDOW_FREEZE_TIMEOUT = 11; public static final int HOLD_SCREEN_CHANGED = 12; public static final int APP_TRANSITION_TIMEOUT = 13; @@ -7204,11 +7205,6 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo } } break; - case UPDATE_ORIENTATION: { - setRotationUnchecked(WindowManagerPolicy.USE_LAST_ROTATION, false); - break; - } - case WINDOW_FREEZE_TIMEOUT: { synchronized (mWindowMap) { Log.w(TAG, "Window freeze timeout expired."); |