From 663b4062a526f241a42468df0d10cf0362e2f4a3 Mon Sep 17 00:00:00 2001 From: Chris Li Date: Wed, 7 Sep 2022 14:16:11 +0800 Subject: [PATCH] Fix finishTransaction window crop with requestedOverrideBounds Before, when the requestOverrideBounds is not at (0, 0) when its parent is also not at (0, 0), the window crop will be different from the actual visible area. For example, when enter ActivityEmbedding split with system split. The requestedOverrideBounds is in screen coordinate, and the relative position offset is in parent coordinate, but the window crop should be in the current surface coordinate. Update it to always crop from (0, 0) Bug: 207070762 Test: manually verify with enter system split with AE split. Change-Id: I45dad68c93921ae0c7b5f0b46553014780a0c9b8 --- services/core/java/com/android/server/wm/Transition.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java index 5495b30418c9b..ed069ab4d2af0 100644 --- a/services/core/java/com/android/server/wm/Transition.java +++ b/services/core/java/com/android/server/wm/Transition.java @@ -575,17 +575,16 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe t.setLayer(targetLeash, target.getLastLayer()); target.getRelativePosition(tmpPos); t.setPosition(targetLeash, tmpPos.x, tmpPos.y); - final Rect clipRect; // No need to clip the display in case seeing the clipped content when during the // display rotation. No need to clip activities because they rely on clipping on // task layers. if (target.asDisplayContent() != null || target.asActivityRecord() != null) { - clipRect = null; + t.setCrop(targetLeash, null /* crop */); } else { - clipRect = target.getRequestedOverrideBounds(); - clipRect.offset(-tmpPos.x, -tmpPos.y); + // Crop to the requested bounds. + final Rect clipRect = target.getRequestedOverrideBounds(); + t.setWindowCrop(targetLeash, clipRect.width(), clipRect.height()); } - t.setCrop(targetLeash, clipRect); t.setCornerRadius(targetLeash, 0); t.setShadowRadius(targetLeash, 0); t.setMatrix(targetLeash, 1, 0, 0, 1);