Fix surface crop being wrong after rotation

Test: manual - expand some bubbles, rotation, visit them, rotate back
             => the surface should always fit the expanded view and
                not be cut off
Bug: 278653202
Change-Id: If260b7cb3577d8e5dd68813d5b1087834b3c5b1f
This commit is contained in:
Mady Mellor
2023-05-08 15:24:18 -07:00
parent ab3637736a
commit ac1543cbfc

View File

@@ -493,11 +493,14 @@ public class TaskViewTaskController implements ShellTaskOrganizer.TaskListener {
.show(mTaskLeash);
// Also reparent on finishTransaction since the finishTransaction will reparent back
// to its "original" parent by default.
Rect boundsOnScreen = mTaskViewBase.getCurrentBoundsOnScreen();
finishTransaction.reparent(mTaskLeash, mSurfaceControl)
.setPosition(mTaskLeash, 0, 0);
mTaskViewTransitions.updateBoundsState(this, mTaskViewBase.getCurrentBoundsOnScreen());
.setPosition(mTaskLeash, 0, 0)
// TODO: maybe once b/280900002 is fixed this will be unnecessary
.setWindowCrop(mTaskLeash, boundsOnScreen.width(), boundsOnScreen.height());
mTaskViewTransitions.updateBoundsState(this, boundsOnScreen);
mTaskViewTransitions.updateVisibilityState(this, true /* visible */);
wct.setBounds(mTaskToken, mTaskViewBase.getCurrentBoundsOnScreen());
wct.setBounds(mTaskToken, boundsOnScreen);
} else {
// The surface has already been destroyed before the task has appeared,
// so go ahead and hide the task entirely