From 1cd4162b82ca33702e943e6a6d402d80013250db Mon Sep 17 00:00:00 2001 From: Hongwei Wang Date: Thu, 9 Jun 2022 10:19:37 -0700 Subject: [PATCH] Do not attempt auto-enter-pip if there is no valid leash No reproduce path for the bug being reported, this fix is to ensure we do not start the auto-enter-pip animation with invalid leash at the first place. Bug: 234796719 Test: N/A for the bug, verify the normal auto-enter-pip still works Change-Id: I6f2164a322877f1b0213a1ee09eb476090300c7f --- .../src/com/android/quickstep/AbsSwipeUpHandler.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index d676f7d195..5bb2a05417 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -1284,8 +1284,11 @@ public abstract class AbsSwipeUpHandler, ? runningTaskTarget.taskInfo.launchCookies : new ArrayList<>(); boolean isTranslucent = runningTaskTarget != null && runningTaskTarget.isTranslucent; + boolean hasValidLeash = runningTaskTarget != null + && runningTaskTarget.leash != null + && runningTaskTarget.leash.isValid(); boolean appCanEnterPip = !mDeviceState.isPipActive() - && runningTaskTarget != null + && hasValidLeash && runningTaskTarget.allowEnterPip && runningTaskTarget.taskInfo.pictureInPictureParams != null && runningTaskTarget.taskInfo.pictureInPictureParams.isAutoEnterEnabled(); @@ -1394,9 +1397,6 @@ public abstract class AbsSwipeUpHandler, } } - /** - * TODO(b/195473090) handle multiple task simulators (if needed) for PIP - */ private SwipePipToHomeAnimator createWindowAnimationToPip(HomeAnimationFactory homeAnimFactory, RemoteAnimationTargetCompat runningTaskTarget, float startProgress) { // Directly animate the app to PiP (picture-in-picture) mode