From 42e30963c371399317a7c10be924fcdc2f19c16d Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Mon, 28 Mar 2022 23:58:36 -0700 Subject: [PATCH] Play icon alignment animation in live tile mode aka launcher is not resumed but recents animation is running Fixes: 210047102 Test: Go to overview in live tile mode, tap on somewhere outside any task in overview, and make sure icon alignment animation is played. Change-Id: Ic300ee296049b6fdcdf6d2595916cc84c09d95fa --- .../taskbar/TaskbarLauncherStateController.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index eed67b62c2..6c89f534d8 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -26,6 +26,7 @@ import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.BaseQuickstepLauncher; @@ -74,6 +75,8 @@ import java.util.function.Supplier; private int mState; private LauncherState mLauncherState = LauncherState.NORMAL; + private @Nullable TaskBarRecentsAnimationListener mTaskBarRecentsAnimationListener; + private boolean mIsAnimatingToLauncherViaGesture; private boolean mIsAnimatingToLauncherViaResume; @@ -163,12 +166,11 @@ import java.util.function.Supplier; animatorSet.play(stashController.applyStateWithoutStart(duration)); animatorSet.play(applyState(duration, false)); - TaskBarRecentsAnimationListener listener = new TaskBarRecentsAnimationListener(callbacks); - callbacks.addListener(listener); + mTaskBarRecentsAnimationListener = new TaskBarRecentsAnimationListener(callbacks); + callbacks.addListener(mTaskBarRecentsAnimationListener); RecentsView recentsView = mLauncher.getOverviewPanel(); recentsView.setTaskLaunchListener(() -> { - listener.endGestureStateOverride(true); - callbacks.removeListener(listener); + mTaskBarRecentsAnimationListener.endGestureStateOverride(true); }); return animatorSet; } @@ -379,7 +381,7 @@ import java.util.function.Supplier; } private void onIconAlignmentRatioChangedForStateTransition() { - if (!isResumed()) { + if (!isResumed() && mTaskBarRecentsAnimationListener == null) { return; } onIconAlignmentRatioChanged(this::getCurrentIconAlignmentRatioForLauncherState); @@ -455,6 +457,7 @@ import java.util.function.Supplier; private void endGestureStateOverride(boolean finishedToApp) { mCallbacks.removeListener(this); + mTaskBarRecentsAnimationListener = null; // Update the resumed state immediately to ensure a seamless handoff boolean launcherResumed = !finishedToApp;