From 0ea7ac03023cc042763711989dc8b666eccdfeaf Mon Sep 17 00:00:00 2001 From: Nick Chameyev Date: Fri, 18 Nov 2022 17:28:23 +0000 Subject: [PATCH] [Unfold animation] Move the dark scrim below How rotation animation works: * It captures a screenshot of the screen * It puts the screenshot over everything on the screen (in a container with z-index Integer.MAX_VALUE) * Starts the process of resizing windows to the new size. Because the screenshot on top of everything, the resizing is not visible. Black unfold overlay is also added with z-index Integer.MAX_VALUE but because it is added later it is rendered on top of the rotation screenshot. So it is visible how the overlay is resized. Updated z-index of the unfold overlay to render below the rotation animation screenshot to hide it while we are rotating. Bug: 258213952 Bug: 255955520 Test: manual fold and going to tabletop mode after rotating (see comparison videos in the CL) Change-Id: I5e9b5c72dfa28e4ae9f447ad8df7b403c97bf43e --- .../unfold/UnfoldLightRevealOverlayAnimation.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/unfold/UnfoldLightRevealOverlayAnimation.kt b/packages/SystemUI/src/com/android/systemui/unfold/UnfoldLightRevealOverlayAnimation.kt index d411e34603d95..ae30ca0e6a610 100644 --- a/packages/SystemUI/src/com/android/systemui/unfold/UnfoldLightRevealOverlayAnimation.kt +++ b/packages/SystemUI/src/com/android/systemui/unfold/UnfoldLightRevealOverlayAnimation.kt @@ -94,7 +94,7 @@ constructor( overlayContainer = builder.build() SurfaceControl.Transaction() - .setLayer(overlayContainer, Integer.MAX_VALUE) + .setLayer(overlayContainer, UNFOLD_OVERLAY_LAYER_Z_INDEX) .show(overlayContainer) .apply() @@ -268,4 +268,12 @@ constructor( this.isFolded = isFolded } ) + + private companion object { + private const val ROTATION_ANIMATION_OVERLAY_Z_INDEX = Integer.MAX_VALUE + + // Put the unfold overlay below the rotation animation screenshot to hide the moment + // when it is rotated but the rotation of the other windows hasn't happen yet + private const val UNFOLD_OVERLAY_LAYER_Z_INDEX = ROTATION_ANIMATION_OVERLAY_Z_INDEX - 1 + } }