From d844fe758c880447bff8708646ecfcd92e98ba06 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Thu, 13 Aug 2020 19:33:26 -0700 Subject: [PATCH] Remove ENABLE_OVERVIEW_ACTIONS flag, defaulting to true We no longer support the "peeking" model where the shelf would peek on motion pause from an app and overview would peek on motion pause from home. Thus, removed/inlined the following: - FlingAndHoldTouchController (merged into its sole subclass NoButtonNavbarToOverviewTouchController) - ShelfPeekAnim - OverviewPeekState Change-Id: I066a3ad2636fde4786089c922b896bf1e03361fd --- quickstep/res/values/dimens.xml | 1 - .../launcher3/BaseQuickstepLauncher.java | 9 +- .../uioverrides/QuickstepLauncher.java | 12 +- .../uioverrides/states/AllAppsState.java | 13 +- .../uioverrides/states/OverviewPeekState.java | 31 -- .../uioverrides/states/OverviewState.java | 12 +- .../QuickstepAtomicAnimationFactory.java | 28 +- .../FlingAndHoldTouchController.java | 279 ------------------ ...ButtonNavbarToOverviewTouchController.java | 121 ++++++-- .../NoButtonQuickSwitchTouchController.java | 40 --- .../PortraitStatesTouchController.java | 15 +- .../android/quickstep/AbsSwipeUpHandler.java | 35 +-- .../quickstep/BaseActivityInterface.java | 8 +- .../quickstep/LauncherActivityInterface.java | 8 - .../QuickstepTestInformationHandler.java | 6 - .../quickstep/TaskShortcutFactory.java | 12 +- .../android/quickstep/util/LayoutUtils.java | 3 +- .../util/QuickstepOnboardingPrefs.java | 4 +- .../android/quickstep/util/ShelfPeekAnim.java | 105 ------- .../quickstep/views/OverviewActionsView.java | 12 +- .../quickstep/views/ShelfScrimView.java | 14 +- src/com/android/launcher3/Launcher.java | 5 +- src/com/android/launcher3/LauncherState.java | 3 - .../launcher3/config/FeatureFlags.java | 4 - .../launcher3/testing/TestProtocol.java | 14 +- .../uioverrides/states/OverviewState.java | 4 - .../tapl/LauncherInstrumentation.java | 13 +- 27 files changed, 147 insertions(+), 664 deletions(-) delete mode 100644 quickstep/src/com/android/launcher3/uioverrides/states/OverviewPeekState.java delete mode 100644 quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java delete mode 100644 quickstep/src/com/android/quickstep/util/ShelfPeekAnim.java diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index f9f1051672..313db8ccaf 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -30,7 +30,6 @@ 10dp 70dp - 96dp diff --git a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java index 235df425b4..a0016cb905 100644 --- a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java @@ -50,7 +50,6 @@ import com.android.quickstep.SystemUiProxy; import com.android.quickstep.util.QuickstepOnboardingPrefs; import com.android.quickstep.util.RemoteAnimationProvider; import com.android.quickstep.util.RemoteFadeOutAnimationListener; -import com.android.quickstep.util.ShelfPeekAnim; import com.android.quickstep.views.OverviewActionsView; import com.android.quickstep.views.RecentsView; import com.android.systemui.shared.system.ActivityManagerWrapper; @@ -73,8 +72,6 @@ public abstract class BaseQuickstepLauncher extends Launcher (context, arg1, arg2) -> SystemUiProxy.INSTANCE.get(context).setBackButtonAlpha( Float.intBitsToFloat(arg1), arg2 != 0); - private final ShelfPeekAnim mShelfPeekAnim = new ShelfPeekAnim(this); - private OverviewActionsView mActionsView; protected HotseatPredictionController mHotseatPredictionController; @@ -196,7 +193,7 @@ public abstract class BaseQuickstepLauncher extends Launcher } private boolean isOverviewActionsEnabled() { - return FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(this); + return removeShelfFromOverview(this); } public T getActionsView() { @@ -317,10 +314,6 @@ public abstract class BaseQuickstepLauncher extends Launcher Stream.of(WellbeingModel.SHORTCUT_FACTORY)); } - public ShelfPeekAnim getShelfPeekAnim() { - return mShelfPeekAnim; - } - /** * Returns Prediction controller for hybrid hotseat */ diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 4107698621..f7bc0b32d4 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -60,7 +60,6 @@ import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.statemanager.StateManager.AtomicAnimationFactory; import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.uioverrides.states.QuickstepAtomicAnimationFactory; -import com.android.launcher3.uioverrides.touchcontrollers.FlingAndHoldTouchController; import com.android.launcher3.uioverrides.touchcontrollers.LandscapeEdgeSwipeController; import com.android.launcher3.uioverrides.touchcontrollers.NavBarToHomeTouchController; import com.android.launcher3.uioverrides.touchcontrollers.NoButtonNavbarToOverviewTouchController; @@ -80,8 +79,8 @@ import com.android.quickstep.SysUINavigationMode.Mode; import com.android.quickstep.SystemUiProxy; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; - import com.android.systemui.shared.system.ActivityManagerWrapper; + import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; @@ -306,14 +305,7 @@ public class QuickstepLauncher extends BaseQuickstepLauncher { if (TestProtocol.sDebugTracing) { Log.d(TestProtocol.PAUSE_NOT_DETECTED, "createTouchControllers.2"); } - if (FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get()) { - if (TestProtocol.sDebugTracing) { - Log.d(TestProtocol.PAUSE_NOT_DETECTED, "createTouchControllers.3"); - } - list.add(new NoButtonNavbarToOverviewTouchController(this)); - } else { - list.add(new FlingAndHoldTouchController(this)); - } + list.add(new NoButtonNavbarToOverviewTouchController(this)); } else { if (getDeviceProfile().isVerticalBarLayout()) { list.add(new OverviewToAllAppsTouchController(this)); diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java index 29a6be0779..bce73cd4e4 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java @@ -16,8 +16,6 @@ package com.android.launcher3.uioverrides.states; import static com.android.launcher3.anim.Interpolators.DEACCEL_2; -import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS; -import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview; import android.content.Context; @@ -26,7 +24,6 @@ import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.allapps.AllAppsContainerView; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; -import com.android.quickstep.SysUINavigationMode; /** * Definition for AllApps state @@ -66,13 +63,7 @@ public class AllAppsState extends LauncherState { public ScaleAndTranslation getWorkspaceScaleAndTranslation(Launcher launcher) { ScaleAndTranslation scaleAndTranslation = LauncherState.OVERVIEW .getWorkspaceScaleAndTranslation(launcher); - if (SysUINavigationMode.getMode(launcher) == NO_BUTTON && !ENABLE_OVERVIEW_ACTIONS.get()) { - float normalScale = 1; - // Scale down halfway to where we'd be in overview, to prepare for a potential pause. - scaleAndTranslation.scale = (scaleAndTranslation.scale + normalScale) / 2; - } else { - scaleAndTranslation.scale = 1; - } + scaleAndTranslation.scale = 1; return scaleAndTranslation; } @@ -93,7 +84,7 @@ public class AllAppsState extends LauncherState { @Override public float[] getOverviewScaleAndOffset(Launcher launcher) { - float offset = ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(launcher) ? 1 : 0; + float offset = removeShelfFromOverview(launcher) ? 1 : 0; return new float[] {0.9f, offset}; } diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewPeekState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewPeekState.java deleted file mode 100644 index fc9a11bf66..0000000000 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewPeekState.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.launcher3.uioverrides.states; - -import com.android.launcher3.Launcher; - -public class OverviewPeekState extends OverviewState { - private static final float OVERVIEW_OFFSET = 0.7f; - - public OverviewPeekState(int id) { - super(id); - } - - @Override - public float[] getOverviewScaleAndOffset(Launcher launcher) { - return new float[] {NO_SCALE, OVERVIEW_OFFSET}; - } -} diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java index d174bfd2d9..6ec114e216 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java @@ -16,7 +16,6 @@ package com.android.launcher3.uioverrides.states; import static com.android.launcher3.anim.Interpolators.DEACCEL_2; -import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS; import static com.android.launcher3.logging.LoggerUtils.newContainerTarget; import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; import static com.android.quickstep.SysUINavigationMode.hideShelfInTwoButtonLandscape; @@ -65,7 +64,7 @@ public class OverviewState extends LauncherState { public int getTransitionDuration(Context context) { // In no-button mode, overview comes in all the way from the left, so give it more time. boolean isNoButtonMode = SysUINavigationMode.INSTANCE.get(context).getMode() == NO_BUTTON; - return isNoButtonMode && ENABLE_OVERVIEW_ACTIONS.get() ? 380 : 250; + return isNoButtonMode ? 380 : 250; } @Override @@ -108,8 +107,7 @@ public class OverviewState extends LauncherState { @Override public ScaleAndTranslation getQsbScaleAndTranslation(Launcher launcher) { - if (this == OVERVIEW && ENABLE_OVERVIEW_ACTIONS.get() - && removeShelfFromOverview(launcher)) { + if (this == OVERVIEW && removeShelfFromOverview(launcher)) { // Treat the QSB as part of the hotseat so they move together. return getHotseatScaleAndTranslation(launcher); } @@ -129,7 +127,7 @@ public class OverviewState extends LauncherState { @Override public int getVisibleElements(Launcher launcher) { RecentsView recentsView = launcher.getOverviewPanel(); - if (ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(launcher) || + if (removeShelfFromOverview(launcher) || hideShelfInTwoButtonLandscape(launcher, recentsView.getPagedOrientationHandler())) { return OVERVIEW_BUTTONS; } else if (launcher.getDeviceProfile().isVerticalBarLayout()) { @@ -191,10 +189,6 @@ public class OverviewState extends LauncherState { return new BackgroundAppState(id); } - public static OverviewState newPeekState(int id) { - return new OverviewPeekState(id); - } - public static OverviewState newSwitchState(int id) { return new QuickSwitchState(id); } diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java index daa1aadbae..94af134de5 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java @@ -22,28 +22,24 @@ import static com.android.launcher3.LauncherState.HINT_STATE; import static com.android.launcher3.LauncherState.HOTSEAT_ICONS; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; -import static com.android.launcher3.LauncherState.OVERVIEW_PEEK; import static com.android.launcher3.WorkspaceStateTransitionAnimation.getSpringScaleAnimator; import static com.android.launcher3.anim.Interpolators.ACCEL; import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL; import static com.android.launcher3.anim.Interpolators.DEACCEL; import static com.android.launcher3.anim.Interpolators.DEACCEL_1_7; import static com.android.launcher3.anim.Interpolators.DEACCEL_3; -import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN; import static com.android.launcher3.anim.Interpolators.FINAL_FRAME; import static com.android.launcher3.anim.Interpolators.INSTANT; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_2; import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_7; import static com.android.launcher3.anim.Interpolators.clampToProgress; -import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS; import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_DEPTH; import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_SCALE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_TRANSLATE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE; -import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCRIM_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y; import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PROGRESS; @@ -190,23 +186,14 @@ public class QuickstepAtomicAnimationFactory extends if (!isHotseatVisible) { hotseat.setScaleX(0.92f); hotseat.setScaleY(0.92f); - if (ENABLE_OVERVIEW_ACTIONS.get()) { - AllAppsContainerView qsbContainer = mActivity.getAppsView(); - View qsb = qsbContainer.getSearchView(); - boolean qsbVisible = qsb.getVisibility() == VISIBLE && qsb.getAlpha() > 0; - if (!qsbVisible) { - qsbContainer.setScaleX(0.92f); - qsbContainer.setScaleY(0.92f); - } + AllAppsContainerView qsbContainer = mActivity.getAppsView(); + View qsb = qsbContainer.getSearchView(); + boolean qsbVisible = qsb.getVisibility() == VISIBLE && qsb.getAlpha() > 0; + if (!qsbVisible) { + qsbContainer.setScaleX(0.92f); + qsbContainer.setScaleY(0.92f); } } - } else if (toState == NORMAL && fromState == OVERVIEW_PEEK) { - // Keep fully visible until the very end (when overview is offscreen) to make invisible. - config.setInterpolator(ANIM_OVERVIEW_FADE, FINAL_FRAME); - } else if (toState == OVERVIEW_PEEK && fromState == NORMAL) { - config.setInterpolator(ANIM_OVERVIEW_FADE, INSTANT); - config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, OVERSHOOT_1_7); - config.setInterpolator(ANIM_OVERVIEW_SCRIM_FADE, FAST_OUT_SLOW_IN); } else if ((fromState == NORMAL || fromState == HINT_STATE) && toState == OVERVIEW) { if (SysUINavigationMode.getMode(mActivity) == NO_BUTTON) { config.setInterpolator(ANIM_WORKSPACE_SCALE, @@ -227,8 +214,7 @@ public class QuickstepAtomicAnimationFactory extends config.setInterpolator(ANIM_ALL_APPS_FADE, OVERSHOOT_1_2); config.setInterpolator(ANIM_OVERVIEW_SCALE, OVERSHOOT_1_2); config.setInterpolator(ANIM_DEPTH, OVERSHOOT_1_2); - Interpolator translationInterpolator = ENABLE_OVERVIEW_ACTIONS.get() - && removeShelfFromOverview(mActivity) + Interpolator translationInterpolator = removeShelfFromOverview(mActivity) ? OVERSHOOT_1_2 : OVERSHOOT_1_7; config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, translationInterpolator); diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java deleted file mode 100644 index fac478e777..0000000000 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.launcher3.uioverrides.touchcontrollers; - -import static com.android.launcher3.LauncherState.ALL_APPS; -import static com.android.launcher3.LauncherState.NORMAL; -import static com.android.launcher3.LauncherState.OVERVIEW; -import static com.android.launcher3.LauncherState.OVERVIEW_PEEK; -import static com.android.launcher3.anim.Interpolators.ACCEL; -import static com.android.launcher3.anim.Interpolators.DEACCEL; -import static com.android.launcher3.anim.Interpolators.DEACCEL_3; -import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE; -import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_HEADER_FADE; -import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE; -import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE; -import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE; -import static com.android.launcher3.states.StateAnimationConfig.PLAY_ATOMIC_OVERVIEW_PEEK; -import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW; -import static com.android.launcher3.uioverrides.states.QuickstepAtomicAnimationFactory.INDEX_PAUSE_TO_OVERVIEW_ANIM; -import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC; -import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED; - -import android.animation.Animator; -import android.animation.AnimatorListenerAdapter; -import android.animation.AnimatorSet; -import android.util.Log; -import android.view.MotionEvent; -import android.view.View; -import android.view.ViewConfiguration; - -import com.android.launcher3.Launcher; -import com.android.launcher3.LauncherState; -import com.android.launcher3.anim.AnimationSuccessListener; -import com.android.launcher3.anim.Interpolators; -import com.android.launcher3.states.StateAnimationConfig; -import com.android.launcher3.states.StateAnimationConfig.AnimationFlags; -import com.android.launcher3.testing.TestProtocol; -import com.android.launcher3.uioverrides.states.QuickstepAtomicAnimationFactory; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; -import com.android.launcher3.util.VibratorWrapper; -import com.android.quickstep.SystemUiProxy; -import com.android.quickstep.util.MotionPauseDetector; -import com.android.quickstep.views.RecentsView; - -/** - * Touch controller which handles swipe and hold to go to Overview - */ -public class FlingAndHoldTouchController extends PortraitStatesTouchController { - - private static final long PEEK_IN_ANIM_DURATION = 240; - private static final long PEEK_OUT_ANIM_DURATION = 100; - private static final float MAX_DISPLACEMENT_PERCENT = 0.75f; - - protected final MotionPauseDetector mMotionPauseDetector; - private final float mMotionPauseMinDisplacement; - private final float mMotionPauseMaxDisplacement; - - private AnimatorSet mPeekAnim; - - public FlingAndHoldTouchController(Launcher l) { - super(l, false /* allowDragToOverview */); - mMotionPauseDetector = new MotionPauseDetector(l); - mMotionPauseMinDisplacement = ViewConfiguration.get(l).getScaledTouchSlop(); - mMotionPauseMaxDisplacement = getMotionPauseMaxDisplacement(); - } - - protected float getMotionPauseMaxDisplacement() { - return getShiftRange() * MAX_DISPLACEMENT_PERCENT; - } - - @Override - protected long getAtomicDuration() { - return QuickstepAtomicAnimationFactory.ATOMIC_DURATION_FROM_PAUSED_TO_OVERVIEW; - } - - @Override - public void onDragStart(boolean start, float startDisplacement) { - mMotionPauseDetector.clear(); - - super.onDragStart(start, startDisplacement); - - if (handlingOverviewAnim()) { - mMotionPauseDetector.setOnMotionPauseListener(this::onMotionPauseChanged); - } - - if (mAtomicAnim != null) { - mAtomicAnim.cancel(); - } - } - - protected void onMotionPauseChanged(boolean isPaused) { - RecentsView recentsView = mLauncher.getOverviewPanel(); - recentsView.setOverviewStateEnabled(isPaused); - if (mPeekAnim != null) { - mPeekAnim.cancel(); - } - LauncherState fromState = isPaused ? NORMAL : OVERVIEW_PEEK; - LauncherState toState = isPaused ? OVERVIEW_PEEK : NORMAL; - long peekDuration = isPaused ? PEEK_IN_ANIM_DURATION : PEEK_OUT_ANIM_DURATION; - - StateAnimationConfig config = new StateAnimationConfig(); - config.duration = peekDuration; - config.animFlags = PLAY_ATOMIC_OVERVIEW_PEEK; - mPeekAnim = mLauncher.getStateManager().createAtomicAnimation( - fromState, toState, config); - mPeekAnim.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - mPeekAnim = null; - } - }); - mPeekAnim.start(); - VibratorWrapper.INSTANCE.get(mLauncher).vibrate(OVERVIEW_HAPTIC); - - mLauncher.getDragLayer().getScrim().createSysuiMultiplierAnim(isPaused ? 0 : 1) - .setDuration(peekDuration).start(); - } - - /** - * @return Whether we are handling the overview animation, rather than - * having it as part of the existing animation to the target state. - */ - protected boolean handlingOverviewAnim() { - int stateFlags = SystemUiProxy.INSTANCE.get(mLauncher).getLastSystemUiStateFlags(); - return mStartState == NORMAL && (stateFlags & SYSUI_STATE_OVERVIEW_DISABLED) == 0; - } - - @Override - protected StateAnimationConfig getConfigForStates( - LauncherState fromState, LauncherState toState) { - if (fromState == NORMAL && toState == ALL_APPS) { - StateAnimationConfig builder = new StateAnimationConfig(); - // Fade in prediction icons quickly, then rest of all apps after reaching overview. - float progressToReachOverview = NORMAL.getVerticalProgress(mLauncher) - - OVERVIEW.getVerticalProgress(mLauncher); - builder.setInterpolator(ANIM_ALL_APPS_HEADER_FADE, Interpolators.clampToProgress( - ACCEL, - 0, - ALL_APPS_CONTENT_FADE_THRESHOLD)); - builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress( - ACCEL, - progressToReachOverview, - progressToReachOverview + ALL_APPS_CONTENT_FADE_THRESHOLD)); - - // Get workspace out of the way quickly, to prepare for potential pause. - builder.setInterpolator(ANIM_WORKSPACE_SCALE, DEACCEL_3); - builder.setInterpolator(ANIM_WORKSPACE_TRANSLATE, DEACCEL_3); - builder.setInterpolator(ANIM_WORKSPACE_FADE, DEACCEL_3); - return builder; - } else if (fromState == ALL_APPS && toState == NORMAL) { - StateAnimationConfig builder = new StateAnimationConfig(); - // Keep all apps/predictions opaque until the very end of the transition. - float progressToReachOverview = OVERVIEW.getVerticalProgress(mLauncher); - builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress( - DEACCEL, - progressToReachOverview - ALL_APPS_CONTENT_FADE_THRESHOLD, - progressToReachOverview)); - builder.setInterpolator(ANIM_ALL_APPS_HEADER_FADE, Interpolators.clampToProgress( - DEACCEL, - 1 - ALL_APPS_CONTENT_FADE_THRESHOLD, - 1)); - return builder; - } - return super.getConfigForStates(fromState, toState); - } - - @Override - public boolean onDrag(float displacement, MotionEvent event) { - if (TestProtocol.sDebugTracing) { - Log.d(TestProtocol.PAUSE_NOT_DETECTED, "FlingAndHoldTouchController"); - } - float upDisplacement = -displacement; - mMotionPauseDetector.setDisallowPause(!handlingOverviewAnim() - || upDisplacement < mMotionPauseMinDisplacement - || upDisplacement > mMotionPauseMaxDisplacement); - mMotionPauseDetector.addPosition(event); - return super.onDrag(displacement, event); - } - - @Override - public void onDragEnd(float velocity) { - if (mMotionPauseDetector.isPaused() && handlingOverviewAnim()) { - goToOverviewOnDragEnd(velocity); - } else { - super.onDragEnd(velocity); - } - - View searchView = mLauncher.getAppsView().getSearchView(); - if (searchView instanceof FeedbackHandler) { - ((FeedbackHandler) searchView).resetFeedback(); - } - mMotionPauseDetector.clear(); - } - - protected void goToOverviewOnDragEnd(float velocity) { - if (mPeekAnim != null) { - mPeekAnim.cancel(); - } - - Animator overviewAnim = mLauncher.createAtomicAnimationFactory() - .createStateElementAnimation(INDEX_PAUSE_TO_OVERVIEW_ANIM); - mAtomicAnim = new AnimatorSet(); - mAtomicAnim.addListener(new AnimationSuccessListener() { - @Override - public void onAnimationSuccess(Animator animator) { - onSwipeInteractionCompleted(OVERVIEW, Touch.SWIPE); - } - - @Override - public void onAnimationEnd(Animator animation) { - super.onAnimationEnd(animation); - if (mCancelled) { - StateAnimationConfig config = new StateAnimationConfig(); - config.animFlags = PLAY_ATOMIC_OVERVIEW_PEEK; - config.duration = PEEK_OUT_ANIM_DURATION; - mPeekAnim = mLauncher.getStateManager().createAtomicAnimation( - mFromState, mToState, config); - mPeekAnim.start(); - } - mAtomicAnim = null; - } - }); - mAtomicAnim.play(overviewAnim); - mAtomicAnim.start(); - } - - @Override - protected void goToTargetState(LauncherState targetState, int logAction) { - if (mPeekAnim != null && mPeekAnim.isStarted()) { - // Don't jump to the target state until overview is no longer peeking. - mPeekAnim.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - FlingAndHoldTouchController.super.goToTargetState(targetState, logAction); - } - }); - } else { - super.goToTargetState(targetState, logAction); - } - } - - @Override - @AnimationFlags - protected int updateAnimComponentsOnReinit(@AnimationFlags int animComponents) { - if (handlingOverviewAnim()) { - // We don't want the state transition to all apps to animate overview, - // as that will cause a jump after our atomic animation. - return animComponents | SKIP_OVERVIEW; - } else { - return animComponents; - } - } - - /** - * Interface for views with feedback animation requiring reset - */ - public interface FeedbackHandler { - - /** - * reset searchWidget feedback - */ - void resetFeedback(); - } - -} diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java index dbff20ae6c..dc7ba97041 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java @@ -16,30 +16,44 @@ package com.android.launcher3.uioverrides.touchcontrollers; +import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.HINT_STATE; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.Utilities.EDGE_NAV_BAR; +import static com.android.launcher3.anim.Interpolators.ACCEL; import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL; +import static com.android.launcher3.anim.Interpolators.DEACCEL; +import static com.android.launcher3.anim.Interpolators.DEACCEL_3; +import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE; +import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_HEADER_FADE; +import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE; +import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE; +import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE; import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.graphics.PointF; import android.util.Log; import android.view.MotionEvent; +import android.view.View; +import android.view.ViewConfiguration; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimatorPlaybackController; +import com.android.launcher3.anim.Interpolators; import com.android.launcher3.graphics.OverviewScrim; -import com.android.launcher3.statemanager.StateManager; import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; import com.android.launcher3.util.VibratorWrapper; +import com.android.quickstep.SystemUiProxy; import com.android.quickstep.util.AnimatorControllerWithResistance; +import com.android.quickstep.util.MotionPauseDetector; import com.android.quickstep.util.OverviewToHomeAnim; import com.android.quickstep.views.RecentsView; @@ -48,7 +62,7 @@ import com.android.quickstep.views.RecentsView; * the nav bar falls back to go to All Apps. Swiping from the nav bar without holding goes to the * first home screen instead of to Overview. */ -public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchController { +public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouchController { // How much of the movement to use for translating overview after swipe and hold. @@ -57,6 +71,8 @@ public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchCo private static final float TRANSLATION_ANIM_VELOCITY_DP_PER_MS = 0.8f; private final RecentsView mRecentsView; + private final MotionPauseDetector mMotionPauseDetector; + private final float mMotionPauseMinDisplacement; private boolean mDidTouchStartInNavBar; private boolean mReachedOverview; @@ -69,20 +85,15 @@ public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchCo private ObjectAnimator mNormalToHintOverviewScrimAnimator; public NoButtonNavbarToOverviewTouchController(Launcher l) { - super(l); + super(l, false /* allowDragToOverview */); mRecentsView = l.getOverviewPanel(); + mMotionPauseDetector = new MotionPauseDetector(l); + mMotionPauseMinDisplacement = ViewConfiguration.get(l).getScaledTouchSlop(); if (TestProtocol.sDebugTracing) { Log.d(TestProtocol.PAUSE_NOT_DETECTED, "NoButtonNavbarToOverviewTouchController.ctor"); } } - @Override - protected float getMotionPauseMaxDisplacement() { - // No need to disallow pause when swiping up all the way up the screen (unlike - // FlingAndHoldTouchController where user is probably intending to go to all apps). - return Float.MAX_VALUE; - } - @Override protected boolean canInterceptTouch(MotionEvent ev) { mDidTouchStartInNavBar = (ev.getEdgeFlags() & EDGE_NAV_BAR) != 0; @@ -113,6 +124,13 @@ public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchCo @Override public void onDragStart(boolean start, float startDisplacement) { super.onDragStart(start, startDisplacement); + + mMotionPauseDetector.clear(); + + if (handlingOverviewAnim()) { + mMotionPauseDetector.setOnMotionPauseListener(this::onMotionPauseChanged); + } + if (mFromState == NORMAL && mToState == HINT_STATE) { mNormalToHintOverviewScrimAnimator = ObjectAnimator.ofFloat( mLauncher.getDragLayer().getOverviewScrim(), @@ -134,7 +152,18 @@ public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchCo @Override public void onDragEnd(float velocity) { - super.onDragEnd(velocity); + if (mMotionPauseDetector.isPaused() && handlingOverviewAnim()) { + goToOverviewOrHomeOnDragEnd(velocity); + } else { + super.onDragEnd(velocity); + } + + View searchView = mLauncher.getAppsView().getSearchView(); + if (searchView instanceof FeedbackHandler) { + ((FeedbackHandler) searchView).resetFeedback(); + } + + mMotionPauseDetector.clear(); mNormalToHintOverviewScrimAnimator = null; } @@ -151,8 +180,7 @@ public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchCo } } - @Override - protected void onMotionPauseChanged(boolean isPaused) { + private void onMotionPauseChanged(boolean isPaused) { if (mCurrentAnimation == null) { return; } @@ -175,9 +203,10 @@ public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchCo } } - @Override - protected boolean handlingOverviewAnim() { - return mDidTouchStartInNavBar && super.handlingOverviewAnim(); + private boolean handlingOverviewAnim() { + int stateFlags = SystemUiProxy.INSTANCE.get(mLauncher).getLastSystemUiStateFlags(); + return mDidTouchStartInNavBar && mStartState == NORMAL + && (stateFlags & SYSUI_STATE_OVERVIEW_DISABLED) == 0; } @Override @@ -203,14 +232,18 @@ public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchCo // Stay in Overview. return true; } + + float upDisplacement = -yDisplacement; + mMotionPauseDetector.setDisallowPause(!handlingOverviewAnim() + || upDisplacement < mMotionPauseMinDisplacement); + mMotionPauseDetector.addPosition(event); + return super.onDrag(yDisplacement, xDisplacement, event); } - @Override - protected void goToOverviewOnDragEnd(float velocity) { + private void goToOverviewOrHomeOnDragEnd(float velocity) { float velocityDp = dpiFromPx(velocity); boolean isFling = Math.abs(velocityDp) > 1; - StateManager stateManager = mLauncher.getStateManager(); boolean goToHomeInsteadOfOverview = isFling; if (goToHomeInsteadOfOverview) { new OverviewToHomeAnim(mLauncher, ()-> onSwipeInteractionCompleted(NORMAL, Touch.FLING)) @@ -243,4 +276,54 @@ public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchCo private float dpiFromPx(float pixels) { return Utilities.dpiFromPx(pixels, mLauncher.getResources().getDisplayMetrics()); } + + @Override + protected StateAnimationConfig getConfigForStates( + LauncherState fromState, LauncherState toState) { + if (fromState == NORMAL && toState == ALL_APPS) { + StateAnimationConfig builder = new StateAnimationConfig(); + // Fade in prediction icons quickly, then rest of all apps after reaching overview. + float progressToReachOverview = NORMAL.getVerticalProgress(mLauncher) + - OVERVIEW.getVerticalProgress(mLauncher); + builder.setInterpolator(ANIM_ALL_APPS_HEADER_FADE, Interpolators.clampToProgress( + ACCEL, + 0, + ALL_APPS_CONTENT_FADE_THRESHOLD)); + builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress( + ACCEL, + progressToReachOverview, + progressToReachOverview + ALL_APPS_CONTENT_FADE_THRESHOLD)); + + // Get workspace out of the way quickly, to prepare for potential pause. + builder.setInterpolator(ANIM_WORKSPACE_SCALE, DEACCEL_3); + builder.setInterpolator(ANIM_WORKSPACE_TRANSLATE, DEACCEL_3); + builder.setInterpolator(ANIM_WORKSPACE_FADE, DEACCEL_3); + return builder; + } else if (fromState == ALL_APPS && toState == NORMAL) { + StateAnimationConfig builder = new StateAnimationConfig(); + // Keep all apps/predictions opaque until the very end of the transition. + float progressToReachOverview = OVERVIEW.getVerticalProgress(mLauncher); + builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress( + DEACCEL, + progressToReachOverview - ALL_APPS_CONTENT_FADE_THRESHOLD, + progressToReachOverview)); + builder.setInterpolator(ANIM_ALL_APPS_HEADER_FADE, Interpolators.clampToProgress( + DEACCEL, + 1 - ALL_APPS_CONTENT_FADE_THRESHOLD, + 1)); + return builder; + } + return super.getConfigForStates(fromState, toState); + } + + /** + * Interface for views with feedback animation requiring reset + */ + public interface FeedbackHandler { + + /** + * reset searchWidget feedback + */ + void resetFeedback(); + } } diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java index 3867c35050..4b0642fab7 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java @@ -15,7 +15,6 @@ */ package com.android.launcher3.uioverrides.touchcontrollers; -import static com.android.launcher3.LauncherState.HOTSEAT_ICONS; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.LauncherState.OVERVIEW_BUTTONS; @@ -25,7 +24,6 @@ import static com.android.launcher3.anim.Interpolators.ACCEL_0_75; import static com.android.launcher3.anim.Interpolators.DEACCEL_5; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.Interpolators.scrollInterpolatorForVelocity; -import static com.android.launcher3.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_UNKNOWN_SWIPEDOWN; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_UNKNOWN_SWIPEUP; @@ -40,9 +38,6 @@ import static com.android.launcher3.touch.BothAxesSwipeDetector.DIRECTION_UP; import static com.android.launcher3.uioverrides.states.QuickstepAtomicAnimationFactory.INDEX_PAUSE_TO_OVERVIEW_ANIM; import static com.android.launcher3.util.DisplayController.getSingleFrameMs; import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC; -import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.CANCEL; -import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.HIDE; -import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.PEEK; import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET; import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS; import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; @@ -60,10 +55,8 @@ import com.android.launcher3.BaseQuickstepLauncher; import com.android.launcher3.LauncherState; import com.android.launcher3.R; import com.android.launcher3.Utilities; -import com.android.launcher3.allapps.AllAppsTransitionController; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.PendingAnimation; -import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.graphics.OverviewScrim; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.states.StateAnimationConfig; @@ -79,8 +72,6 @@ import com.android.quickstep.SystemUiProxy; import com.android.quickstep.util.AnimatorControllerWithResistance; import com.android.quickstep.util.LayoutUtils; import com.android.quickstep.util.MotionPauseDetector; -import com.android.quickstep.util.ShelfPeekAnim; -import com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState; import com.android.quickstep.util.StaggeredWorkspaceAnim; import com.android.quickstep.views.LauncherRecentsView; @@ -99,7 +90,6 @@ public class NoButtonQuickSwitchTouchController implements TouchController, private final BaseQuickstepLauncher mLauncher; private final BothAxesSwipeDetector mSwipeDetector; - private final ShelfPeekAnim mShelfPeekAnim; private final float mXRange; private final float mYRange; private final float mMaxYProgress; @@ -121,7 +111,6 @@ public class NoButtonQuickSwitchTouchController implements TouchController, public NoButtonQuickSwitchTouchController(BaseQuickstepLauncher launcher) { mLauncher = launcher; mSwipeDetector = new BothAxesSwipeDetector(mLauncher, this); - mShelfPeekAnim = mLauncher.getShelfPeekAnim(); mRecentsView = mLauncher.getOverviewPanel(); mXRange = mLauncher.getDeviceProfile().widthPx / 2f; mYRange = LayoutUtils.getShelfTrackingDistance( @@ -191,25 +180,6 @@ public class NoButtonQuickSwitchTouchController implements TouchController, @Override public void onMotionPauseChanged(boolean isPaused) { VibratorWrapper.INSTANCE.get(mLauncher).vibrate(OVERVIEW_HAPTIC); - - if (FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get()) { - return; - } - - ShelfAnimState shelfState = isPaused ? PEEK : HIDE; - if (shelfState == PEEK) { - // Some shelf elements (e.g. qsb) were hidden, but we need them visible when peeking. - AllAppsTransitionController allAppsController = mLauncher.getAllAppsController(); - allAppsController.setAlphas( - NORMAL, new StateAnimationConfig(), NO_ANIM_PROPERTY_SETTER); - - if ((OVERVIEW.getVisibleElements(mLauncher) & HOTSEAT_ICONS) != 0) { - // Hotseat was hidden, but we need it visible when peeking. - mLauncher.getHotseat().setAlpha(1); - } - } - mShelfPeekAnim.setShelfState(shelfState, ShelfPeekAnim.INTERPOLATOR, - ShelfPeekAnim.DURATION); } private void setupAnimators() { @@ -301,10 +271,6 @@ public class NoButtonQuickSwitchTouchController implements TouchController, mIsHomeScreenVisible = FADE_OUT_INTERPOLATOR.getInterpolation(xProgress) <= 1 - ALPHA_CUTOFF_THRESHOLD; - if (wasHomeScreenVisible && !mIsHomeScreenVisible) { - // Get the shelf all the way offscreen so it pops up when we decide to peek it. - mShelfPeekAnim.setShelfState(HIDE, LINEAR, 0); - } // Only allow motion pause if the home screen is invisible, since some // home screen elements will appear in the shelf on motion pause. @@ -312,11 +278,6 @@ public class NoButtonQuickSwitchTouchController implements TouchController, || -displacement.y < mMotionPauseMinDisplacement); mMotionPauseDetector.addPosition(ev); - if (mIsHomeScreenVisible) { - // Cancel the shelf anim so it doesn't clobber mNonOverviewAnim. - mShelfPeekAnim.setShelfState(CANCEL, LINEAR, 0); - } - if (mXOverviewAnim != null) { mXOverviewAnim.setPlayFraction(xProgress); } @@ -474,7 +435,6 @@ public class NoButtonQuickSwitchTouchController implements TouchController, if (mYOverviewAnim != null) { mYOverviewAnim.cancelAnimation(); } - mShelfPeekAnim.setShelfState(ShelfAnimState.CANCEL, LINEAR, 0); mMotionPauseDetector.clear(); } diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java index a684b9d7fb..1208c6c79b 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java @@ -24,7 +24,6 @@ import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.anim.Interpolators.ACCEL; import static com.android.launcher3.anim.Interpolators.DEACCEL; import static com.android.launcher3.anim.Interpolators.LINEAR; -import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS; import static com.android.launcher3.config.FeatureFlags.UNSTABLE_SPRINGS; import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FADE; @@ -142,7 +141,7 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr Log.d(TestProtocol.OVERIEW_NOT_ALLAPPS, "PortraitStatesTouchController.getTargetState 1"); } - if (ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(mLauncher)) { + if (removeShelfFromOverview(mLauncher)) { // Don't allow swiping down to overview. return NORMAL; } @@ -154,7 +153,7 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr "PortraitStatesTouchController.getTargetState 2"); } LauncherState positiveDragTarget = ALL_APPS; - if (ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(mLauncher)) { + if (removeShelfFromOverview(mLauncher)) { // Don't allow swiping up to all apps. positiveDragTarget = OVERVIEW; } @@ -249,7 +248,7 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr final StateAnimationConfig config = totalShift == 0 ? new StateAnimationConfig() : getConfigForStates(mFromState, mToState); - config.animFlags = updateAnimComponentsOnReinit(animFlags); + config.animFlags = animFlags; config.duration = maxAccuracy; cancelPendingAnim(); @@ -283,14 +282,6 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr return 1 / totalShift; } - /** - * Give subclasses the chance to update the animation when we re-initialize towards a new state. - */ - @AnimationFlags - protected int updateAnimComponentsOnReinit(@AnimationFlags int animComponents) { - return animComponents; - } - private void cancelPendingAnim() { if (mPendingAnimation != null) { mPendingAnimation.finish(false, Touch.SWIPE); diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 2ca07eccd0..aaa2720047 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -20,7 +20,6 @@ import static android.widget.Toast.LENGTH_SHORT; import static com.android.launcher3.BaseActivity.INVISIBLE_BY_STATE_HANDLER; import static com.android.launcher3.BaseActivity.STATE_HANDLER_INVISIBILITY_FLAGS; import static com.android.launcher3.anim.Interpolators.DEACCEL; -import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_2; import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND; @@ -41,8 +40,6 @@ import static com.android.quickstep.GestureState.STATE_END_TARGET_ANIMATION_FINI import static com.android.quickstep.GestureState.STATE_END_TARGET_SET; import static com.android.quickstep.GestureState.STATE_RECENTS_SCROLLING_FINISHED; import static com.android.quickstep.MultiStateCallback.DEBUG_STATES; -import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.HIDE; -import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.PEEK; import static com.android.quickstep.views.RecentsView.UPDATE_SYSUI_FLAGS_THRESHOLD; import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACTIVITY_TYPE_HOME; @@ -93,8 +90,6 @@ import com.android.quickstep.util.ActivityInitListener; import com.android.quickstep.util.AnimatorControllerWithResistance; import com.android.quickstep.util.InputConsumerProxy; import com.android.quickstep.util.RectFSpringAnim; -import com.android.quickstep.util.ShelfPeekAnim; -import com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState; import com.android.quickstep.util.SurfaceTransactionApplier; import com.android.quickstep.util.TransformParams; import com.android.quickstep.views.LiveTileOverlay; @@ -205,7 +200,7 @@ public abstract class AbsSwipeUpHandler, Q extends // Either RectFSpringAnim (if animating home) or ObjectAnimator (from mCurrentShift) otherwise private RunningWindowAnim mRunningWindowAnim; - private boolean mIsShelfPeeking; + private boolean mIsMotionPaused; private boolean mContinuingLastGesture; @@ -491,7 +486,9 @@ public abstract class AbsSwipeUpHandler, Q extends * Called when motion pause is detected */ public void onMotionPauseChanged(boolean isPaused) { - setShelfState(isPaused ? PEEK : HIDE, ShelfPeekAnim.INTERPOLATOR, ShelfPeekAnim.DURATION); + mIsMotionPaused = isPaused; + maybeUpdateRecentsAttachedState(); + performHapticFeedback(); } public void maybeUpdateRecentsAttachedState() { @@ -522,7 +519,7 @@ public abstract class AbsSwipeUpHandler, Q extends // The window is going away so make sure recents is always visible in this case. recentsAttachedToAppWindow = true; } else { - recentsAttachedToAppWindow = mIsShelfPeeking || mIsLikelyToStartNewTask; + recentsAttachedToAppWindow = mIsMotionPaused || mIsLikelyToStartNewTask; } mAnimationFactory.setRecentsAttachedToAppWindow(recentsAttachedToAppWindow, animate); @@ -552,19 +549,6 @@ public abstract class AbsSwipeUpHandler, Q extends } } - @UiThread - public void setShelfState(ShelfAnimState shelfState, Interpolator interpolator, long duration) { - mAnimationFactory.setShelfState(shelfState, interpolator, duration); - boolean wasShelfPeeking = mIsShelfPeeking; - mIsShelfPeeking = shelfState == PEEK; - if (mIsShelfPeeking != wasShelfPeeking) { - maybeUpdateRecentsAttachedState(); - } - if (shelfState.shouldPreformHaptic) { - performHapticFeedback(); - } - } - private void buildAnimationController() { if (!canCreateNewOrUpdateExistingLauncherTransitionController()) { return; @@ -852,7 +836,7 @@ public abstract class AbsSwipeUpHandler, Q extends if (isCancel) { endTarget = LAST_TASK; } else if (mDeviceState.isFullyGesturalNavMode()) { - if (mIsShelfPeeking) { + if (mIsMotionPaused) { endTarget = RECENTS; } else if (goingToNewTask) { endTarget = NEW_TASK; @@ -874,7 +858,7 @@ public abstract class AbsSwipeUpHandler, Q extends if (mDeviceState.isFullyGesturalNavMode() && isSwipeUp && !willGoToNewTaskOnSwipeUp) { endTarget = HOME; - } else if (mDeviceState.isFullyGesturalNavMode() && isSwipeUp && !mIsShelfPeeking) { + } else if (mDeviceState.isFullyGesturalNavMode() && isSwipeUp && !mIsMotionPaused) { // If swiping at a diagonal, base end target on the faster velocity. endTarget = NEW_TASK; } else if (isSwipeUp) { @@ -942,7 +926,6 @@ public abstract class AbsSwipeUpHandler, Q extends mInputConsumerProxy.enable(); } if (endTarget == HOME) { - setShelfState(ShelfAnimState.CANCEL, LINEAR, 0); duration = Math.max(MIN_OVERSHOOT_DURATION, duration); } else if (endTarget == RECENTS) { LiveTileOverlay.INSTANCE.startIconAnimation(); @@ -958,9 +941,6 @@ public abstract class AbsSwipeUpHandler, Q extends } duration = Math.max(duration, mRecentsView.getScroller().getDuration()); } - if (mDeviceState.isFullyGesturalNavMode()) { - setShelfState(ShelfAnimState.OVERVIEW, interpolator, duration); - } } // Let RecentsView handle the scrolling to the task, which we launch in startNewTask() @@ -1267,7 +1247,6 @@ public abstract class AbsSwipeUpHandler, Q extends } private void endLauncherTransitionController() { - setShelfState(ShelfAnimState.CANCEL, LINEAR, 0); if (mLauncherTransitionController != null) { // End the animation, but stay at the same visual progress. mLauncherTransitionController.getNormalController().dispatchSetInterpolator( diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java index 1a4620b3e7..8b108ac299 100644 --- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java +++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java @@ -18,7 +18,6 @@ package com.android.quickstep; import static com.android.launcher3.anim.Interpolators.ACCEL_2; import static com.android.launcher3.anim.Interpolators.INSTANT; import static com.android.launcher3.anim.Interpolators.LINEAR; -import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS; import static com.android.quickstep.AbsSwipeUpHandler.RECENTS_ATTACH_DURATION; import static com.android.quickstep.SysUINavigationMode.getMode; import static com.android.quickstep.SysUINavigationMode.hideShelfInTwoButtonLandscape; @@ -37,7 +36,6 @@ import android.content.res.Resources; import android.graphics.Rect; import android.os.Build; import android.view.MotionEvent; -import android.view.animation.Interpolator; import androidx.annotation.Nullable; import androidx.annotation.UiThread; @@ -54,7 +52,6 @@ import com.android.launcher3.util.WindowBounds; import com.android.quickstep.SysUINavigationMode.Mode; import com.android.quickstep.util.ActivityInitListener; import com.android.quickstep.util.AnimatorControllerWithResistance; -import com.android.quickstep.util.ShelfPeekAnim; import com.android.quickstep.util.SplitScreenBounds; import com.android.quickstep.views.RecentsView; import com.android.systemui.shared.recents.model.ThumbnailData; @@ -299,9 +296,6 @@ public abstract class BaseActivityInterface