From 7917ff31cc16baee3e463becd74e98859adbe892 Mon Sep 17 00:00:00 2001 From: Jeremy Sim Date: Wed, 14 Sep 2022 21:26:44 -0700 Subject: [PATCH] Fix two bugs with rotation in split select state This CL fixes two bugs that were triggered by rotating in split select state: 1) Rotating in split select state will no longer cause a jittery animation to play 2) Initiating split from home, then rotating will no longer create extra split placeholders on screen The bugs were present because handleSplitSelectionState() animated every state transition into SplitSelect, including SplitSelect > SplitSelect (which happens when rotating). This caused a jittery animation to play, and in certain cases, caused additional copies of FloatingTaskView and SplitInstructionsView to be created. Fixed by auto-skipping animations for SplitSelect > SplitSelect, and by safely removing views when entering SplitSelect (to prevent duplicates). Fixes: 242965515 Fixes: 243088958 Test: Verified visually on-device. Change-Id: Iab813b1fe599bfdc550fe9a1d354b28cedb4b659 --- .../RecentsViewStateController.java | 34 +++++++++++-------- .../android/quickstep/views/RecentsView.java | 27 +++++++++------ 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java index 420c64ad9e..0723f8abfd 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java @@ -27,6 +27,7 @@ import static com.android.quickstep.views.RecentsView.TASK_PRIMARY_SPLIT_TRANSLA import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_SPLIT_TRANSLATION; import static com.android.quickstep.views.TaskView.FLAG_UPDATE_ALL; +import android.animation.AnimatorSet; import android.annotation.TargetApi; import android.os.Build; import android.util.FloatProperty; @@ -108,6 +109,13 @@ public final class RecentsViewStateController extends */ private void handleSplitSelectionState(@NonNull LauncherState toState, @NonNull PendingAnimation builder, boolean animate) { + if (toState != OVERVIEW_SPLIT_SELECT) { + // Not going to split, nothing to do but ensure taskviews are at correct offset + mRecentsView.resetSplitPrimaryScrollOffset(); + return; + } + + // Create transition animations to split select PagedOrientationHandler orientationHandler = ((RecentsView) mLauncher.getOverviewPanel()).getPagedOrientationHandler(); Pair taskViewsFloat = @@ -115,22 +123,20 @@ public final class RecentsViewStateController extends TASK_PRIMARY_SPLIT_TRANSLATION, TASK_SECONDARY_SPLIT_TRANSLATION, mLauncher.getDeviceProfile()); - if (toState == OVERVIEW_SPLIT_SELECT) { - mRecentsView.createSplitSelectInitAnimation(builder, - toState.getTransitionDuration(mLauncher, true /* isToState */)); - // Add properties to shift remaining taskViews to get out of placeholder view - builder.setFloat(mRecentsView, taskViewsFloat.first, - toState.getSplitSelectTranslation(mLauncher), LINEAR); - builder.setFloat(mRecentsView, taskViewsFloat.second, 0, LINEAR); + mRecentsView.createSplitSelectInitAnimation(builder, + toState.getTransitionDuration(mLauncher, true /* isToState */)); + // Add properties to shift remaining taskViews to get out of placeholder view + builder.setFloat(mRecentsView, taskViewsFloat.first, + toState.getSplitSelectTranslation(mLauncher), LINEAR); + builder.setFloat(mRecentsView, taskViewsFloat.second, 0, LINEAR); - if (!animate) { - builder.buildAnim().start(); - } - - mRecentsView.applySplitPrimaryScrollOffset(); - } else { - mRecentsView.resetSplitPrimaryScrollOffset(); + if (!animate) { + AnimatorSet as = builder.buildAnim(); + as.start(); + as.end(); } + + mRecentsView.applySplitPrimaryScrollOffset(); } private void setAlphas(PropertySetter propertySetter, StateAnimationConfig config, diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 8da08b4007..3687f3638f 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -2858,6 +2858,7 @@ public abstract class RecentsView