diff --git a/services/core/java/com/android/server/wm/ScreenRotationAnimation.java b/services/core/java/com/android/server/wm/ScreenRotationAnimation.java index bee44def1512d..8cad16509c4c9 100644 --- a/services/core/java/com/android/server/wm/ScreenRotationAnimation.java +++ b/services/core/java/com/android/server/wm/ScreenRotationAnimation.java @@ -595,7 +595,7 @@ class ScreenRotationAnimation { } private SurfaceAnimator startDisplayRotation() { - return startAnimation(initializeBuilder() + SurfaceAnimator animator = startAnimation(initializeBuilder() .setAnimationLeashParent(mDisplayContent.getSurfaceControl()) .setSurfaceControl(mDisplayContent.getWindowingLayer()) .setParentSurfaceControl(mDisplayContent.getSurfaceControl()) @@ -604,6 +604,13 @@ class ScreenRotationAnimation { .build(), createWindowAnimationSpec(mRotateEnterAnimation), this::onAnimationEnd); + + // Crop the animation leash to avoid extended wallpaper from showing over + // mBackColorSurface + Rect displayBounds = mDisplayContent.getBounds(); + mDisplayContent.getPendingTransaction() + .setWindowCrop(animator.mLeash, displayBounds.width(), displayBounds.height()); + return animator; } private SurfaceAnimator startScreenshotAlphaAnimation() {