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

Commit 311fef7b authored by Vadim Caen's avatar Vadim Caen
Browse files

Call end callback for custom rotation anim.

The onAnimationEnd callback was not called when a cutstum animation was
set (e.g: JUMPCUT) causing WindowState.mOrientationChanging to never be
reset to false and drawing being held.

Bug: 142255739
Test: atest PixelCopyTest#testWindowProducerCropTopLeft
Change-Id: If35a0bb0ad94050fba086cb81f8265c0bf0535eb
parent a3c0ea14
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -1093,6 +1093,12 @@
      "group": "WM_DEBUG_REMOTE_ANIMATIONS",
      "group": "WM_DEBUG_REMOTE_ANIMATIONS",
      "at": "com\/android\/server\/wm\/RemoteAnimationController.java"
      "at": "com\/android\/server\/wm\/RemoteAnimationController.java"
    },
    },
    "200829729": {
      "message": "ScreenRotationAnimation onAnimationEnd",
      "level": "DEBUG",
      "group": "WM_DEBUG_ORIENTATION",
      "at": "com\/android\/server\/wm\/ScreenRotationAnimation.java"
    },
    "221540118": {
    "221540118": {
      "message": "mUserActivityTimeout set to %d",
      "message": "mUserActivityTimeout set to %d",
      "level": "DEBUG",
      "level": "DEBUG",
@@ -1159,6 +1165,12 @@
      "group": "WM_DEBUG_APP_TRANSITIONS",
      "group": "WM_DEBUG_APP_TRANSITIONS",
      "at": "com\/android\/server\/wm\/AppTransitionController.java"
      "at": "com\/android\/server\/wm\/AppTransitionController.java"
    },
    },
    "292555239": {
      "message": "ScreenRotation sill animating: mDisplayAnimator: %s\nmEnterBlackFrameAnimator: %s\nmRotateScreenAnimator: %s\nmScreenshotRotationAnimator: %s",
      "level": "VERBOSE",
      "group": "WM_DEBUG_ORIENTATION",
      "at": "com\/android\/server\/wm\/ScreenRotationAnimation.java"
    },
    "292904800": {
    "292904800": {
      "message": "Deferring rotation, animation in progress.",
      "message": "Deferring rotation, animation in progress.",
      "level": "VERBOSE",
      "level": "VERBOSE",
+36 −17
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package com.android.server.wm;
package com.android.server.wm;


import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_ORIENTATION;
import static com.android.server.wm.ProtoLogGroup.WM_SHOW_SURFACE_ALLOC;
import static com.android.server.wm.ProtoLogGroup.WM_SHOW_SURFACE_ALLOC;
import static com.android.server.wm.ScreenRotationAnimationProto.ANIMATION_RUNNING;
import static com.android.server.wm.ScreenRotationAnimationProto.ANIMATION_RUNNING;
import static com.android.server.wm.ScreenRotationAnimationProto.STARTED;
import static com.android.server.wm.ScreenRotationAnimationProto.STARTED;
@@ -558,8 +559,6 @@ class ScreenRotationAnimation {
        private SurfaceAnimator mEnterBlackFrameAnimator;
        private SurfaceAnimator mEnterBlackFrameAnimator;
        private SurfaceAnimator mScreenshotRotationAnimator;
        private SurfaceAnimator mScreenshotRotationAnimator;
        private SurfaceAnimator mRotateScreenAnimator;
        private SurfaceAnimator mRotateScreenAnimator;
        private final Runnable mNoopCallback = () -> { // b/141177184
        };


        /**
        /**
         * Start the rotation animation of the display and the screenshot on the
         * Start the rotation animation of the display and the screenshot on the
@@ -592,7 +591,7 @@ class ScreenRotationAnimation {
                            .setHeight(mDisplayContent.getSurfaceHeight())
                            .setHeight(mDisplayContent.getSurfaceHeight())
                            .build(),
                            .build(),
                    createWindowAnimationSpec(mRotateEnterAnimation),
                    createWindowAnimationSpec(mRotateEnterAnimation),
                    this::cancel);
                    this::onAnimationEnd);
        }
        }


        private SurfaceAnimator startScreenshotAlphaAnimation() {
        private SurfaceAnimator startScreenshotAlphaAnimation() {
@@ -603,7 +602,7 @@ class ScreenRotationAnimation {
                            .setHeight(mHeight)
                            .setHeight(mHeight)
                            .build(),
                            .build(),
                    createWindowAnimationSpec(mRotateAlphaAnimation),
                    createWindowAnimationSpec(mRotateAlphaAnimation),
                    mNoopCallback);
                    this::onAnimationEnd);
        }
        }


        private SurfaceAnimator startEnterBlackFrameAnimation() {
        private SurfaceAnimator startEnterBlackFrameAnimation() {
@@ -612,7 +611,7 @@ class ScreenRotationAnimation {
                            .setAnimationLeashParent(mDisplayContent.getOverlayLayer())
                            .setAnimationLeashParent(mDisplayContent.getOverlayLayer())
                            .build(),
                            .build(),
                    createWindowAnimationSpec(mRotateEnterAnimation),
                    createWindowAnimationSpec(mRotateEnterAnimation),
                    mNoopCallback);
                    this::onAnimationEnd);
        }
        }


        private SurfaceAnimator startScreenshotRotationAnimation() {
        private SurfaceAnimator startScreenshotRotationAnimation() {
@@ -654,6 +653,25 @@ class ScreenRotationAnimation {
        }
        }


        private void onAnimationEnd() {
        private void onAnimationEnd() {
            synchronized (mService.mGlobalLock) {
                if (isAnimating()) {
                    ProtoLog.v(WM_DEBUG_ORIENTATION,
                            "ScreenRotation sill animating: mDisplayAnimator: %s\n"
                                    + "mEnterBlackFrameAnimator: "
                                    + "%s\nmRotateScreenAnimator: %s\n"
                                    + "mScreenshotRotationAnimator: %s",
                            mDisplayAnimator != null
                                    ? mDisplayAnimator.isAnimating() : null,
                            mEnterBlackFrameAnimator != null
                                    ? mEnterBlackFrameAnimator.isAnimating() : null,
                            mRotateScreenAnimator != null
                                    ? mRotateScreenAnimator.isAnimating() : null,
                            mScreenshotRotationAnimator != null
                                    ? mScreenshotRotationAnimator.isAnimating() : null
                    );
                    return;
                }
                ProtoLog.d(WM_DEBUG_ORIENTATION, "ScreenRotationAnimation onAnimationEnd");
                mEnterBlackFrameAnimator = null;
                mEnterBlackFrameAnimator = null;
                mScreenshotRotationAnimator = null;
                mScreenshotRotationAnimator = null;
                mRotateScreenAnimator = null;
                mRotateScreenAnimator = null;
@@ -668,6 +686,7 @@ class ScreenRotationAnimation {
                    accessibilityController.onRotationChangedLocked(mDisplayContent);
                    accessibilityController.onRotationChangedLocked(mDisplayContent);
                }
                }
            }
            }
        }


        public void cancel() {
        public void cancel() {
            if (mEnterBlackFrameAnimator != null) {
            if (mEnterBlackFrameAnimator != null) {