From 734f2d9f1543eb4dcfac8d6c868aa5fa33cd004a Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Thu, 24 Oct 2019 14:48:04 -0700 Subject: [PATCH] Fix screenshot not getting cleaned up after recents animation cancelation Before this change, mCanceledThumbnail is used but never assigned. Test: Turn on live tile, swipe up to overview from app and observe that the screenshot from recents animation gets properly cleaned up. Fixes: 143307786 Change-Id: I8fba46324c43df661adf12cd1e5d9e06a0a3ee6f --- .../android/quickstep/TaskAnimationManager.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java index 6873899c6b..e3e8ace96b 100644 --- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java +++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java @@ -36,7 +36,6 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn private RecentsAnimationTargets mTargets; // Temporary until we can hook into gesture state events private GestureState mLastGestureState; - private ThumbnailData mCanceledThumbnail; /** * Preloads the recents animation. @@ -81,15 +80,15 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn if (thumbnailData != null) { // If a screenshot is provided, switch to the screenshot before cleaning up activityInterface.switchRunningTaskViewToScreenshot(thumbnailData, - () -> cleanUpRecentsAnimation()); + () -> cleanUpRecentsAnimation(thumbnailData)); } else { - cleanUpRecentsAnimation(); + cleanUpRecentsAnimation(null /* canceledThumbnail */); } } @Override public void onRecentsAnimationFinished(RecentsAnimationController controller) { - cleanUpRecentsAnimation(); + cleanUpRecentsAnimation(null /* canceledThumbnail */); } }); mCallbacks.addListener(gestureState); @@ -119,7 +118,7 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn Utilities.postAsyncCallback(MAIN_EXECUTOR.getHandler(), toHome ? mController::finishAnimationToHome : mController::finishAnimationToApp); - cleanUpRecentsAnimation(); + cleanUpRecentsAnimation(null /* canceledThumbnail */); } } @@ -146,9 +145,9 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn /** * Cleans up the recents animation entirely. */ - private void cleanUpRecentsAnimation() { + private void cleanUpRecentsAnimation(ThumbnailData canceledThumbnail) { // Clean up the screenshot if necessary - if (mController != null && mCanceledThumbnail != null) { + if (mController != null && canceledThumbnail != null) { mController.cleanupScreenshot(); } @@ -165,7 +164,6 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn mController = null; mCallbacks = null; mTargets = null; - mCanceledThumbnail = null; mLastGestureState = null; }