From ba4ded96a4107816030b60014cd7dd71627feba0 Mon Sep 17 00:00:00 2001 From: Hongwei Wang Date: Tue, 19 Jan 2021 17:40:19 -0800 Subject: [PATCH] Delay the PiP menu attachment The flash at the end of entering PiP transition in gesture navigation mode is a regression from ag/12997165. Fixed by delaying PipMenuController#attach late (when the leash is set to transparent) in the process to avoid any artifacts on the leash caused by addShellRoot. Video: http://rcll/aaaaaabFQoRHlzixHdtY/dFdpJHvTCP6NmNEkDHrtei Bug: 174814759 Test: see video Change-Id: I7e74253f94b16977d04e27c2ab76fd3178001630 --- .../src/com/android/wm/shell/pip/PipTaskOrganizer.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 e706f76faca11..801ee2b251847 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 @@ -59,7 +59,6 @@ import android.window.WindowContainerTransaction; import android.window.WindowContainerTransactionCallback; import com.android.internal.annotations.VisibleForTesting; -import com.android.internal.jank.InteractionJankMonitor; import com.android.internal.os.SomeArgs; import com.android.wm.shell.R; import com.android.wm.shell.ShellTaskOrganizer; @@ -505,8 +504,6 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, mOnDisplayIdChangeCallback.accept(info.displayId); } - mPipMenuController.attach(leash); - if (mInSwipePipToHomeTransition) { final Rect destinationBounds = mPipBoundsState.getBounds(); // animation is finished in the Launcher and here we directly apply the final touch. @@ -535,6 +532,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, final Rect currentBounds = mTaskInfo.configuration.windowConfiguration.getBounds(); if (mOneShotAnimationType == ANIM_TYPE_BOUNDS) { + mPipMenuController.attach(mLeash); final Rect sourceHintRect = getValidSourceHintRect(info.pictureInPictureParams, currentBounds); scheduleAnimateResizePip(currentBounds, destinationBounds, sourceHintRect, @@ -587,6 +585,9 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, } private void applyEnterPipSyncTransaction(Rect destinationBounds, Runnable runnable) { + // PiP menu is attached late in the process here to avoid any artifacts on the leash + // caused by addShellRoot when in gesture navigation mode. + mPipMenuController.attach(mLeash); final WindowContainerTransaction wct = new WindowContainerTransaction(); wct.setActivityWindowingMode(mToken, WINDOWING_MODE_UNDEFINED); wct.setBounds(mToken, destinationBounds);