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
diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java
index 6873899..e3e8ace 100644
--- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java
+++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java
@@ -36,7 +36,6 @@
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 @@
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 @@
Utilities.postAsyncCallback(MAIN_EXECUTOR.getHandler(), toHome
? mController::finishAnimationToHome
: mController::finishAnimationToApp);
- cleanUpRecentsAnimation();
+ cleanUpRecentsAnimation(null /* canceledThumbnail */);
}
}
@@ -146,9 +145,9 @@
/**
* 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 @@
mController = null;
mCallbacks = null;
mTargets = null;
- mCanceledThumbnail = null;
mLastGestureState = null;
}