diff --git a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java index dbaeafbee2..2eced74849 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java @@ -112,7 +112,8 @@ public abstract class BaseRecentsViewStateController boolean exitingOverview = !FeatureFlags.enableSplitContextually() && !toState.overviewUi; if (mRecentsView.isSplitSelectionActive() && exitingOverview) { setter.add(mRecentsView.getSplitSelectController().getSplitAnimationController() - .createPlaceholderDismissAnim(mLauncher, LAUNCHER_SPLIT_SELECTION_EXIT_HOME)); + .createPlaceholderDismissAnim(mLauncher, LAUNCHER_SPLIT_SELECTION_EXIT_HOME, + setter.getDuration())); setter.setViewAlpha( mRecentsView.getSplitInstructionsView(), 0, diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 7558b0097e..2c45129b8b 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -200,7 +200,7 @@ import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.Optional; -import java.util.function.Consumer; +import java.util.function.BiConsumer; import java.util.function.Predicate; import java.util.stream.Stream; @@ -599,9 +599,10 @@ public class QuickstepLauncher extends Launcher { ArrayList list = new ArrayList<>(); list.add(getDragController()); - Consumer splitAnimator = animatorSet -> + BiConsumer splitAnimator = (animatorSet, duration) -> animatorSet.play(mSplitSelectStateController.getSplitAnimationController() - .createPlaceholderDismissAnim(this, LAUNCHER_SPLIT_SELECTION_EXIT_HOME)); + .createPlaceholderDismissAnim(this, LAUNCHER_SPLIT_SELECTION_EXIT_HOME, + duration)); switch (mode) { case NO_BUTTON: list.add(new NoButtonQuickSwitchTouchController(this)); diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java index 82a9c058df..e8b508168d 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java @@ -54,7 +54,7 @@ import com.android.quickstep.util.AnimatorControllerWithResistance; import com.android.quickstep.util.OverviewToHomeAnim; import com.android.quickstep.views.RecentsView; -import java.util.function.Consumer; +import java.util.function.BiConsumer; /** * Handles swiping up on the nav bar to go home from launcher, e.g. overview or all apps. @@ -67,7 +67,7 @@ public class NavBarToHomeTouchController implements TouchController, private static final float OVERVIEW_TO_HOME_SCRIM_MULTIPLIER = 0.5f; private final Launcher mLauncher; - private final Consumer mCancelSplitRunnable; + private final BiConsumer mCancelSplitRunnable; private final SingleAxisSwipeDetector mSwipeDetector; private final float mPullbackDistance; @@ -81,7 +81,7 @@ public class NavBarToHomeTouchController implements TouchController, * Animation should be added to the provided AnimatorSet */ public NavBarToHomeTouchController(Launcher launcher, - Consumer cancelSplitRunnable) { + BiConsumer cancelSplitRunnable) { mLauncher = launcher; mCancelSplitRunnable = cancelSplitRunnable; mSwipeDetector = new SingleAxisSwipeDetector(mLauncher, this, diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java index fc3eeba412..26e994f4e4 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java @@ -56,7 +56,7 @@ import com.android.quickstep.util.OverviewToHomeAnim; import com.android.quickstep.views.RecentsView; import com.android.systemui.shared.system.InteractionJankMonitorWrapper; -import java.util.function.Consumer; +import java.util.function.BiConsumer; /** * Touch controller which handles swipe and hold from the nav bar to go to Overview. Swiping above @@ -72,7 +72,7 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch private static final float TRANSLATION_ANIM_VELOCITY_DP_PER_MS = 0.8f; private final VibratorWrapper mVibratorWrapper; - private final Consumer mCancelSplitRunnable; + private final BiConsumer mCancelSplitRunnable; private final RecentsView mRecentsView; private final MotionPauseDetector mMotionPauseDetector; private final float mMotionPauseMinDisplacement; @@ -93,7 +93,7 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch * Animation should be added to the provided AnimatorSet */ public NoButtonNavbarToOverviewTouchController(Launcher l, - Consumer cancelSplitRunnable) { + BiConsumer cancelSplitRunnable) { super(l); mRecentsView = l.getOverviewPanel(); mMotionPauseDetector = new MotionPauseDetector(l); @@ -208,9 +208,10 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch // Normally we compute the duration based on the velocity and distance to the given // state, but since the hint state tracks the entire screen without a clear endpoint, we // need to manually set the duration to a reasonable value. - animator.setDuration(HINT_STATE.getTransitionDuration(mLauncher, true /* isToState */)); + long duration = HINT_STATE.getTransitionDuration(mLauncher, true /* isToState */); + animator.setDuration(duration); AnimatorSet animatorSet = new AnimatorSet(); - mCancelSplitRunnable.accept(animatorSet); + mCancelSplitRunnable.accept(animatorSet, duration); animatorSet.start(); } if (FeatureFlags.ENABLE_PREMIUM_HAPTICS_ALL_APPS.get() && diff --git a/quickstep/src/com/android/quickstep/util/OverviewToHomeAnim.java b/quickstep/src/com/android/quickstep/util/OverviewToHomeAnim.java index 6d9ecd9534..132d1c1390 100644 --- a/quickstep/src/com/android/quickstep/util/OverviewToHomeAnim.java +++ b/quickstep/src/com/android/quickstep/util/OverviewToHomeAnim.java @@ -30,7 +30,7 @@ import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.statemanager.StateManager; import com.android.launcher3.states.StateAnimationConfig; -import java.util.function.Consumer; +import java.util.function.BiConsumer; /** * Runs an animation from overview to home. Currently, this animation is just a wrapper around the @@ -44,14 +44,14 @@ public class OverviewToHomeAnim { private final Launcher mLauncher; private final Runnable mOnReachedHome; @Nullable - private final Consumer mSplitCancelConsumer; + private final BiConsumer mSplitCancelConsumer; // Only run mOnReachedHome when both of these are true. private boolean mIsHomeStaggeredAnimFinished; private boolean mIsOverviewHidden; public OverviewToHomeAnim(Launcher launcher, Runnable onReachedHome, - @Nullable Consumer splitCancelConsumer) { + @Nullable BiConsumer splitCancelConsumer) { mLauncher = launcher; mOnReachedHome = onReachedHome; mSplitCancelConsumer = splitCancelConsumer; @@ -103,7 +103,7 @@ public class OverviewToHomeAnim { if (mSplitCancelConsumer != null) { // Clear split state when swiping to home - mSplitCancelConsumer.accept(anim); + mSplitCancelConsumer.accept(anim, config.duration); } anim.play(stateAnim); stateManager.setCurrentAnimation(anim, NORMAL); diff --git a/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt b/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt index 1eb71fc92a..b7b1d8f754 100644 --- a/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt +++ b/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt @@ -242,7 +242,7 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC return } - val anim = createPlaceholderDismissAnim(launcher, splitDismissEvent) + val anim = createPlaceholderDismissAnim(launcher, splitDismissEvent, null /*duration*/) anim.start() } @@ -251,8 +251,10 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC * for why split is being dismissed */ fun createPlaceholderDismissAnim(launcher: StatefulActivity<*>, - splitDismissEvent: EventEnum) : AnimatorSet { + splitDismissEvent: EventEnum, + duration: Long?) : AnimatorSet { val animatorSet = AnimatorSet() + duration?.let { animatorSet.duration = it } val recentsView : RecentsView<*, *> = launcher.getOverviewPanel() val floatingTask: FloatingTaskView = splitSelectStateController.firstFloatingTaskView ?: return animatorSet