From ff076f85d6e3c9f537ea022ee15b10c7a1e97225 Mon Sep 17 00:00:00 2001 From: vinayjoglekar Date: Wed, 11 Dec 2024 12:01:41 +0000 Subject: [PATCH] Fix for split animation While splitting focus task, there is a timing issue of focus task being animated first and then small tiles. This CL fixes that makes animation smooth i.e. animate stage task(focus task) and other small tiles together. Also refactored animationStartProgress and animationEndProgress initialisation by adding "if/else" for readability. Test: Manual.Split focus task.(RTL as well) Fix: 383417963 Flag: com.android.launcher3.enable_large_desktop_windowing_tile Change-Id: I7b8c651d91168802b930fdeac62e762a2be9dbe9 --- .../android/quickstep/views/RecentsView.java | 59 +++++++++++-------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 3b463674b4..9204d7514b 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -3904,25 +3904,40 @@ public abstract class RecentsView< : distanceFromDismissedTask; // Set timings based on if user is initiating splitscreen on the focused task, // or splitting/dismissing some other task. - float animationStartProgress = isSlidingTasks - ? Utilities.boundToRange( - splitTimings.getGridSlideStartOffset() - + (splitTimings.getGridSlideStaggerOffset() - * staggerColumn), - 0f, - dismissTranslationInterpolationEnd) - : Utilities.boundToRange( - INITIAL_DISMISS_TRANSLATION_INTERPOLATION_OFFSET - + ADDITIONAL_DISMISS_TRANSLATION_INTERPOLATION_OFFSET - * staggerColumn, 0f, dismissTranslationInterpolationEnd); - float animationEndProgress = isSlidingTasks - ? Utilities.boundToRange( - splitTimings.getGridSlideStartOffset() - + (splitTimings.getGridSlideStaggerOffset() * staggerColumn) - + splitTimings.getGridSlideDurationOffset(), - 0f, - dismissTranslationInterpolationEnd) - : dismissTranslationInterpolationEnd; + final float animationStartProgress; + if (isSlidingTasks) { + float slidingStartOffset = splitTimings.getGridSlideStartOffset() + + (splitTimings.getGridSlideStaggerOffset() * staggerColumn); + if (areAllDesktopTasksDismissed) { + animationStartProgress = Utilities.boundToRange( + slidingStartOffset + + splitTimings.getDesktopFadeSplitAnimationEndOffset(), + 0f, + dismissTranslationInterpolationEnd); + } else { + animationStartProgress = Utilities.boundToRange( + slidingStartOffset, + 0f, + dismissTranslationInterpolationEnd); + } + } else { + animationStartProgress = Utilities.boundToRange( + INITIAL_DISMISS_TRANSLATION_INTERPOLATION_OFFSET + + ADDITIONAL_DISMISS_TRANSLATION_INTERPOLATION_OFFSET + * staggerColumn, 0f, dismissTranslationInterpolationEnd); + } + + final float animationEndProgress; + if (isSlidingTasks && taskView != nextFocusedTaskView) { + animationEndProgress = Utilities.boundToRange( + splitTimings.getGridSlideStartOffset() + + (splitTimings.getGridSlideStaggerOffset() * staggerColumn) + + splitTimings.getGridSlideDurationOffset(), + 0f, + dismissTranslationInterpolationEnd); + } else { + animationEndProgress = dismissTranslationInterpolationEnd; + } Interpolator dismissInterpolator = isSlidingTasks ? EMPHASIZED : LINEAR; @@ -3934,7 +3949,6 @@ public abstract class RecentsView< clampToProgress(LINEAR, animationStartProgress, dismissTranslationInterpolationEnd)); primaryTranslation += dismissedTaskWidth; - animationEndProgress = dismissTranslationInterpolationEnd; float secondaryTranslation = -mTaskGridVerticalDiff; if (!nextFocusedTaskFromTop) { secondaryTranslation -= mTopBottomRowHeightDiff; @@ -3962,11 +3976,6 @@ public abstract class RecentsView< startTranslation = isTaskViewVisible(taskView) ? 0 : finalTranslation + (mIsRtl ? -mLastComputedTaskSize.right : mLastComputedTaskSize.right); - animationStartProgress = Utilities.boundToRange( - animationStartProgress - + splitTimings.getDesktopFadeSplitAnimationEndOffset(), - 0f, - dismissTranslationInterpolationEnd); } Animator dismissAnimator = ObjectAnimator.ofFloat(taskView, taskView.getPrimaryDismissTranslationProperty(),