From 27475c6e0c662ea3ae19ca4724f00c6694b53ecd Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Tue, 8 Jun 2021 22:51:36 -0700 Subject: [PATCH] Fix regressions with reparenting task - Make the new task immediately visible, and reset the crop on the original task transferred from the leash Fixes: 190550846 Test: Open ApiDemos, autoenter from a task with multiple activities Change-Id: I2527cee68448dc8f1be7634051547c29c596c63a --- services/core/java/com/android/server/wm/Task.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index 82d1c04591a6d..7af8d8bb5200f 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -7653,17 +7653,23 @@ class Task extends WindowContainer { void clearLastRecentsAnimationTransaction() { mLastRecentsAnimationTransaction = null; mLastRecentsAnimationOverlay = null; - // reset also the transform introduced by mLastRecentsAnimationTransaction - getPendingTransaction().setMatrix(mSurfaceControl, Matrix.IDENTITY_MATRIX, new float[9]); + // reset also the crop and transform introduced by mLastRecentsAnimationTransaction + Rect bounds = getBounds(); + getPendingTransaction().setMatrix(mSurfaceControl, Matrix.IDENTITY_MATRIX, new float[9]) + .setWindowCrop(mSurfaceControl, bounds.width(), bounds.height()); } void maybeApplyLastRecentsAnimationTransaction() { if (mLastRecentsAnimationTransaction != null) { + final SurfaceControl.Transaction tx = getPendingTransaction(); if (mLastRecentsAnimationOverlay != null) { - getPendingTransaction().reparent(mLastRecentsAnimationOverlay, mSurfaceControl); + tx.reparent(mLastRecentsAnimationOverlay, mSurfaceControl); } PictureInPictureSurfaceTransaction.apply(mLastRecentsAnimationTransaction, - mSurfaceControl, getPendingTransaction()); + mSurfaceControl, tx); + // If we are transferring the transform from the root task entering PIP, then also show + // the new task immediately + tx.show(mSurfaceControl); mLastRecentsAnimationTransaction = null; mLastRecentsAnimationOverlay = null; }