From a35b10dd0d7ba6e80d1a04996b1df3ddea66db59 Mon Sep 17 00:00:00 2001 From: Evan Rosky Date: Tue, 2 May 2023 16:14:24 -0700 Subject: [PATCH] Make rotation leash for rotated multi-activity pip expand When expanding a multi-activity pip, the activity gets reparented back to its original task. For expanding into a different rotation, the Task is what held the new rotation, so when the activity is reparented, it loses that transform. In this case, we need to create a rotation leash to provide the transform in the task's place. Bug: 277452732 Test: play video in netflix (landscape). swipe-to-pip (portrait), expand pip (back to landscape). Change-Id: I70318e2808e46158d20a721e8595651ba3ac8460 --- services/core/java/com/android/server/wm/Task.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index 99d3cc0737d11..931c2580fa3f8 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -4614,6 +4614,13 @@ class Task extends TaskFragment { topActivity.reparent(lastParentBeforePip, lastParentBeforePip.getChildCount() /* top */, "movePinnedActivityToOriginalTask"); + final DisplayContent dc = topActivity.getDisplayContent(); + if (dc != null && dc.isFixedRotationLaunchingApp(topActivity)) { + // Expanding pip into new rotation, so create a rotation leash + // until the display is rotated. + topActivity.getOrCreateFixedRotationLeash( + topActivity.getSyncTransaction()); + } lastParentBeforePip.moveToFront("movePinnedActivityToOriginalTask"); } }