From 250472ba677307300a0587d3f85da9fa9d65a30d Mon Sep 17 00:00:00 2001 From: Chris Li Date: Tue, 25 Oct 2022 15:25:25 +0800 Subject: [PATCH] Make sure surface crop is up-to-date when moving to front Before, when a TaskFragment is resized when moving to front, its surface may still be croped for the old bounds. Now, we make sure the surface crop is updated when moving to front. Bug: 207070762 Test: manually verify with resizing display in background Change-Id: I2103a1d8db855624310bc3becd9ed502fb082a7f --- .../src/com/android/wm/shell/transition/Transitions.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java index db1f19aa87b6b..501ee2937dc54 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java @@ -330,6 +330,15 @@ public class Transitions implements RemoteCallable { final SurfaceControl leash = change.getLeash(); final int mode = info.getChanges().get(i).getMode(); + if (mode == TRANSIT_TO_FRONT + && ((change.getStartAbsBounds().height() != change.getEndAbsBounds().height() + || change.getStartAbsBounds().width() != change.getEndAbsBounds().width()))) { + // When the window is moved to front with a different size, make sure the crop is + // updated to prevent it from using the old crop. + t.setWindowCrop(leash, change.getEndAbsBounds().width(), + change.getEndAbsBounds().height()); + } + // Don't move anything that isn't independent within its parents if (!TransitionInfo.isIndependent(change, info)) { if (mode == TRANSIT_OPEN || mode == TRANSIT_TO_FRONT || mode == TRANSIT_CHANGE) {