From 4888790bde0df44eea9f53a9865470e9f54e9321 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Mon, 11 May 2020 13:48:18 -0700 Subject: [PATCH] Simplifying animation creating logic for app-to-overview Removing optional 'shouldAnimate' flag. This was false only in 3-button mode but the code was also handling animation, leading to inconsistent expectations. Instead always assuming animation and finishing the animation promptly. Change-Id: Ic56476dc5ea64c9a7d7e9744f3e33cd61dfde9e8 --- .../AppToOverviewAnimationProvider.java | 11 +-- .../quickstep/FallbackActivityInterface.java | 16 ++-- .../quickstep/LauncherActivityInterface.java | 88 +++++++------------ .../quickstep/LauncherSwipeHandler.java | 3 +- .../quickstep/BaseActivityInterface.java | 4 +- .../launcher3/anim/PendingAnimation.java | 7 ++ 6 files changed, 50 insertions(+), 79 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java index 1eb3becf10..1dd5fb7a57 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java @@ -17,7 +17,6 @@ package com.android.quickstep; import static com.android.launcher3.LauncherState.BACKGROUND_APP; import static com.android.launcher3.LauncherState.OVERVIEW; -import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN; import static com.android.launcher3.anim.Interpolators.TOUCH_RESPONSE_INTERPOLATOR; import static com.android.launcher3.statehandlers.DepthController.DEPTH; import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING; @@ -75,14 +74,10 @@ final class AppToOverviewAnimationProvider exten boolean onActivityReady(T activity, Boolean wasVisible) { activity.getOverviewPanel().showCurrentTask(mTargetTaskId); AbstractFloatingView.closeAllOpenViews(activity, wasVisible); - BaseActivityInterface.AnimationFactory factory = - mActivityInterface.prepareRecentsUI(wasVisible, - false /* animate activity */, (controller) -> { + BaseActivityInterface.AnimationFactory factory = mActivityInterface.prepareRecentsUI( + wasVisible, (controller) -> { controller.dispatchOnStart(); - ValueAnimator anim = controller.getAnimationPlayer() - .setDuration(RECENTS_LAUNCH_DURATION); - anim.setInterpolator(FAST_OUT_SLOW_IN); - anim.start(); + controller.getAnimationPlayer().end(); }); factory.onRemoteAnimationReceived(null); factory.createActivityInterface(RECENTS_LAUNCH_DURATION); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java index 4ce972e422..324c390edf 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java @@ -86,8 +86,8 @@ public final class FallbackActivityInterface implements } @Override - public AnimationFactory prepareRecentsUI(boolean activityVisible, - boolean animateActivity, Consumer callback) { + public AnimationFactory prepareRecentsUI( + boolean activityVisible, Consumer callback) { RecentsActivity activity = getCreatedActivity(); if (activityVisible) { return (transitionLength) -> { }; @@ -97,9 +97,7 @@ public final class FallbackActivityInterface implements rv.setContentAlpha(0); rv.getClearAllButton().setVisibilityAlpha(0); rv.setDisallowScrollToClearAll(true); - - boolean fromState = !animateActivity; - rv.setInOverviewState(fromState); + rv.setInOverviewState(false); return new AnimationFactory() { @@ -132,12 +130,8 @@ public final class FallbackActivityInterface implements AnimatorPlaybackController.wrap(animatorSet, transitionLength); // Since we are changing the start position of the UI, reapply the state, at the end - controller.setEndAction(() -> { - boolean endState = true; - rv.setInOverviewState(controller.getInterpolatedProgress() > 0.5 ? - endState : fromState); - }); - + controller.setEndAction(() -> + rv.setInOverviewState(controller.getInterpolatedProgress() > 0.5)); callback.accept(controller); } }; diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java index 9495338d4f..9ff5d9428f 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java @@ -27,10 +27,9 @@ import static com.android.launcher3.uioverrides.states.QuickstepAtomicAnimationF import static com.android.quickstep.LauncherSwipeHandler.RECENTS_ATTACH_DURATION; import static com.android.quickstep.util.WindowSizeStrategy.LAUNCHER_ACTIVITY_SIZE_STRATEGY; import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET; +import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS; import android.animation.Animator; -import android.animation.AnimatorSet; -import android.animation.ObjectAnimator; import android.content.Context; import android.graphics.Rect; import android.util.Log; @@ -47,6 +46,7 @@ import com.android.launcher3.LauncherInitListener; import com.android.launcher3.LauncherState; import com.android.launcher3.allapps.DiscoveryBounce; import com.android.launcher3.anim.AnimatorPlaybackController; +import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.appprediction.PredictionUiStateManager; import com.android.launcher3.statehandlers.DepthController; import com.android.launcher3.statehandlers.DepthController.ClampedDepthProperty; @@ -134,8 +134,8 @@ public final class LauncherActivityInterface implements BaseActivityInterface callback) { + public AnimationFactory prepareRecentsUI( + boolean activityVisible, Consumer callback) { BaseQuickstepLauncher launcher = getCreatedActivity(); final LauncherState startState = launcher.getStateManager().getState(); @@ -145,8 +145,7 @@ public final class LauncherActivityInterface implements BaseActivityInterface