From 2ebf2466d75b7e6e671875d459b497cd55f01bbd Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Wed, 13 Jul 2022 17:56:05 -0700 Subject: [PATCH] Crop windowing layer to that of display size in screen rotation animation * Wallpaper is larger than display bounds, so rotating launcher or other apps that are not opaque will show the wallpaper in background Bug: 222632469 Change-Id: I1b23e1da0d8acffdbe7245030095a029e314af0f --- .../com/android/server/wm/ScreenRotationAnimation.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/ScreenRotationAnimation.java b/services/core/java/com/android/server/wm/ScreenRotationAnimation.java index f80e732c8212a..d09068b02fd49 100644 --- a/services/core/java/com/android/server/wm/ScreenRotationAnimation.java +++ b/services/core/java/com/android/server/wm/ScreenRotationAnimation.java @@ -600,7 +600,7 @@ class ScreenRotationAnimation { } private SurfaceAnimator startDisplayRotation() { - return startAnimation(initializeBuilder() + SurfaceAnimator animator = startAnimation(initializeBuilder() .setAnimationLeashParent(mDisplayContent.getSurfaceControl()) .setSurfaceControl(mDisplayContent.getWindowingLayer()) .setParentSurfaceControl(mDisplayContent.getSurfaceControl()) @@ -609,6 +609,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() {