Workaround launching PiP task with CLEAR_TASK & NEW_TASK flag.
- When launching an activity with CLEAR_TASK and NEW_TASK, the result code
of the start is START_SUCCESS, but we still need to notify SystemUI to
expand the PiP. However, because the PiP transition now waits for the
first draw, this can cause severe jank and delay if the original activity
is a trampoline activity. As a workaround, we immediately move the task
to the fullscreen stack when clearing and restarting the task to ensure
that the new task shows without delay.
Bug: 37501224
Test: Open YT in PIP, launch sub-shortcut from Home
Change-Id: I16bebf19b082f30695e99da1d93bc4adf5e9df0c
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
index df03fdc..bdc0871 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
@@ -107,12 +107,12 @@
}
@Override
- public void onPinnedActivityRestartAttempt() {
+ public void onPinnedActivityRestartAttempt(boolean clearedTask) {
if (!checkCurrentUserId(false /* debug */)) {
return;
}
- mTouchHandler.getMotionHelper().expandPip();
+ mTouchHandler.getMotionHelper().expandPip(clearedTask /* skipAnimation */);
}
};