diff options
3 files changed, 7 insertions, 85 deletions
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index b735115be61e..6527ca0e751d 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -328,14 +328,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo private int mLastOrientation = SCREEN_ORIENTATION_UNSPECIFIED; /** - * Flag indicating that the application is receiving an orientation that has different metrics - * than it expected. E.g. Portrait instead of Landscape. - * - * @see #updateRotationUnchecked() - */ - private boolean mAltOrientation = false; - - /** * Orientation forced by some window. If there is no visible window that specifies orientation * it is set to {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED}. * @@ -1085,10 +1077,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo return mLastOrientation; } - boolean getAltOrientation() { - return mAltOrientation; - } - int getLastWindowForcedOrientation() { return mLastWindowForcedOrientation; } @@ -1130,15 +1118,9 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo boolean rotationNeedsUpdate() { final int lastOrientation = getLastOrientation(); final int oldRotation = getRotation(); - final boolean oldAltOrientation = getAltOrientation(); final int rotation = mDisplayRotation.rotationForOrientation(lastOrientation, oldRotation); - final boolean altOrientation = !mDisplayRotation.rotationHasCompatibleMetrics( - lastOrientation, rotation); - if (oldRotation == rotation && oldAltOrientation == altOrientation) { - return false; - } - return true; + return oldRotation != rotation; } /** @@ -1336,7 +1318,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo final int oldRotation = mRotation; final int lastOrientation = mLastOrientation; - final boolean oldAltOrientation = mAltOrientation; final int rotation = mDisplayRotation.rotationForOrientation(lastOrientation, oldRotation); if (DEBUG_ORIENTATION) Slog.v(TAG_WM, "Computed rotation=" + rotation + " for display id=" + mDisplayId + " based on lastOrientation=" + lastOrientation @@ -1368,35 +1349,26 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo } final boolean rotateSeamlessly = mayRotateSeamlessly; - // TODO: Implement forced rotation changes. - // Set mAltOrientation to indicate that the application is receiving - // an orientation that has different metrics than it expected. - // eg. Portrait instead of Landscape. - - final boolean altOrientation = !mDisplayRotation.rotationHasCompatibleMetrics( - lastOrientation, rotation); - if (DEBUG_ORIENTATION) Slog.v(TAG_WM, "Display id=" + mDisplayId + " selected orientation " + lastOrientation + ", got rotation " + rotation + " which has " - + (altOrientation ? "incompatible" : "compatible") + " metrics"); + + " metrics"); - if (oldRotation == rotation && oldAltOrientation == altOrientation) { + if (oldRotation == rotation) { // No change. return false; } if (DEBUG_ORIENTATION) Slog.v(TAG_WM, "Display id=" + mDisplayId + " rotation changed to " + rotation - + (altOrientation ? " (alt)" : "") + " from " + oldRotation - + (oldAltOrientation ? " (alt)" : "") + ", lastOrientation=" + lastOrientation); + + " from " + oldRotation + + ", lastOrientation=" + lastOrientation); if (DisplayContent.deltaRotation(rotation, oldRotation) != 2) { mWaitingForConfig = true; } mRotation = rotation; - mAltOrientation = altOrientation; mWmService.mWindowsFreezingScreen = WINDOWS_FREEZING_SCREENS_ACTIVE; mWmService.mH.sendNewMessageDelayed(WindowManagerService.H.WINDOW_FREEZE_TIMEOUT, @@ -1538,26 +1510,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo private DisplayInfo updateDisplayAndOrientation(int uiMode) { // Use the effective "visual" dimensions based on current rotation final boolean rotated = (mRotation == ROTATION_90 || mRotation == ROTATION_270); - final int realdw = rotated ? mBaseDisplayHeight : mBaseDisplayWidth; - final int realdh = rotated ? mBaseDisplayWidth : mBaseDisplayHeight; - int dw = realdw; - int dh = realdh; - - if (mAltOrientation) { - if (realdw > realdh) { - // Turn landscape into portrait. - int maxw = (int)(realdh/1.3f); - if (maxw < realdw) { - dw = maxw; - } - } else { - // Turn portrait into landscape. - int maxh = (int)(realdw/1.3f); - if (maxh < realdh) { - dh = maxh; - } - } - } + final int dw = rotated ? mBaseDisplayHeight : mBaseDisplayWidth; + final int dh = rotated ? mBaseDisplayWidth : mBaseDisplayHeight; // Update application display metrics. final WmDisplayCutout wmDisplayCutout = calculateDisplayCutoutForRotation(mRotation); diff --git a/services/core/java/com/android/server/wm/DisplayRotation.java b/services/core/java/com/android/server/wm/DisplayRotation.java index 7aabc15d9860..bc165dceb544 100644 --- a/services/core/java/com/android/server/wm/DisplayRotation.java +++ b/services/core/java/com/android/server/wm/DisplayRotation.java @@ -676,36 +676,6 @@ public class DisplayRotation { return rotation == mPortraitRotation || rotation == mUpsideDownRotation; } - /** - * Given an orientation constant and a rotation, returns true if the rotation - * has compatible metrics to the requested orientation. For example, if - * the application requested landscape and got seascape, then the rotation - * has compatible metrics; if the application requested portrait and got landscape, - * then the rotation has incompatible metrics; if the application did not specify - * a preference, then anything goes. - * - * @param orientation An orientation constant, such as - * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_LANDSCAPE}. - * @param rotation The rotation to check. - * @return True if the rotation is compatible with the requested orientation. - */ - boolean rotationHasCompatibleMetrics(int orientation, int rotation) { - switch (orientation) { - case ActivityInfo.SCREEN_ORIENTATION_PORTRAIT: - case ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT: - case ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT: - return isAnyPortrait(rotation); - - case ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE: - case ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE: - case ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE: - return isLandscapeOrSeascape(rotation); - - default: - return true; - } - } - private boolean isValidRotationChoice(final int preferredRotation) { // Determine if the given app orientation is compatible with the provided rotation choice. switch (mCurrentAppOrientation) { diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 0c4f4961d215..fda7a85c1270 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -5943,8 +5943,6 @@ public class WindowManagerService extends IWindowManager.Stub pw.print(" apps="); pw.print(mAppsFreezingScreen); final DisplayContent defaultDisplayContent = getDefaultDisplayContentLocked(); pw.print(" mRotation="); pw.print(defaultDisplayContent.getRotation()); - pw.print(" mAltOrientation="); - pw.println(defaultDisplayContent.getAltOrientation()); pw.print(" mLastWindowForcedOrientation="); pw.print(defaultDisplayContent.getLastWindowForcedOrientation()); pw.print(" mLastOrientation="); |