auto import from //branches/cupcake/...@137873
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index cb16c98..e4bd3c3 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -1373,10 +1373,9 @@
removeWindowInnerLocked(session, win);
// Removing a visible window will effect the computed orientation
// So just update orientation if needed.
- if (wasVisible) {
- if (updateOrientationFromAppTokens(null) != null) {
- sendNewConfiguration();
- }
+ if (wasVisible && computeForcedAppOrientationLocked()
+ != mForcedAppOrientation) {
+ mH.sendMessage(mH.obtainMessage(H.COMPUTE_AND_SEND_NEW_CONFIGURATION));
}
updateFocusedWindowLocked(UPDATE_FOCUS_NORMAL);
Binder.restoreCallingIdentity(origId);
@@ -2141,23 +2140,19 @@
* @see android.view.IWindowManager#updateOrientationFromAppTokens(
* android.os.IBinder)
*/
- public Configuration updateOrientationFromAppTokensLocked(
+ Configuration updateOrientationFromAppTokensLocked(
IBinder freezeThisOneIfNeeded) {
boolean changed = false;
- Configuration config = null;
long ident = Binder.clearCallingIdentity();
try {
- int req = getOrientationFromWindowsLocked();
- if (req == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
- req = getOrientationFromAppTokensLocked();
- }
+ int req = computeForcedAppOrientationLocked();
if (req != mForcedAppOrientation) {
changed = true;
mForcedAppOrientation = req;
//send a message to Policy indicating orientation change to take
//action like disabling/enabling sensors etc.,
- mPolicy.setCurrentOrientation(req);
+ mPolicy.setCurrentOrientationLw(req);
}
if (changed) {
@@ -2182,6 +2177,14 @@
return null;
}
+ int computeForcedAppOrientationLocked() {
+ int req = getOrientationFromWindowsLocked();
+ if (req == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
+ req = getOrientationFromAppTokensLocked();
+ }
+ return req;
+ }
+
public void setAppOrientation(IApplicationToken token, int requestedOrientation) {
if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
"setAppOrientation()")) {
@@ -3284,7 +3287,7 @@
mRequestedRotation = rotation;
}
if (DEBUG_ORIENTATION) Log.v(TAG, "Overwriting rotation value from " + rotation);
- rotation = mPolicy.rotationForOrientation(mForcedAppOrientation,
+ rotation = mPolicy.rotationForOrientationLw(mForcedAppOrientation,
mRotation, mDisplayEnabled);
if (DEBUG_ORIENTATION) Log.v(TAG, "new rotation is set to " + rotation);
changed = mDisplayEnabled && mRotation != rotation;
@@ -4960,7 +4963,7 @@
if (holding) {
mHoldingScreen.acquire();
} else {
- mPolicy.screenOnStopped();
+ mPolicy.screenOnStoppedLw();
mHoldingScreen.release();
}
}
@@ -5290,7 +5293,7 @@
synchronized(mWindowMap) {
long ident = Binder.clearCallingIdentity();
try {
- return mPolicy.performHapticFeedback(
+ return mPolicy.performHapticFeedbackLw(
windowForClientLocked(this, window), effectId, always);
} finally {
Binder.restoreCallingIdentity(ident);
@@ -6944,6 +6947,7 @@
public static final int FORCE_GC = 15;
public static final int ENABLE_SCREEN = 16;
public static final int APP_FREEZE_TIMEOUT = 17;
+ public static final int COMPUTE_AND_SEND_NEW_CONFIGURATION = 18;
private Session mLastReportedHold;
@@ -7274,6 +7278,13 @@
break;
}
+ case COMPUTE_AND_SEND_NEW_CONFIGURATION: {
+ if (updateOrientationFromAppTokens(null) != null) {
+ sendNewConfiguration();
+ }
+ break;
+ }
+
}
}
}