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
This commit is contained in:
Hongwei Wang
2021-01-19 17:40:19 -08:00
parent 7b956dd62f
commit ba4ded96a4

View File

@@ -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);