From 88fbccf1816bfddc4a1d8b236f746099ada9dc7b Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Mon, 7 Dec 2020 13:43:15 -0800 Subject: [PATCH] Apply detached task transactions on animation cleanup If the task is detached while being animated by recents, the animation leash may not be cleaned up properly. If the leash draws a shadow, this would result in a translucent layer on screen that cannot be dismissed. The leash was not being cleaned up because when the task is detached, it will use its own transaction instead of its DC transaction and its transaction is not reachable. Bug: 172932178 Test: while dragging app to recents, adb shell am force-stop , drag back to home Change-Id: Id84319c8ab224c11c6f9ab623b949bba61c761fd --- .../android/server/wm/RecentsAnimationController.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/wm/RecentsAnimationController.java b/services/core/java/com/android/server/wm/RecentsAnimationController.java index 5da668c8c3617..d3b0e63e7f61e 100644 --- a/services/core/java/com/android/server/wm/RecentsAnimationController.java +++ b/services/core/java/com/android/server/wm/RecentsAnimationController.java @@ -763,7 +763,7 @@ public class RecentsAnimationController implements DeathRecipient { taskAdapter.mTask.dontAnimateDimExit(); } removeAnimation(taskAdapter); - taskAdapter.maybeApplyFinishBounds(); + taskAdapter.onCleanup(); } for (int i = mPendingWallpaperAnimations.size() - 1; i >= 0; i--) { @@ -987,14 +987,19 @@ public class RecentsAnimationController implements DeathRecipient { return mTarget; } - void maybeApplyFinishBounds() { + void onCleanup() { if (!mFinishBounds.isEmpty()) { + // Apply any pending bounds changes final SurfaceControl taskSurface = mTask.getSurfaceControl(); mTask.getPendingTransaction() .setPosition(taskSurface, mFinishBounds.left, mFinishBounds.top) .setWindowCrop(taskSurface, mFinishBounds.width(), mFinishBounds.height()) .apply(); mFinishBounds.setEmpty(); + } else { + // Apply the task's pending transaction in case it is detached and its transaction + // is not reachable. + mTask.getPendingTransaction().apply(); } }