From 04728f77d761b30a0594e920d002b4cf935b3169 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Thu, 9 Dec 2021 07:01:47 +0000 Subject: Remove unnecessary clean up of targets - removeTaskInternal can trigger the rotation to change immediately (ie. https://paste.googleplex.com/5205159639515136?raw), which will inadvertently trigger the screenshotRecentTasks() path, which is unnecessary when cleaning up (and can lead to a lingering snapshot surface. Since these pending new task targets are already added to mPendingAnimations when they are created in createTaskRemoteAnimation(), the tasks will be cleaned up along with everything else in cleanupAnimation() Bug: 207189813 Test: atest WmTests:RecentsAnimationControllerTest Test: Ensure the live-tile + rotation path still triggers screenshot Test: Ensure quickswitch still works Change-Id: Ia9d2fb01b4c0b205f2fa4615d3be3b2b7070e488 --- .../java/com/android/server/wm/RecentsAnimationController.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/services/core/java/com/android/server/wm/RecentsAnimationController.java b/services/core/java/com/android/server/wm/RecentsAnimationController.java index fd4b63e26403..5dd8ef39e8e7 100644 --- a/services/core/java/com/android/server/wm/RecentsAnimationController.java +++ b/services/core/java/com/android/server/wm/RecentsAnimationController.java @@ -264,13 +264,6 @@ public class RecentsAnimationController implements DeathRecipient { "finish(%b): mCanceled=%b", moveHomeToTop, mCanceled); final long token = Binder.clearCallingIdentity(); try { - synchronized (mService.getWindowManagerLock()) { - // Remove all new task targets. - for (int i = mPendingNewTaskTargets.size() - 1; i >= 0; i--) { - removeTaskInternal(mPendingNewTaskTargets.get(i)); - } - } - // Note, the callback will handle its own synchronization, do not lock on WM lock // prior to calling the callback mCallbacks.onAnimationFinished(moveHomeToTop @@ -760,7 +753,7 @@ public class RecentsAnimationController implements DeathRecipient { // the task-id with the leaf id. final Task leafTask = task.getTopLeafTask(); int taskId = leafTask.mTaskId; - TaskAnimationAdapter adapter = (TaskAnimationAdapter) addAnimation(task, + TaskAnimationAdapter adapter = addAnimation(task, !recentTaskIds.get(taskId), true /* hidden */, finishedCallback); mPendingNewTaskTargets.add(taskId); return adapter.createRemoteAnimationTarget(taskId); @@ -1013,6 +1006,7 @@ public class RecentsAnimationController implements DeathRecipient { taskAdapter.onCleanup(); } // Should already be empty, but clean-up pending task-appears in-case they weren't sent. + mPendingNewTaskTargets.clear(); mPendingTaskAppears.clear(); for (int i = mPendingWallpaperAnimations.size() - 1; i >= 0; i--) { -- cgit v1.2.3-59-g8ed1b