diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index c7c0c7ed73..727fbd3ea1 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -55,11 +55,9 @@ - 40dp 8dp 3dp 0dp - 136dp 96dp 60dp 200dp diff --git a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java index f02acab838..4204597c03 100644 --- a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java @@ -20,7 +20,6 @@ import static com.android.launcher3.AbstractFloatingView.TYPE_HIDE_BACK_BUTTON; import static com.android.launcher3.LauncherState.FLAG_HIDE_BACK_BUTTON; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; -import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview; import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY; import android.animation.AnimatorSet; @@ -93,7 +92,7 @@ public abstract class BaseQuickstepLauncher extends Launcher @Override public void onNavigationModeChanged(Mode newMode) { getDragLayer().recreateControllers(); - if (mActionsView != null && isOverviewActionsEnabled()) { + if (mActionsView != null) { mActionsView.updateVerticalMargin(newMode); } } @@ -190,17 +189,7 @@ public abstract class BaseQuickstepLauncher extends Launcher SysUINavigationMode.INSTANCE.get(this).updateMode(); mActionsView = findViewById(R.id.overview_actions_view); ((RecentsView) getOverviewPanel()).init(mActionsView); - - if (isOverviewActionsEnabled()) { - // Overview is above all other launcher elements, including qsb, so move it to the top. - getOverviewPanel().bringToFront(); - mActionsView.bringToFront(); - mActionsView.updateVerticalMargin(SysUINavigationMode.getMode(this)); - } - } - - private boolean isOverviewActionsEnabled() { - return removeShelfFromOverview(this); + mActionsView.updateVerticalMargin(SysUINavigationMode.getMode(this)); } public T getActionsView() { @@ -251,7 +240,7 @@ public abstract class BaseQuickstepLauncher extends Launcher @Override public float[] getNormalOverviewScaleAndOffset() { - return SysUINavigationMode.getMode(this) == Mode.NO_BUTTON + return SysUINavigationMode.getMode(this).hasGestures ? new float[] {1, 1} : new float[] {1.1f, 0}; } diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 2d704f801e..8c3b57abc9 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -29,7 +29,6 @@ import static com.android.launcher3.testing.TestProtocol.HINT_STATE_ORDINAL; import static com.android.launcher3.testing.TestProtocol.OVERVIEW_STATE_ORDINAL; import static com.android.launcher3.testing.TestProtocol.QUICK_SWITCH_STATE_ORDINAL; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; -import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY; import android.content.Intent; @@ -43,7 +42,6 @@ import com.android.launcher3.Launcher; import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.LauncherState; import com.android.launcher3.Workspace; -import com.android.launcher3.allapps.DiscoveryBounce; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.appprediction.PredictionRowView; import com.android.launcher3.config.FeatureFlags; @@ -55,16 +53,15 @@ import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.statemanager.StateManager.AtomicAnimationFactory; import com.android.launcher3.uioverrides.states.QuickstepAtomicAnimationFactory; -import com.android.launcher3.uioverrides.touchcontrollers.LandscapeEdgeSwipeController; import com.android.launcher3.uioverrides.touchcontrollers.NavBarToHomeTouchController; import com.android.launcher3.uioverrides.touchcontrollers.NoButtonNavbarToOverviewTouchController; import com.android.launcher3.uioverrides.touchcontrollers.NoButtonQuickSwitchTouchController; -import com.android.launcher3.uioverrides.touchcontrollers.OverviewToAllAppsTouchController; import com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController; import com.android.launcher3.uioverrides.touchcontrollers.QuickSwitchTouchController; import com.android.launcher3.uioverrides.touchcontrollers.StatusBarTouchController; import com.android.launcher3.uioverrides.touchcontrollers.TaskViewTouchController; import com.android.launcher3.uioverrides.touchcontrollers.TransposedQuickSwitchTouchController; +import com.android.launcher3.uioverrides.touchcontrollers.TwoButtonNavbarToOverviewTouchController; import com.android.launcher3.util.OnboardingPrefs; import com.android.launcher3.util.TouchController; import com.android.launcher3.util.UiThreadHelper; @@ -240,9 +237,6 @@ public class QuickstepLauncher extends BaseQuickstepLauncher { break; } case OVERVIEW_STATE_ORDINAL: { - RecentsView recentsView = getOverviewPanel(); - DiscoveryBounce.showForOverviewIfNeeded(this, - recentsView.getPagedOrientationHandler()); RecentsView rv = getOverviewPanel(); sendCustomAccessibilityEvent( rv.getPageAt(rv.getCurrentPage()), TYPE_VIEW_FOCUSED, null); @@ -275,24 +269,22 @@ public class QuickstepLauncher extends BaseQuickstepLauncher { ArrayList list = new ArrayList<>(); list.add(getDragController()); - if (mode == NO_BUTTON) { - list.add(new NoButtonQuickSwitchTouchController(this)); - list.add(new NavBarToHomeTouchController(this)); - list.add(new NoButtonNavbarToOverviewTouchController(this)); - } else { - if (getDeviceProfile().isVerticalBarLayout()) { - list.add(new OverviewToAllAppsTouchController(this)); - list.add(new LandscapeEdgeSwipeController(this)); - if (mode.hasGestures) { - list.add(new TransposedQuickSwitchTouchController(this)); - } - } else { - list.add(new PortraitStatesTouchController(this, - mode.hasGestures /* allowDragToOverview */)); - if (mode.hasGestures) { - list.add(new QuickSwitchTouchController(this)); - } - } + switch (mode) { + case NO_BUTTON: + list.add(new NoButtonQuickSwitchTouchController(this)); + list.add(new NavBarToHomeTouchController(this)); + list.add(new NoButtonNavbarToOverviewTouchController(this)); + break; + case TWO_BUTTONS: + list.add(new TwoButtonNavbarToOverviewTouchController(this)); + list.add(getDeviceProfile().isVerticalBarLayout() + ? new TransposedQuickSwitchTouchController(this) + : new QuickSwitchTouchController(this)); + list.add(new PortraitStatesTouchController(this)); + break; + case THREE_BUTTONS: + default: + list.add(new PortraitStatesTouchController(this)); } if (!getDeviceProfile().isMultiWindowMode) { diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java index a2e3bdf8a0..37c774b657 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java @@ -17,7 +17,6 @@ package com.android.launcher3.uioverrides.states; import static com.android.launcher3.anim.Interpolators.DEACCEL_2; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_ALLAPPS; -import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview; import android.content.Context; @@ -84,8 +83,7 @@ public class AllAppsState extends LauncherState { @Override public float[] getOverviewScaleAndOffset(Launcher launcher) { - float offset = removeShelfFromOverview(launcher) ? 1 : 0; - return new float[] {0.9f, offset}; + return new float[] {0.9f, 1}; } @Override diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java index 525ff5816d..b295e79d04 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java @@ -18,8 +18,6 @@ package com.android.launcher3.uioverrides.states; import static com.android.launcher3.anim.Interpolators.DEACCEL_2; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW; import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; -import static com.android.quickstep.SysUINavigationMode.hideShelfInTwoButtonLandscape; -import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview; import android.content.Context; import android.graphics.Rect; @@ -105,7 +103,7 @@ public class OverviewState extends LauncherState { @Override public ScaleAndTranslation getQsbScaleAndTranslation(Launcher launcher) { - if (this == OVERVIEW && removeShelfFromOverview(launcher)) { + if (this == OVERVIEW) { // Treat the QSB as part of the hotseat so they move together. return getHotseatScaleAndTranslation(launcher); } @@ -124,18 +122,7 @@ public class OverviewState extends LauncherState { @Override public int getVisibleElements(Launcher launcher) { - RecentsView recentsView = launcher.getOverviewPanel(); - if (removeShelfFromOverview(launcher) || - hideShelfInTwoButtonLandscape(launcher, recentsView.getPagedOrientationHandler())) { - return OVERVIEW_BUTTONS; - } else if (launcher.getDeviceProfile().isVerticalBarLayout()) { - return VERTICAL_SWIPE_INDICATOR | OVERVIEW_BUTTONS; - } else { - boolean hasAllAppsHeaderExtra = launcher.getAppsView() != null - && launcher.getAppsView().getFloatingHeaderView().hasVisibleContent(); - return HOTSEAT_SEARCH_BOX | VERTICAL_SWIPE_INDICATOR | OVERVIEW_BUTTONS - | (hasAllAppsHeaderExtra ? ALL_APPS_HEADER_EXTRA : HOTSEAT_ICONS); - } + return OVERVIEW_BUTTONS; } @Override @@ -143,20 +130,6 @@ public class OverviewState extends LauncherState { return 0.5f; } - @Override - public float getVerticalProgress(Launcher launcher) { - if ((getVisibleElements(launcher) & ALL_APPS_HEADER_EXTRA) == 0) { - // We have no all apps content, so we're still at the fully down progress. - return super.getVerticalProgress(launcher); - } - return getDefaultVerticalProgress(launcher); - } - - public static float getDefaultVerticalProgress(Launcher launcher) { - return 1 - (getDefaultSwipeHeight(launcher) - / launcher.getAllAppsController().getShiftRange()); - } - @Override public String getDescription(Launcher launcher) { return launcher.getString(R.string.accessibility_recent_apps); diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java index 77fd103a6c..efb91c6905 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java @@ -17,9 +17,7 @@ package com.android.launcher3.uioverrides.states; import static android.view.View.VISIBLE; -import static com.android.launcher3.LauncherState.BACKGROUND_APP; 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.WorkspaceStateTransitionAnimation.getSpringScaleAnimator; @@ -30,9 +28,7 @@ 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.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.states.StateAnimationConfig.ANIM_ALL_APPS_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_DEPTH; @@ -44,23 +40,17 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_F import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE; import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; -import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview; import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; -import android.animation.Animator; -import android.animation.AnimatorSet; import android.animation.ValueAnimator; import android.view.View; -import android.view.animation.Interpolator; import com.android.launcher3.CellLayout; import com.android.launcher3.Hotseat; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; -import com.android.launcher3.LauncherState.ScaleAndTranslation; import com.android.launcher3.Workspace; import com.android.launcher3.allapps.AllAppsContainerView; -import com.android.launcher3.allapps.AllAppsTransitionController; import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.uioverrides.QuickstepLauncher; import com.android.quickstep.SysUINavigationMode; @@ -76,57 +66,12 @@ public class QuickstepAtomicAnimationFactory extends // Scale recents takes before animating in private static final float RECENTS_PREPARE_SCALE = 1.33f; - public static final int INDEX_SHELF_ANIM = RecentsAtomicAnimationFactory.NEXT_INDEX + 0; - - private static final int MY_ANIM_COUNT = 1; - protected static final int NEXT_INDEX = RecentsAtomicAnimationFactory.NEXT_INDEX - + MY_ANIM_COUNT; - // Due to use of physics, duration may differ between devices so we need to calculate and // cache the value. private int mHintToNormalDuration = -1; public QuickstepAtomicAnimationFactory(QuickstepLauncher activity) { - super(activity, MY_ANIM_COUNT); - } - - @Override - public Animator createStateElementAnimation(int index, float... values) { - switch (index) { - case INDEX_SHELF_ANIM: { - AllAppsTransitionController aatc = mActivity.getAllAppsController(); - Animator springAnim = aatc.createSpringAnimation(values); - - if ((OVERVIEW.getVisibleElements(mActivity) & HOTSEAT_ICONS) != 0) { - // Translate hotseat with the shelf until reaching overview. - float overviewProgress = OVERVIEW.getVerticalProgress(mActivity); - ScaleAndTranslation sat = OVERVIEW.getHotseatScaleAndTranslation(mActivity); - float shiftRange = aatc.getShiftRange(); - if (values.length == 1) { - values = new float[] {aatc.getProgress(), values[0]}; - } - ValueAnimator hotseatAnim = ValueAnimator.ofFloat(values); - hotseatAnim.addUpdateListener(anim -> { - float progress = (Float) anim.getAnimatedValue(); - if (progress >= overviewProgress || mActivity.isInState(BACKGROUND_APP)) { - float hotseatShift = (progress - overviewProgress) * shiftRange; - mActivity.getHotseat().setTranslationY(hotseatShift + sat.translationY); - } - }); - hotseatAnim.setInterpolator(LINEAR); - hotseatAnim.setDuration(springAnim.getDuration()); - - AnimatorSet anim = new AnimatorSet(); - anim.play(hotseatAnim); - anim.play(springAnim); - return anim; - } - - return springAnim; - } - default: - return super.createStateElementAnimation(index, values); - } + super(activity); } @Override @@ -191,11 +136,8 @@ 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 = removeShelfFromOverview(mActivity) - ? OVERSHOOT_1_2 - : OVERSHOOT_1_7; - config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, translationInterpolator); - config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, translationInterpolator); + config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, OVERSHOOT_1_2); + config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, OVERSHOOT_1_2); } else if (fromState == HINT_STATE && toState == NORMAL) { config.setInterpolator(ANIM_DEPTH, DEACCEL_3); if (mHintToNormalDuration == -1) { diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java index addfe927e8..45cb46f96a 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java @@ -84,7 +84,7 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch private ObjectAnimator mNormalToHintOverviewScrimAnimator; public NoButtonNavbarToOverviewTouchController(Launcher l) { - super(l, false /* allowDragToOverview */); + super(l); mRecentsView = l.getOverviewPanel(); mMotionPauseDetector = new MotionPauseDetector(l); mMotionPauseMinDisplacement = ViewConfiguration.get(l).getScaledTouchSlop(); diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/OverviewToAllAppsTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/OverviewToAllAppsTouchController.java deleted file mode 100644 index 45e5e2fb7c..0000000000 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/OverviewToAllAppsTouchController.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2017 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 android.view.MotionEvent; - -import com.android.launcher3.AbstractFloatingView; -import com.android.launcher3.Launcher; -import com.android.launcher3.LauncherState; -import com.android.launcher3.Utilities; -import com.android.quickstep.TouchInteractionService; -import com.android.quickstep.views.RecentsView; - -/** - * Touch controller from going from OVERVIEW to ALL_APPS. - * - * This is used in landscape mode. It is also used in portrait mode for the fallback recents. - */ -public class OverviewToAllAppsTouchController extends PortraitStatesTouchController { - - public OverviewToAllAppsTouchController(Launcher l) { - super(l, true /* allowDragToOverview */); - } - - @Override - protected boolean canInterceptTouch(MotionEvent ev) { - if (mCurrentAnimation != null) { - // If we are already animating from a previous state, we can intercept. - return true; - } - if (AbstractFloatingView.getTopOpenView(mLauncher) != null) { - return false; - } - if (mLauncher.isInState(ALL_APPS)) { - // In all-apps only listen if the container cannot scroll itself - return mLauncher.getAppsView().shouldContainerScroll(ev); - } else if (mLauncher.isInState(NORMAL)) { - return (ev.getEdgeFlags() & Utilities.EDGE_NAV_BAR) == 0; - } else if (mLauncher.isInState(OVERVIEW)) { - RecentsView rv = mLauncher.getOverviewPanel(); - return ev.getY() > (rv.getBottom() - rv.getPaddingBottom()); - } else { - return false; - } - } - - @Override - protected LauncherState getTargetState(LauncherState fromState, boolean isDragTowardPositive) { - if (fromState == ALL_APPS && !isDragTowardPositive) { - // Should swipe down go to OVERVIEW instead? - return TouchInteractionService.isConnected() ? - mLauncher.getStateManager().getLastState() : NORMAL; - } else if (isDragTowardPositive) { - return ALL_APPS; - } - return fromState; - } -} diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java index 3c9b808f2f..73f4ff2ba4 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java @@ -28,8 +28,6 @@ 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; import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PROGRESS; -import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview; -import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED; import android.animation.TimeInterpolator; import android.animation.ValueAnimator; @@ -49,7 +47,6 @@ import com.android.launcher3.touch.AbstractStateChangeTouchController; import com.android.launcher3.touch.SingleAxisSwipeDetector; import com.android.launcher3.uioverrides.states.OverviewState; import com.android.quickstep.SystemUiProxy; -import com.android.quickstep.TouchInteractionService; import com.android.quickstep.util.LayoutUtils; import com.android.quickstep.views.RecentsView; @@ -74,21 +71,18 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr private final InterpolatorWrapper mAllAppsInterpolatorWrapper = new InterpolatorWrapper(); - private final boolean mAllowDragToOverview; - // If true, we will finish the current animation instantly on second touch. private boolean mFinishFastOnSecondTouch; - public PortraitStatesTouchController(Launcher l, boolean allowDragToOverview) { + public PortraitStatesTouchController(Launcher l) { super(l, SingleAxisSwipeDetector.VERTICAL); mOverviewPortraitStateTouchHelper = new PortraitOverviewStateTouchHelper(l); - mAllowDragToOverview = allowDragToOverview; } @Override protected boolean canInterceptTouch(MotionEvent ev) { // If we are swiping to all apps instead of overview, allow it from anywhere. - boolean interceptAnywhere = mLauncher.isInState(NORMAL) && !mAllowDragToOverview; + boolean interceptAnywhere = mLauncher.isInState(NORMAL); if (mCurrentAnimation != null) { if (mFinishFastOnSecondTouch) { mCurrentAnimation.getAnimationPlayer().end(); @@ -135,37 +129,23 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr Log.d(TestProtocol.OVERIEW_NOT_ALLAPPS, "PortraitStatesTouchController.getTargetState"); } if (fromState == ALL_APPS && !isDragTowardPositive) { - // Should swipe down go to OVERVIEW instead? if (TestProtocol.sDebugTracing) { Log.d(TestProtocol.OVERIEW_NOT_ALLAPPS, "PortraitStatesTouchController.getTargetState 1"); } - if (removeShelfFromOverview(mLauncher)) { - // Don't allow swiping down to overview. - return NORMAL; - } - return TouchInteractionService.isConnected() ? - mLauncher.getStateManager().getLastState() : NORMAL; + return NORMAL; } else if (fromState == OVERVIEW) { if (TestProtocol.sDebugTracing) { Log.d(TestProtocol.OVERIEW_NOT_ALLAPPS, "PortraitStatesTouchController.getTargetState 2"); } - LauncherState positiveDragTarget = ALL_APPS; - if (removeShelfFromOverview(mLauncher)) { - // Don't allow swiping up to all apps. - positiveDragTarget = OVERVIEW; - } - return isDragTowardPositive ? positiveDragTarget : NORMAL; + return isDragTowardPositive ? OVERVIEW : NORMAL; } else if (fromState == NORMAL && isDragTowardPositive) { if (TestProtocol.sDebugTracing) { Log.d(TestProtocol.OVERIEW_NOT_ALLAPPS, "PortraitStatesTouchController.getTargetState 3"); } - int stateFlags = SystemUiProxy.INSTANCE.get(mLauncher).getLastSystemUiStateFlags(); - return mAllowDragToOverview && TouchInteractionService.isConnected() - && (stateFlags & SYSUI_STATE_OVERVIEW_DISABLED) == 0 - ? OVERVIEW : ALL_APPS; + return ALL_APPS; } return fromState; } diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/LandscapeEdgeSwipeController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TwoButtonNavbarToOverviewTouchController.java similarity index 56% rename from quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/LandscapeEdgeSwipeController.java rename to quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TwoButtonNavbarToOverviewTouchController.java index 7a0f634b45..ff4bfe6759 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/LandscapeEdgeSwipeController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TwoButtonNavbarToOverviewTouchController.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2020 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.NORMAL; @@ -15,14 +30,15 @@ import com.android.launcher3.touch.SingleAxisSwipeDetector; import com.android.quickstep.SystemUiProxy; /** - * Touch controller for handling edge swipes in landscape/seascape UI + * Touch controller for handling edge swipes in 2-button mode */ -public class LandscapeEdgeSwipeController extends AbstractStateChangeTouchController { +public class TwoButtonNavbarToOverviewTouchController extends AbstractStateChangeTouchController { - private static final String TAG = "LandscapeEdgeSwipeCtrl"; + private static final String TAG = "2BtnNavbarTouchCtrl"; - public LandscapeEdgeSwipeController(Launcher l) { - super(l, SingleAxisSwipeDetector.HORIZONTAL); + public TwoButtonNavbarToOverviewTouchController(Launcher l) { + super(l, l.getDeviceProfile().isVerticalBarLayout() + ? SingleAxisSwipeDetector.HORIZONTAL : SingleAxisSwipeDetector.VERTICAL); } @Override @@ -39,13 +55,19 @@ public class LandscapeEdgeSwipeController extends AbstractStateChangeTouchContro @Override protected LauncherState getTargetState(LauncherState fromState, boolean isDragTowardPositive) { - boolean draggingFromNav = mLauncher.getDeviceProfile().isSeascape() == isDragTowardPositive; - return draggingFromNav ? OVERVIEW : NORMAL; + if (mLauncher.getDeviceProfile().isVerticalBarLayout()) { + boolean draggingFromNav = + mLauncher.getDeviceProfile().isSeascape() == isDragTowardPositive; + return draggingFromNav ? OVERVIEW : NORMAL; + } else { + return isDragTowardPositive ? OVERVIEW : NORMAL; + } } @Override protected float getShiftRange() { - return mLauncher.getDragLayer().getWidth(); + return mLauncher.getDeviceProfile().isVerticalBarLayout() + ? mLauncher.getDragLayer().getWidth() : super.getShiftRange(); } @Override diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java index 9089ae5f96..b4f20d10d5 100644 --- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java +++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java @@ -20,8 +20,6 @@ import static com.android.launcher3.anim.Interpolators.INSTANT; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.quickstep.AbsSwipeUpHandler.RECENTS_ATTACH_DURATION; import static com.android.quickstep.SysUINavigationMode.getMode; -import static com.android.quickstep.SysUINavigationMode.hideShelfInTwoButtonLandscape; -import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview; import static com.android.quickstep.util.RecentsAtomicAnimationFactory.INDEX_RECENTS_FADE_ANIM; import static com.android.quickstep.util.RecentsAtomicAnimationFactory.INDEX_RECENTS_TRANSLATE_X_ANIM; import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET; @@ -186,33 +184,26 @@ public abstract class BaseActivityInterface { @Override public AtomicAnimationFactory createAtomicAnimationFactory() { - return new RecentsAtomicAnimationFactory<>(this, 0); + return new RecentsAtomicAnimationFactory<>(this); } private AnimatorListenerAdapter resetStateListener() { diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java index d8064a2153..960abeb61b 100644 --- a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java +++ b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java @@ -21,7 +21,6 @@ import static com.android.launcher3.util.DisplayController.DisplayHolder.CHANGE_ import static com.android.launcher3.util.DisplayController.DisplayHolder.CHANGE_FRAME_DELAY; import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; import static com.android.quickstep.SysUINavigationMode.Mode.THREE_BUTTONS; -import static com.android.quickstep.SysUINavigationMode.Mode.TWO_BUTTONS; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_CLICKABLE; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BUBBLES_EXPANDED; @@ -296,7 +295,7 @@ public class RecentsAnimationDeviceState implements * @return whether the current nav mode has some gestures (either 2 or 0 button mode). */ public boolean isGesturalNavMode() { - return mMode == TWO_BUTTONS || mMode == NO_BUTTON; + return mMode.hasGestures; } /** diff --git a/quickstep/src/com/android/quickstep/SysUINavigationMode.java b/quickstep/src/com/android/quickstep/SysUINavigationMode.java index 6b502186e9..71bf1bbef7 100644 --- a/quickstep/src/com/android/quickstep/SysUINavigationMode.java +++ b/quickstep/src/com/android/quickstep/SysUINavigationMode.java @@ -29,7 +29,6 @@ import android.util.Log; import com.android.launcher3.ResourceUtils; import com.android.launcher3.logging.StatsLogManager.LauncherEvent; -import com.android.launcher3.touch.PagedOrientationHandler; import com.android.launcher3.util.MainThreadInitializedObject; import java.io.PrintWriter; @@ -170,18 +169,6 @@ public class SysUINavigationMode { return mMode; } - /** @return Whether we can remove the shelf from overview. */ - public static boolean removeShelfFromOverview(Context context) { - // The shelf is core to the two-button mode model, so we need to continue supporting it. - return getMode(context) != Mode.TWO_BUTTONS; - } - - public static boolean hideShelfInTwoButtonLandscape(Context context, - PagedOrientationHandler pagedOrientationHandler) { - return getMode(context) == Mode.TWO_BUTTONS && - !pagedOrientationHandler.isLayoutNaturalToLauncher(); - } - public void dump(PrintWriter pw) { pw.println("SysUINavigationMode:"); pw.println(" mode=" + mMode.name()); diff --git a/quickstep/src/com/android/quickstep/util/LayoutUtils.java b/quickstep/src/com/android/quickstep/util/LayoutUtils.java index b88a195de4..8834dc2c6c 100644 --- a/quickstep/src/com/android/quickstep/util/LayoutUtils.java +++ b/quickstep/src/com/android/quickstep/util/LayoutUtils.java @@ -15,15 +15,12 @@ */ package com.android.quickstep.util; -import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview; - import android.content.Context; import android.graphics.Rect; import android.view.View; import android.view.ViewGroup; import com.android.launcher3.DeviceProfile; -import com.android.launcher3.R; import com.android.launcher3.touch.PagedOrientationHandler; import com.android.quickstep.LauncherActivityInterface; import com.android.quickstep.SysUINavigationMode; @@ -44,16 +41,10 @@ public class LayoutUtils { public static int getShelfTrackingDistance(Context context, DeviceProfile dp, PagedOrientationHandler orientationHandler) { // Track the bottom of the window. - if (removeShelfFromOverview(context)) { - Rect taskSize = new Rect(); - LauncherActivityInterface.INSTANCE.calculateTaskSize(context, dp, taskSize, - orientationHandler); - return orientationHandler.getDistanceToBottomOfRect(dp, taskSize); - } - int shelfHeight = dp.hotseatBarSizePx + dp.getInsets().bottom; - int spaceBetweenShelfAndRecents = (int) context.getResources().getDimension( - R.dimen.task_card_vert_space); - return shelfHeight + spaceBetweenShelfAndRecents; + Rect taskSize = new Rect(); + LauncherActivityInterface.INSTANCE.calculateTaskSize( + context, dp, taskSize, orientationHandler); + return orientationHandler.getDistanceToBottomOfRect(dp, taskSize); } /** diff --git a/quickstep/src/com/android/quickstep/util/QuickstepOnboardingPrefs.java b/quickstep/src/com/android/quickstep/util/QuickstepOnboardingPrefs.java index b10adb43b5..a85f0d2c49 100644 --- a/quickstep/src/com/android/quickstep/util/QuickstepOnboardingPrefs.java +++ b/quickstep/src/com/android/quickstep/util/QuickstepOnboardingPrefs.java @@ -22,7 +22,6 @@ 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.quickstep.SysUINavigationMode.Mode.NO_BUTTON; -import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview; import android.content.SharedPreferences; @@ -64,27 +63,6 @@ public class QuickstepOnboardingPrefs extends OnboardingPrefs }); } - boolean shelfBounceSeen = getBoolean(SHELF_BOUNCE_SEEN); - if (!shelfBounceSeen && removeShelfFromOverview(launcher)) { - // There's no shelf in overview, so don't bounce it (can't get to all apps anyway). - shelfBounceSeen = true; - mSharedPrefs.edit().putBoolean(SHELF_BOUNCE_SEEN, shelfBounceSeen).apply(); - } - if (!shelfBounceSeen) { - stateManager.addStateListener(new StateListener() { - @Override - public void onStateTransitionComplete(LauncherState finalState) { - LauncherState prevState = stateManager.getLastState(); - - if ((finalState == ALL_APPS && prevState == OVERVIEW) || - hasReachedMaxCount(SHELF_BOUNCE_COUNT)) { - mSharedPrefs.edit().putBoolean(SHELF_BOUNCE_SEEN, true).apply(); - stateManager.removeStateListener(this); - } - } - }); - } - if (FeatureFlags.ENABLE_HYBRID_HOTSEAT.get() && !hasReachedMaxCount( HOTSEAT_DISCOVERY_TIP_COUNT)) { stateManager.addStateListener(new StateListener() { diff --git a/quickstep/src/com/android/quickstep/util/RecentsAtomicAnimationFactory.java b/quickstep/src/com/android/quickstep/util/RecentsAtomicAnimationFactory.java index 5b0d50317f..ba70bf70a4 100644 --- a/quickstep/src/com/android/quickstep/util/RecentsAtomicAnimationFactory.java +++ b/quickstep/src/com/android/quickstep/util/RecentsAtomicAnimationFactory.java @@ -32,16 +32,11 @@ public class RecentsAtomicAnimationFactory extends FrameLayo private final Rect mInsets = new Rect(); @IntDef(flag = true, value = { - HIDDEN_UNSUPPORTED_NAVIGATION, HIDDEN_NON_ZERO_ROTATION, HIDDEN_NO_TASKS, HIDDEN_NO_RECENTS}) @Retention(RetentionPolicy.SOURCE) public @interface ActionsHiddenFlags { } - public static final int HIDDEN_UNSUPPORTED_NAVIGATION = 1 << 0; - public static final int HIDDEN_NON_ZERO_ROTATION = 1 << 1; - public static final int HIDDEN_NO_TASKS = 1 << 2; - public static final int HIDDEN_NO_RECENTS = 1 << 3; + public static final int HIDDEN_NON_ZERO_ROTATION = 1 << 0; + public static final int HIDDEN_NO_TASKS = 1 << 1; + public static final int HIDDEN_NO_RECENTS = 1 << 2; @IntDef(flag = true, value = { DISABLED_SCROLLING, @@ -137,12 +134,6 @@ public class OverviewActionsView extends FrameLayo } } - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - updateHiddenFlags(HIDDEN_UNSUPPORTED_NAVIGATION, !removeShelfFromOverview(getContext())); - } - @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); diff --git a/quickstep/src/com/android/quickstep/views/ShelfScrimView.java b/quickstep/src/com/android/quickstep/views/ShelfScrimView.java index e6613ebe80..db04fc034c 100644 --- a/quickstep/src/com/android/quickstep/views/ShelfScrimView.java +++ b/quickstep/src/com/android/quickstep/views/ShelfScrimView.java @@ -15,7 +15,6 @@ */ package com.android.quickstep.views; -import static com.android.launcher3.LauncherState.ALL_APPS_HEADER_EXTRA; import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.anim.Interpolators.ACCEL; import static com.android.launcher3.anim.Interpolators.ACCEL_2; @@ -30,7 +29,6 @@ import android.graphics.Paint; import android.graphics.Path; import android.graphics.Path.Direction; import android.graphics.Path.Op; -import android.graphics.Rect; import android.util.AttributeSet; import android.view.animation.Interpolator; @@ -45,7 +43,6 @@ import com.android.launcher3.views.ScrimView; import com.android.quickstep.SysUINavigationMode; import com.android.quickstep.SysUINavigationMode.Mode; import com.android.quickstep.SysUINavigationMode.NavigationModeChangeListener; -import com.android.quickstep.util.LayoutUtils; /** * Scrim used for all-apps and shelf in Overview @@ -149,25 +146,11 @@ public class ShelfScrimView extends ScrimView mRemainingScreenPathValid = false; mShiftRange = mLauncher.getAllAppsController().getShiftRange(); - Context context = getContext(); - if ((OVERVIEW.getVisibleElements(mLauncher) & ALL_APPS_HEADER_EXTRA) == 0) { - if (SysUINavigationMode.removeShelfFromOverview(context)) { - // Fade in all apps background quickly to distinguish from swiping from nav bar. - mMidAlpha = Themes.getAttrInteger(context, R.attr.allAppsInterimScrimAlpha); - mMidProgress = OverviewState.getDefaultVerticalProgress(mLauncher); - } else { - mMidAlpha = 0; - mMidProgress = 1; - } - } else { - mMidAlpha = Themes.getAttrInteger(context, R.attr.allAppsInterimScrimAlpha); - mMidProgress = OVERVIEW.getVerticalProgress(mLauncher); - Rect hotseatPadding = dp.getHotseatLayoutPadding(); - int hotseatSize = dp.hotseatBarSizePx + dp.getInsets().bottom - + hotseatPadding.bottom + hotseatPadding.top; - float dragHandleTop = - Math.min(hotseatSize, LayoutUtils.getDefaultSwipeHeight(context, dp)); - } + // Fade in all apps background quickly to distinguish from swiping from nav bar. + mMidAlpha = Themes.getAttrInteger(getContext(), R.attr.allAppsInterimScrimAlpha); + mMidProgress = 1 - (OverviewState.getDefaultSwipeHeight(mLauncher) + / mLauncher.getAllAppsController().getShiftRange()); + mTopOffset = dp.getInsets().top; mShelfTopAtThreshold = mShiftRange * SCRIM_CATCHUP_THRESHOLD + mTopOffset; } diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java index cc97f4b06f..0fe5432ceb 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java @@ -31,14 +31,11 @@ import androidx.test.uiautomator.Until; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; -import com.android.launcher3.tapl.AllApps; -import com.android.launcher3.tapl.AllAppsFromOverview; import com.android.launcher3.tapl.Background; import com.android.launcher3.tapl.LauncherInstrumentation.NavigationModel; import com.android.launcher3.tapl.Overview; import com.android.launcher3.tapl.OverviewActions; import com.android.launcher3.tapl.OverviewTask; -import com.android.launcher3.tapl.TestHelpers; import com.android.launcher3.ui.TaplTestsLauncher3; import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch; import com.android.quickstep.views.RecentsView; @@ -93,19 +90,6 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { isInState(() -> LauncherState.ALL_APPS)); } - @Test - public void testAllAppsFromOverview() throws Exception { - if (!mLauncher.hasAllAppsInOverview()) { - return; - } - - // Test opening all apps from Overview. - assertNotNull("switchToAllApps() returned null", - mLauncher.getWorkspace().switchToOverview().switchToAllApps()); - - TaplTestsLauncher3.runAllAppsTest(this, mLauncher.getAllAppsFromOverview()); - } - @Test @PortraitLandscape public void testOverview() throws Exception { @@ -159,28 +143,6 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { launcher -> assertEquals("Dismissing a task didn't remove 1 task from Overview", numTasks - 1, getTaskCount(launcher))); - if (mLauncher.hasAllAppsInOverview() && (!TestHelpers.isInLauncherProcess() - || getFromLauncher(launcher -> !launcher.getDeviceProfile().isLandscape))) { - // Test switching to all apps and back. - final AllAppsFromOverview allApps = overview.switchToAllApps(); - assertNotNull("overview.switchToAllApps() returned null (1)", allApps); - assertTrue("Launcher internal state is not All Apps (1)", - isInState(() -> LauncherState.ALL_APPS)); - - overview = allApps.switchBackToOverview(); - assertNotNull("allApps.switchBackToOverview() returned null", overview); - assertTrue("Launcher internal state didn't switch to Overview", - isInState(() -> LauncherState.OVERVIEW)); - - // Test UIDevice.pressBack() - overview.switchToAllApps(); - assertNotNull("overview.switchToAllApps() returned null (2)", allApps); - assertTrue("Launcher internal state is not All Apps (2)", - isInState(() -> LauncherState.ALL_APPS)); - mDevice.pressBack(); - mLauncher.getOverview(); - } - // Test UIDevice.pressHome, once we are in AllApps. mDevice.pressHome(); waitForState("Launcher internal state didn't switch to Home", () -> LauncherState.NORMAL); @@ -200,19 +162,17 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { @NavigationModeSwitch @PortraitLandscape public void testOverviewActions() throws Exception { - if (mLauncher.getNavigationModel() != NavigationModel.TWO_BUTTON) { - // Experimenting for b/165029151: - final Overview overview = mLauncher.pressHome().switchToOverview(); - if (overview.hasTasks()) overview.dismissAllTasks(); - mLauncher.pressHome(); - // + // Experimenting for b/165029151: + final Overview overview = mLauncher.pressHome().switchToOverview(); + if (overview.hasTasks()) overview.dismissAllTasks(); + mLauncher.pressHome(); + // - startTestAppsWithCheck(); - OverviewActions actionsView = - mLauncher.pressHome().switchToOverview().getOverviewActions(); - actionsView.clickAndDismissScreenshot(); - actionsView.clickAndDismissShare(); - } + startTestAppsWithCheck(); + OverviewActions actionsView = + mLauncher.pressHome().switchToOverview().getOverviewActions(); + actionsView.clickAndDismissScreenshot(); + actionsView.clickAndDismissShare(); } private int getCurrentOverviewPage(Launcher launcher) { @@ -223,20 +183,6 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { return launcher.getOverviewPanel().getTaskViewCount(); } - @Test - public void testAppIconLaunchFromAllAppsFromOverview() throws Exception { - if (!mLauncher.hasAllAppsInOverview()) { - return; - } - - final AllApps allApps = - mLauncher.getWorkspace().switchToOverview().switchToAllApps(); - assertTrue("Launcher internal state is not All Apps", - isInState(() -> LauncherState.ALL_APPS)); - - TaplTestsLauncher3.runIconLaunchFromAllAppsTest(this, allApps); - } - @Test @NavigationModeSwitch @PortraitLandscape diff --git a/res/layout/launcher.xml b/res/layout/launcher.xml index 0c18c8a2ba..8451b77bc0 100644 --- a/res/layout/launcher.xml +++ b/res/layout/launcher.xml @@ -49,11 +49,6 @@ android:id="@+id/hotseat" layout="@layout/hotseat" /> - - - + + diff --git a/src/com/android/launcher3/allapps/DiscoveryBounce.java b/src/com/android/launcher3/allapps/DiscoveryBounce.java index 0005db88c8..d8ef18e754 100644 --- a/src/com/android/launcher3/allapps/DiscoveryBounce.java +++ b/src/com/android/launcher3/allapps/DiscoveryBounce.java @@ -17,7 +17,6 @@ package com.android.launcher3.allapps; import static com.android.launcher3.LauncherState.NORMAL; -import static com.android.launcher3.LauncherState.OVERVIEW; import android.animation.Animator; import android.animation.AnimatorInflater; @@ -32,7 +31,6 @@ import com.android.launcher3.LauncherState; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.statemanager.StateManager.StateListener; -import com.android.launcher3.touch.PagedOrientationHandler; import com.android.launcher3.util.OnboardingPrefs; /** @@ -147,39 +145,6 @@ public class DiscoveryBounce extends AbstractFloatingView { new DiscoveryBounce(launcher, 0).show(); } - public static void showForOverviewIfNeeded(Launcher launcher, - PagedOrientationHandler orientationHandler) { - showForOverviewIfNeeded(launcher, true, orientationHandler); - } - - private static void showForOverviewIfNeeded(Launcher launcher, boolean withDelay, - PagedOrientationHandler orientationHandler) { - OnboardingPrefs onboardingPrefs = launcher.getOnboardingPrefs(); - if (!launcher.isInState(OVERVIEW) - || !launcher.hasBeenResumed() - || launcher.isForceInvisible() - || launcher.getDeviceProfile().isVerticalBarLayout() - || !orientationHandler.isLayoutNaturalToLauncher() - || onboardingPrefs.getBoolean(OnboardingPrefs.SHELF_BOUNCE_SEEN) - || launcher.getSystemService(UserManager.class).isDemoUser() - || Utilities.IS_RUNNING_IN_TEST_HARNESS) { - return; - } - - if (withDelay) { - new Handler().postDelayed(() -> showForOverviewIfNeeded(launcher, false, - orientationHandler), DELAY_MS); - return; - } else if (AbstractFloatingView.getTopOpenView(launcher) != null) { - // TODO: Move these checks to the top and call this method after invalidate handler. - return; - } - onboardingPrefs.incrementEventCount(OnboardingPrefs.SHELF_BOUNCE_COUNT); - - new DiscoveryBounce(launcher, (1 - OVERVIEW.getVerticalProgress(launcher))) - .show(); - } - /** * A wrapper around {@link AllAppsTransitionController} allowing a fixed shift in the value. */ diff --git a/src/com/android/launcher3/util/OnboardingPrefs.java b/src/com/android/launcher3/util/OnboardingPrefs.java index 1b33197879..539768ecc2 100644 --- a/src/com/android/launcher3/util/OnboardingPrefs.java +++ b/src/com/android/launcher3/util/OnboardingPrefs.java @@ -33,7 +33,6 @@ import java.util.Map; public class OnboardingPrefs { public static final String HOME_BOUNCE_SEEN = "launcher.apps_view_shown"; - public static final String SHELF_BOUNCE_SEEN = "launcher.shelf_bounce_seen"; public static final String HOME_BOUNCE_COUNT = "launcher.home_bounce_count"; public static final String SHELF_BOUNCE_COUNT = "launcher.shelf_bounce_count"; public static final String HOTSEAT_DISCOVERY_TIP_COUNT = "launcher.hotseat_discovery_tip_count"; @@ -44,7 +43,6 @@ public class OnboardingPrefs { */ @StringDef(value = { HOME_BOUNCE_SEEN, - SHELF_BOUNCE_SEEN, HOTSEAT_LONGPRESS_TIP_SEEN }) @Retention(RetentionPolicy.SOURCE) @@ -55,7 +53,6 @@ public class OnboardingPrefs { */ @StringDef(value = { HOME_BOUNCE_COUNT, - SHELF_BOUNCE_COUNT, HOTSEAT_DISCOVERY_TIP_COUNT }) @Retention(RetentionPolicy.SOURCE) @@ -65,7 +62,6 @@ public class OnboardingPrefs { static { Map maxCounts = new ArrayMap<>(4); maxCounts.put(HOME_BOUNCE_COUNT, 3); - maxCounts.put(SHELF_BOUNCE_COUNT, 3); maxCounts.put(HOTSEAT_DISCOVERY_TIP_COUNT, 5); MAX_COUNTS = Collections.unmodifiableMap(maxCounts); } diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index 3c89cfd14b..e2a442db9b 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -595,11 +595,7 @@ public final class LauncherInstrumentation { return waitForLauncherObject(APPS_RES_ID); } case OVERVIEW: { - if (hasAllAppsInOverview()) { - waitForLauncherObject(APPS_RES_ID); - } else { - waitUntilLauncherObjectGone(APPS_RES_ID); - } + waitUntilLauncherObjectGone(APPS_RES_ID); waitUntilLauncherObjectGone(WORKSPACE_RES_ID); waitUntilLauncherObjectGone(WIDGETS_RES_ID); @@ -1297,19 +1293,6 @@ public final class LauncherInstrumentation { getTestInfo(TestProtocol.REQUEST_ENABLE_DEBUG_TRACING); } - public boolean hasAllAppsInOverview() { - // Vertical bar layouts don't contain all apps - if (!mDevice.isNaturalOrientation()) { - return false; - } - // Portrait two button (quickstep) always has all apps. - if (getNavigationModel() == NavigationModel.TWO_BUTTON) { - return true; - } - // ...otherwise there are overview actions, which hide all apps - return false; - } - boolean overviewShareEnabled() { return getTestInfo(TestProtocol.REQUEST_OVERVIEW_SHARE_ENABLED).getBoolean( TestProtocol.TEST_INFO_RESPONSE_FIELD);