From 71784f2ad48e2e344c54d0212d19128496f72921 Mon Sep 17 00:00:00 2001 From: Tony Huang Date: Mon, 22 Mar 2021 11:22:59 +0800 Subject: [PATCH] Fix black screen while pip to split screen Race condition caused pip animation end transition later than split screen appear transition. Fix it by set to right surface postiion on on pip side too. Bug: 172381920 Test: Enter pip and split screen then expand pip Change-Id: If5470a99385b389af87db1129994610002c035fd --- .../com/android/wm/shell/pip/PipAnimationController.java | 7 ++++--- .../src/com/android/wm/shell/pip/PipTaskOrganizer.java | 7 +++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipAnimationController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipAnimationController.java index a52db24aa1848..af4ccadae5388 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipAnimationController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipAnimationController.java @@ -540,9 +540,10 @@ public class PipAnimationController { // WindowContainerTransaction in task organizer final Rect destBounds = getDestinationBounds(); getSurfaceTransactionHelper().resetScale(tx, leash, destBounds); - if (transitionDirection == TRANSITION_DIRECTION_LEAVE_PIP) { - // Leaving to fullscreen, reset crop to null. - tx.setPosition(leash, destBounds.left, destBounds.top); + if (isOutPipDirection(transitionDirection)) { + // Exit pip, clear scale, position and crop. + tx.setMatrix(leash, 1, 0, 0, 1); + tx.setPosition(leash, 0, 0); tx.setWindowCrop(leash, 0, 0); } else { getSurfaceTransactionHelper().crop(tx, leash, destBounds); diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java index ffa821daf7f81..99ec100493408 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java @@ -1016,10 +1016,9 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, wct.setActivityWindowingMode(mToken, WINDOWING_MODE_UNDEFINED); wct.scheduleFinishEnterPip(mToken, destinationBounds); } else if (isOutPipDirection(direction)) { - // If we are animating to fullscreen, then we need to reset the override bounds - // on the task to ensure that the task "matches" the parent's bounds. - taskBounds = (direction == TRANSITION_DIRECTION_LEAVE_PIP) - ? null : destinationBounds; + // If we are animating to fullscreen or split screen, then we need to reset the + // override bounds on the task to ensure that the task "matches" the parent's bounds. + taskBounds = null; applyWindowingModeChangeOnExit(wct, direction); } else { // Just a resize in PIP