diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java index fa0d3f347b..8ff05f2aaa 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java @@ -45,8 +45,10 @@ public class BackgroundAppState extends OverviewState { if (launcher.getDeviceProfile().isVerticalBarLayout()) { return super.getVerticalProgress(launcher); } + RecentsView recentsView = launcher.getOverviewPanel(); int transitionLength = LayoutUtils.getShelfTrackingDistance(launcher, - launcher.getDeviceProfile()); + launcher.getDeviceProfile(), + recentsView.getPagedOrientationHandler()); AllAppsTransitionController controller = launcher.getAllAppsController(); float scrollRange = Math.max(controller.getShiftRange(), 1); float progressDelta = (transitionLength / scrollRange); @@ -73,9 +75,11 @@ public class BackgroundAppState extends OverviewState { public ScaleAndTranslation getHotseatScaleAndTranslation(Launcher launcher) { if ((getVisibleElements(launcher) & HOTSEAT_ICONS) != 0) { // Translate hotseat offscreen if we show it in overview. + RecentsView recentsView = launcher.getOverviewPanel(); ScaleAndTranslation scaleAndTranslation = super.getHotseatScaleAndTranslation(launcher); scaleAndTranslation.translationY += LayoutUtils.getShelfTrackingDistance(launcher, - launcher.getDeviceProfile()); + launcher.getDeviceProfile(), + recentsView.getPagedOrientationHandler()); return scaleAndTranslation; } return super.getHotseatScaleAndTranslation(launcher); diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java index 9b4e8906a1..d174bfd2d9 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java @@ -19,8 +19,7 @@ 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.Mode.TWO_BUTTONS; -import static com.android.quickstep.SysUINavigationMode.getMode; +import static com.android.quickstep.SysUINavigationMode.hideShelfInTwoButtonLandscape; import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview; import android.content.Context; @@ -130,10 +129,8 @@ public class OverviewState extends LauncherState { @Override public int getVisibleElements(Launcher launcher) { RecentsView recentsView = launcher.getOverviewPanel(); - boolean hideShelfTwoButtonLandscape = getMode(launcher) == TWO_BUTTONS && - !recentsView.getPagedOrientationHandler().isLayoutNaturalToLauncher(); if (ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(launcher) || - hideShelfTwoButtonLandscape) { + hideShelfInTwoButtonLandscape(launcher, recentsView.getPagedOrientationHandler())) { return OVERVIEW_BUTTONS; } else if (launcher.getDeviceProfile().isVerticalBarLayout()) { return VERTICAL_SWIPE_INDICATOR | OVERVIEW_BUTTONS; diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java index 7385658976..c1b68aba6b 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java @@ -116,7 +116,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController, mRecentsView = mLauncher.getOverviewPanel(); mXRange = mLauncher.getDeviceProfile().widthPx / 2f; mYRange = LayoutUtils.getShelfTrackingDistance( - mLauncher, mLauncher.getDeviceProfile()); + mLauncher, mLauncher.getDeviceProfile(), mRecentsView.getPagedOrientationHandler()); mMotionPauseDetector = new MotionPauseDetector(mLauncher); mMotionPauseMinDisplacement = mLauncher.getResources().getDimension( R.dimen.motion_pause_detector_min_displacement_from_app); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java index 614ba46503..66fefbe5ef 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java @@ -357,12 +357,13 @@ public abstract class BaseSwipeUpHandler, Q extend protected void initTransitionEndpoints(DeviceProfile dp) { mDp = dp; - mTransitionDragLength = mActivityInterface.getSwipeUpDestinationAndLength( - dp, mContext, TEMP_RECT); mTaskViewSimulator.setDp(dp); mTaskViewSimulator.setLayoutRotation( mDeviceState.getCurrentActiveRotation(), mDeviceState.getDisplayRotation()); + mTransitionDragLength = mActivityInterface.getSwipeUpDestinationAndLength( + dp, mContext, TEMP_RECT, + mTaskViewSimulator.getOrientationState().getOrientationHandler()); if (mDeviceState.isFullyGesturalNavMode()) { // We can drag all the way to the top of the screen. diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java index 4b3af31f38..8dfe75ef24 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java @@ -33,6 +33,7 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.R; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.PendingAnimation; +import com.android.launcher3.touch.PagedOrientationHandler; import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.quickstep.fallback.FallbackRecentsView; import com.android.quickstep.fallback.RecentsState; @@ -58,8 +59,9 @@ public final class FallbackActivityInterface extends } @Override - public int getSwipeUpDestinationAndLength(DeviceProfile dp, Context context, Rect outRect) { - calculateTaskSize(context, dp, outRect); + public int getSwipeUpDestinationAndLength(DeviceProfile dp, Context context, Rect outRect, + PagedOrientationHandler orientationHandler) { + calculateTaskSize(context, dp, outRect, orientationHandler); if (dp.isVerticalBarLayout() && SysUINavigationMode.INSTANCE.get(context).getMode() != NO_BUTTON) { Rect targetInsets = dp.getInsets(); @@ -100,7 +102,8 @@ public final class FallbackActivityInterface extends rv.setContentAlpha(1); } createActivityInterface(getSwipeUpDestinationAndLength( - activity.getDeviceProfile(), activity, new Rect())); + activity.getDeviceProfile(), activity, new Rect(), + rv.getPagedOrientationHandler())); } @Override @@ -193,7 +196,8 @@ public final class FallbackActivityInterface extends } @Override - protected float getExtraSpace(Context context, DeviceProfile dp) { + protected float getExtraSpace(Context context, DeviceProfile dp, + PagedOrientationHandler orientationHandler) { return showOverviewActions(context) ? context.getResources().getDimensionPixelSize(R.dimen.overview_actions_height) : 0; diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java index 5dbf199599..317d4da92d 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java @@ -21,13 +21,12 @@ import static com.android.launcher3.LauncherState.OVERVIEW; 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.launcher3.uioverrides.states.QuickstepAtomicAnimationFactory.INDEX_RECENTS_FADE_ANIM; import static com.android.launcher3.uioverrides.states.QuickstepAtomicAnimationFactory.INDEX_RECENTS_TRANSLATE_X_ANIM; import static com.android.launcher3.uioverrides.states.QuickstepAtomicAnimationFactory.INDEX_SHELF_ANIM; import static com.android.quickstep.LauncherSwipeHandler.RECENTS_ATTACH_DURATION; import static com.android.quickstep.SysUINavigationMode.getMode; -import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview; +import static com.android.quickstep.SysUINavigationMode.hideShelfInTwoButtonLandscape; import static com.android.quickstep.util.LayoutUtils.getDefaultSwipeHeight; import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET; import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS; @@ -57,6 +56,7 @@ import com.android.launcher3.appprediction.PredictionUiStateManager; import com.android.launcher3.statehandlers.DepthController; import com.android.launcher3.statehandlers.DepthController.ClampedDepthProperty; import com.android.launcher3.testing.TestProtocol; +import com.android.launcher3.touch.PagedOrientationHandler; import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.quickstep.SysUINavigationMode.Mode; import com.android.quickstep.util.ActivityInitListener; @@ -84,14 +84,15 @@ public final class LauncherActivityInterface extends } @Override - public int getSwipeUpDestinationAndLength(DeviceProfile dp, Context context, Rect outRect) { - calculateTaskSize(context, dp, outRect); + public int getSwipeUpDestinationAndLength(DeviceProfile dp, Context context, Rect outRect, + PagedOrientationHandler orientationHandler) { + calculateTaskSize(context, dp, outRect, orientationHandler); if (dp.isVerticalBarLayout() && SysUINavigationMode.getMode(context) != Mode.NO_BUTTON) { Rect targetInsets = dp.getInsets(); int hotseatInset = dp.isSeascape() ? targetInsets.left : targetInsets.right; return dp.hotseatBarSizePx + hotseatInset; } else { - return LayoutUtils.getShelfTrackingDistance(context, dp); + return LayoutUtils.getShelfTrackingDistance(context, dp, orientationHandler); } } @@ -395,9 +396,11 @@ public final class LauncherActivityInterface extends } @Override - protected float getExtraSpace(Context context, DeviceProfile dp) { - if (dp.isVerticalBarLayout()) { - return 0; + protected float getExtraSpace(Context context, DeviceProfile dp, + PagedOrientationHandler orientationHandler) { + if (dp.isVerticalBarLayout() || + hideShelfInTwoButtonLandscape(context, orientationHandler)) { + return 0; } else { Resources res = context.getResources(); if (showOverviewActions(context)) { diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java index d4c746f8c6..0d49b2b500 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java @@ -7,6 +7,7 @@ import android.os.Bundle; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.testing.TestInformationHandler; import com.android.launcher3.testing.TestProtocol; +import com.android.launcher3.touch.PagedOrientationHandler; import com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController; import com.android.quickstep.util.LayoutUtils; import com.android.systemui.shared.recents.model.Task; @@ -35,7 +36,8 @@ public class QuickstepTestInformationHandler extends TestInformationHandler { case TestProtocol.REQUEST_BACKGROUND_TO_OVERVIEW_SWIPE_HEIGHT: { final float swipeHeight = - LayoutUtils.getShelfTrackingDistance(mContext, mDeviceProfile); + LayoutUtils.getShelfTrackingDistance(mContext, mDeviceProfile, + PagedOrientationHandler.HOME_ROTATED); response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, (int) swipeHeight); return response; } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java index f4f7e9c957..178c53e0ff 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java @@ -116,7 +116,8 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { if (mDp == null) { return 1; } - mSizeStrategy.calculateTaskSize(mContext, mDp, mTaskRect); + mSizeStrategy.calculateTaskSize(mContext, mDp, mTaskRect, + mOrientationState.getOrientationHandler()); return mOrientationState.getFullScreenScaleAndPivot(mTaskRect, mDp, mPivot); } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java index 3fc235c2f0..aee86db86b 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java @@ -827,6 +827,10 @@ public abstract class RecentsView extends PagedView impl @Override public void setInsets(Rect insets) { mInsets.set(insets); + resetPaddingFromTaskSize(); + } + + private void resetPaddingFromTaskSize() { DeviceProfile dp = mActivity.getDeviceProfile(); mOrientationState.setMultiWindowMode(dp.isMultiWindowMode); getTaskSize(mTempRect); @@ -840,7 +844,8 @@ public abstract class RecentsView extends PagedView impl } public void getTaskSize(Rect outRect) { - mSizeStrategy.calculateTaskSize(mActivity, mActivity.getDeviceProfile(), outRect); + mSizeStrategy.calculateTaskSize(mActivity, mActivity.getDeviceProfile(), outRect, + mOrientationHandler); } /** Gets the task size for modal state. */ @@ -1618,6 +1623,7 @@ public abstract class RecentsView extends PagedView impl mActivity.getDragLayer().recreateControllers(); mActionsView.updateHiddenFlags(HIDDEN_NON_ZERO_ROTATION, touchRotation != 0 || mOrientationState.getLauncherRotation() != ROTATION_0); + resetPaddingFromTaskSize(); requestLayout(); } } diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java index e5c9fc96ad..f77b60b977 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java @@ -51,6 +51,7 @@ import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.quickstep.SystemUiProxy; import com.android.quickstep.TouchInteractionService; import com.android.quickstep.util.LayoutUtils; +import com.android.quickstep.views.RecentsView; /** * Touch controller for handling various state transitions in portrait UI. @@ -244,8 +245,9 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr mCurrentAnimation = mPendingAnimation.createPlaybackController() .setOnCancelRunnable(onCancelRunnable); mLauncher.getStateManager().setCurrentUserControlledAnimation(mCurrentAnimation); + RecentsView recentsView = mLauncher.getOverviewPanel(); totalShift = LayoutUtils.getShelfTrackingDistance(mLauncher, - mLauncher.getDeviceProfile()); + mLauncher.getDeviceProfile(), recentsView.getPagedOrientationHandler()); } else { mCurrentAnimation = mLauncher.getStateManager() .createAnimationToNewWorkspace(mToState, config) diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java index f29f0ffe30..19932cb4b3 100644 --- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java +++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java @@ -17,6 +17,7 @@ package com.android.quickstep; import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS; import static com.android.quickstep.SysUINavigationMode.getMode; +import static com.android.quickstep.SysUINavigationMode.hideShelfInTwoButtonLandscape; import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview; import android.annotation.TargetApi; @@ -37,6 +38,7 @@ import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.statehandlers.DepthController; import com.android.launcher3.statemanager.BaseState; import com.android.launcher3.statemanager.StatefulActivity; +import com.android.launcher3.touch.PagedOrientationHandler; import com.android.launcher3.util.WindowBounds; import com.android.quickstep.SysUINavigationMode.Mode; import com.android.quickstep.util.ActivityInitListener; @@ -73,7 +75,8 @@ public abstract class BaseActivityInterface