summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2016-09-22 21:22:20 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2016-09-22 21:22:24 +0000
commit2ff503b002baf97a4312b87d8638be4825f04ad3 (patch)
tree6c9d638406e639b7ed2da8aa0a122b8b4888aff6
parent48d24389cba66ab7aefac7b0fb322e13785f8ecc (diff)
parent42769fff6ffe3369333ff8366f7eede5da9f2637 (diff)
Merge "Fix animation glitch with overlapping orientation changes." into nyc-mr1-dev
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java13
-rw-r--r--services/core/java/com/android/server/wm/WindowSurfacePlacer.java17
2 files changed, 30 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 1b2322bd1903..06d1650b05d2 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -3859,6 +3859,19 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
+ // If this is true we have updated our desired orientation, but not yet
+ // changed the real orientation our applied our screen rotation animation.
+ // For example, because a previous screen rotation was in progress.
+ boolean rotationNeedsUpdateLocked() {
+ int rotation = mPolicy.rotationForOrientationLw(mLastOrientation, mRotation);
+ boolean altOrientation = !mPolicy.rotationHasCompatibleMetricsLw(
+ mLastOrientation, rotation);
+ if (mRotation == rotation && mAltOrientation == altOrientation) {
+ return false;
+ }
+ return true;
+ }
+
@Override
public int[] setNewConfiguration(Configuration config) {
if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
diff --git a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
index 5a79da938c60..37dcb2168694 100644
--- a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
+++ b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
@@ -1353,8 +1353,25 @@ class WindowSurfacePlacer {
"Checking " + appsCount + " opening apps (frozen="
+ mService.mDisplayFrozen + " timeout="
+ mService.mAppTransition.isTimeout() + ")...");
+ final ScreenRotationAnimation screenRotationAnimation =
+ mService.mAnimator.getScreenRotationAnimationLocked(
+ Display.DEFAULT_DISPLAY);
+
int reason = APP_TRANSITION_TIMEOUT;
if (!mService.mAppTransition.isTimeout()) {
+ // Imagine the case where we are changing orientation due to an app transition, but a previous
+ // orientation change is still in progress. We won't process the orientation change
+ // for our transition because we need to wait for the rotation animation to finish.
+ // If we start the app transition at this point, we will interrupt it halfway with a new rotation
+ // animation after the old one finally finishes. It's better to defer the
+ // app transition.
+ if (screenRotationAnimation != null && screenRotationAnimation.isAnimating() &&
+ mService.rotationNeedsUpdateLocked()) {
+ if (DEBUG_APP_TRANSITIONS) {
+ Slog.v(TAG, "Delaying app transition for screen rotation animation to finish");
+ }
+ return false;
+ }
for (int i = 0; i < appsCount; i++) {
AppWindowToken wtoken = mService.mOpeningApps.valueAt(i);
if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,