From b1c71f95abc8555aecfff47a2401febd46646a2f Mon Sep 17 00:00:00 2001 From: LibXZR Date: Sat, 30 Apr 2022 09:50:39 +0800 Subject: [PATCH] Launcher3: Do not attach cleanupScreenshot() to frame update event When the animation get canceled, cleanupScreenshot() should be run instantly because it does something like removing pending animations. The switchToScreenshot() attaches it to RtFrameCallback which only be called on frame update. This is leading to problems as the next frame update may only happened when the next gesture starts, which means all the pending animations will be removed on next gesture. And then the next gesture freezed. Fixes randomly gesture freeze since 12L. Change-Id: I10247294a2dcae467706c434685b299f8b525888 Signed-off-by: LibXZR --- .../com/android/quickstep/AbsSwipeUpHandler.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 0801e1da20..1c2fa34b67 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -505,15 +505,13 @@ public abstract class AbsSwipeUpHandler, HashMap snapshots = mGestureState.consumeRecentsAnimationCanceledSnapshot(); if (snapshots != null) { - mRecentsView.switchToScreenshot(snapshots, () -> { - if (mRecentsAnimationController != null) { - mRecentsAnimationController.cleanupScreenshot(); - } else if (mDeferredCleanupRecentsAnimationController != null) { - mDeferredCleanupRecentsAnimationController.cleanupScreenshot(); - mDeferredCleanupRecentsAnimationController = null; - } - }); mRecentsView.onRecentsAnimationComplete(); + if (mRecentsAnimationController != null) { + mRecentsAnimationController.cleanupScreenshot(); + } else if (mDeferredCleanupRecentsAnimationController != null) { + mDeferredCleanupRecentsAnimationController.cleanupScreenshot(); + mDeferredCleanupRecentsAnimationController = null; + } } });