Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d7755fe8 authored by Robert Carr's avatar Robert Carr Committed by android-build-merger
Browse files

Fix animation glitch with overlapping orientation changes. am: 42769fff am: f7f12caa

am: 022505eb

Change-Id: If73dd0a1f65a83af13e8621a6ae191c938b9668e
parents db56057e 022505eb
Loading
Loading
Loading
Loading
+13 −0
Original line number Original line Diff line number Diff line
@@ -3117,6 +3117,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
    @Override
    public int[] setNewConfiguration(Configuration config) {
    public int[] setNewConfiguration(Configuration config) {
        if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
        if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
+17 −0
Original line number Original line Diff line number Diff line
@@ -1332,8 +1332,25 @@ class WindowSurfacePlacer {
                "Checking " + appsCount + " opening apps (frozen="
                "Checking " + appsCount + " opening apps (frozen="
                        + mService.mDisplayFrozen + " timeout="
                        + mService.mDisplayFrozen + " timeout="
                        + mService.mAppTransition.isTimeout() + ")...");
                        + mService.mAppTransition.isTimeout() + ")...");
        final ScreenRotationAnimation screenRotationAnimation =
            mService.mAnimator.getScreenRotationAnimationLocked(
                    Display.DEFAULT_DISPLAY);

        int reason = APP_TRANSITION_TIMEOUT;
        int reason = APP_TRANSITION_TIMEOUT;
        if (!mService.mAppTransition.isTimeout()) {
        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++) {
            for (int i = 0; i < appsCount; i++) {
                AppWindowToken wtoken = mService.mOpeningApps.valueAt(i);
                AppWindowToken wtoken = mService.mOpeningApps.valueAt(i);
                if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
                if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,