From a50cf9772a57e0058ba36e742beb37da11b27a41 Mon Sep 17 00:00:00 2001 From: Tony Date: Wed, 31 Jul 2019 18:53:40 -0700 Subject: Don't end launcher components anim early even if it does nothing The janky animation that ends on the home screen with an invisible task on top is caused by the following scenario (for example): - Quick switch from task A to task B - After landing on B, but before we get the callback that it was successfully launched, switch back to A (or you could go to C) Now we are animating back to A, but we are still waiting to hear whether B was successfully launched. If we hear that the launch was indeed successful, we dutifully clean up after ourselves by returning launcher to its default state. Unfortunately, that clobbers the current animation that is scrolling back to A, and we end up in the bad state where we are showing the default launcher state even though we just launched task B and were about to launch task A. Normally we avoid cleaning up the state animation if the user is still controlling it. The reason we weren't doing that here is because we ended the launcher animation early even though the window animation was still running. Instead, we should keep the launcher animation running for the full duration, so that it prevents a cleanup from occurring in the middle. Bug: 138620399 Change-Id: I959e62a52638a5b974ef9b406555078c928b91f1 (cherry picked from commit 03c548901fb77d0a47bb46036d559968b65b2293) (cherry picked from commit c5555c459bd28033257bced610c861e5ff84aec4) --- .../com/android/quickstep/WindowTransformSwipeHandler.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java index ac7ba3fc3..476bb8f93 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java @@ -1133,17 +1133,16 @@ public class WindowTransformSwipeHandler } if (start == end || duration <= 0) { mLauncherTransitionController.dispatchSetInterpolator(t -> end); - mLauncherTransitionController.getAnimationPlayer().end(); } else { mLauncherTransitionController.dispatchSetInterpolator(adjustedInterpolator); mAnimationFactory.adjustActivityControllerInterpolators(); - mLauncherTransitionController.getAnimationPlayer().setDuration(duration); + } + mLauncherTransitionController.getAnimationPlayer().setDuration(Math.max(0, duration)); - if (QUICKSTEP_SPRINGS.get()) { - mLauncherTransitionController.dispatchOnStartWithVelocity(end, velocityPxPerMs.y); - } - mLauncherTransitionController.getAnimationPlayer().start(); + if (QUICKSTEP_SPRINGS.get()) { + mLauncherTransitionController.dispatchOnStartWithVelocity(end, velocityPxPerMs.y); } + mLauncherTransitionController.getAnimationPlayer().start(); mHasLauncherTransitionControllerStarted = true; } -- cgit v1.2.3