Merge "Defer cleaning up screenshot until after we actually switch to screenshot" into sc-dev am: eb0a38c5f2

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15160033

Change-Id: I4183018dbe6ad644824f842cae259ab0786c9657
This commit is contained in:
Winson Chung 2021-07-01 17:15:48 +00:00 committed by Automerger Merge Worker
commit 2ae6a3e3c9
2 changed files with 10 additions and 7 deletions

View File

@ -384,10 +384,10 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
// Set up a entire animation lifecycle callback to notify the current recents view when
// the animation is canceled
mGestureState.runOnceAtState(STATE_RECENTS_ANIMATION_CANCELED, () -> {
ThumbnailData snapshot = mGestureState.getRecentsAnimationCanceledSnapshot();
ThumbnailData snapshot = mGestureState.consumeRecentsAnimationCanceledSnapshot();
if (snapshot != null) {
RecentsModel.INSTANCE.get(mContext).onTaskSnapshotChanged(
mRecentsView.getRunningTaskId(), snapshot);
mRecentsView.switchToScreenshot(snapshot,
() -> mRecentsAnimationController.cleanupScreenshot());
mRecentsView.onRecentsAnimationComplete();
}
});

View File

@ -376,11 +376,14 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
}
/**
* Returns the canceled animation thumbnail data. This call only returns a value while
* STATE_RECENTS_ANIMATION_CANCELED state is being set.
* Returns and clears the canceled animation thumbnail data. This call only returns a value
* while STATE_RECENTS_ANIMATION_CANCELED state is being set, and the caller is responsible for
* calling {@link RecentsAnimationController#cleanupScreenshot()}.
*/
ThumbnailData getRecentsAnimationCanceledSnapshot() {
return mRecentsAnimationCanceledSnapshot;
ThumbnailData consumeRecentsAnimationCanceledSnapshot() {
ThumbnailData data = mRecentsAnimationCanceledSnapshot;
mRecentsAnimationCanceledSnapshot = null;
return data;
}
void setSwipeUpStartTimeMs(long uptimeMs) {