From 73d7468fe62fea979d12b1f33c5f807e62f1a0e0 Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Wed, 10 Aug 2022 20:47:59 -0600 Subject: [PATCH] Set rotation layers as opaque initially The layers should cover the window behind during rotation animation. So it can be opaque initially to avoid blended composition for one intermediate frame. After the animation starts and changes the alpha < 1 to the rotation layer for fading animation, it can still switch from opaque composition to blended composition automatically. Bug: 240568519 Test: atest ChangeAppRotationTest Change-Id: Ic4173d33c15c35e252315f9cf53127c759e56ece --- .../wm/shell/transition/ScreenRotationAnimation.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/ScreenRotationAnimation.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/ScreenRotationAnimation.java index a843b2a0ac39f..45b69f17a861d 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/ScreenRotationAnimation.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/ScreenRotationAnimation.java @@ -162,13 +162,12 @@ class ScreenRotationAnimation { .setParent(mAnimLeash) .setBLASTLayer() .setSecure(screenshotBuffer.containsSecureLayers()) + .setOpaque(true) .setCallsite("ShellRotationAnimation") .setName("RotationLayer") .build(); t.setLayer(mAnimLeash, SCREEN_FREEZE_LAYER_BASE); - t.setPosition(mAnimLeash, 0, 0); - t.setAlpha(mAnimLeash, 1); t.show(mAnimLeash); final ColorSpace colorSpace = screenshotBuffer.getColorSpace(); @@ -181,6 +180,7 @@ class ScreenRotationAnimation { mBackColorSurface = new SurfaceControl.Builder(session) .setParent(rootLeash) .setColorLayer() + .setOpaque(true) .setCallsite("ShellRotationAnimation") .setName("BackColorSurface") .build(); @@ -189,7 +189,6 @@ class ScreenRotationAnimation { t.setLayer(mBackColorSurface, -1); t.setColor(mBackColorSurface, new float[]{mStartLuma, mStartLuma, mStartLuma}); - t.setAlpha(mBackColorSurface, 1); t.show(mBackColorSurface); } @@ -242,7 +241,6 @@ class ScreenRotationAnimation { t.setMatrix(mScreenshotLayer, mTmpFloats[Matrix.MSCALE_X], mTmpFloats[Matrix.MSKEW_Y], mTmpFloats[Matrix.MSKEW_X], mTmpFloats[Matrix.MSCALE_Y]); - t.setAlpha(mScreenshotLayer, (float) 1.0); } /**