From 8ea8db15b2e39ec4c9174b396e6b6939d351bd89 Mon Sep 17 00:00:00 2001 From: Charles Chen Date: Fri, 5 May 2023 18:22:46 +0800 Subject: [PATCH] Fix primary activity untouchable with punch hole The root cause is that the letterbox receives touches within the whole task, which made the primary activity untouchable. This CL changes to make the letterbox only cover the secondary taskfragment area Test: manual - repro steps in bug Bug: 271592105 Change-Id: I2d724736d01a8fc50fe4c82c8b8cca2769d97d4f --- .../java/com/android/server/wm/LetterboxUiController.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/wm/LetterboxUiController.java b/services/core/java/com/android/server/wm/LetterboxUiController.java index 6ef6fa7db740d..8d0ded45436fc 100644 --- a/services/core/java/com/android/server/wm/LetterboxUiController.java +++ b/services/core/java/com/android/server/wm/LetterboxUiController.java @@ -819,13 +819,14 @@ final class LetterboxUiController { // Get the bounds of the "space-to-fill". The transformed bounds have the highest // priority because the activity is launched in a rotated environment. In multi-window - // mode, the task-level represents this. In fullscreen-mode, the task container does + // mode, the taskFragment-level represents this for both split-screen + // and activity-embedding. In fullscreen-mode, the task container does // (since the orientation letterbox is also applied to the task). final Rect transformedBounds = mActivityRecord.getFixedRotationTransformDisplayBounds(); final Rect spaceToFill = transformedBounds != null ? transformedBounds : mActivityRecord.inMultiWindowMode() - ? mActivityRecord.getTask().getBounds() + ? mActivityRecord.getTaskFragment().getBounds() : mActivityRecord.getRootTask().getParent().getBounds(); // In case of translucent activities an option is to use the WindowState#getFrame() of // the first opaque activity beneath. In some cases (e.g. an opaque activity is using