diff --git a/quickstep/src/com/android/launcher3/uioverrides/BackgroundAppState.java b/quickstep/src/com/android/launcher3/uioverrides/BackgroundAppState.java index fdb13b1d16..8d28f3333e 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/BackgroundAppState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/BackgroundAppState.java @@ -41,7 +41,8 @@ public class BackgroundAppState extends OverviewState { if (launcher.getDeviceProfile().isVerticalBarLayout()) { return super.getVerticalProgress(launcher); } - int transitionLength = LayoutUtils.getShelfTrackingDistance(launcher.getDeviceProfile()); + int transitionLength = LayoutUtils.getShelfTrackingDistance(launcher, + launcher.getDeviceProfile()); AllAppsTransitionController controller = launcher.getAllAppsController(); float scrollRange = Math.max(controller.getShiftRange(), 1); float progressDelta = (transitionLength / scrollRange); diff --git a/quickstep/src/com/android/launcher3/uioverrides/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/PortraitStatesTouchController.java index 8684c58f1d..330dc87ac3 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/PortraitStatesTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/PortraitStatesTouchController.java @@ -213,7 +213,8 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr mCurrentAnimation = AnimatorPlaybackController.wrap(mPendingAnimation.anim, maxAccuracy, onCancelRunnable); mLauncher.getStateManager().setCurrentUserControlledAnimation(mCurrentAnimation); - totalShift = LayoutUtils.getShelfTrackingDistance(mLauncher.getDeviceProfile()); + totalShift = LayoutUtils.getShelfTrackingDistance(mLauncher, + mLauncher.getDeviceProfile()); } else { mCurrentAnimation = mLauncher.getStateManager() .createAnimationToNewWorkspace(mToState, builder, maxAccuracy, this::clearState, diff --git a/quickstep/src/com/android/quickstep/ActivityControlHelper.java b/quickstep/src/com/android/quickstep/ActivityControlHelper.java index 20aabae405..1570520244 100644 --- a/quickstep/src/com/android/quickstep/ActivityControlHelper.java +++ b/quickstep/src/com/android/quickstep/ActivityControlHelper.java @@ -216,7 +216,7 @@ public interface ActivityControlHelper { int hotseatInset = dp.isSeascape() ? targetInsets.left : targetInsets.right; return dp.hotseatBarSizePx + hotseatInset; } else { - return LayoutUtils.getShelfTrackingDistance(dp); + return LayoutUtils.getShelfTrackingDistance(context, dp); } } diff --git a/quickstep/src/com/android/quickstep/util/LayoutUtils.java b/quickstep/src/com/android/quickstep/util/LayoutUtils.java index 6ca0dcef23..ed585c1d87 100644 --- a/quickstep/src/com/android/quickstep/util/LayoutUtils.java +++ b/quickstep/src/com/android/quickstep/util/LayoutUtils.java @@ -21,14 +21,15 @@ import android.content.Context; import android.content.res.Resources; import android.graphics.Rect; -import com.android.launcher3.DeviceProfile; -import com.android.launcher3.R; - -import java.lang.annotation.Retention; - import androidx.annotation.AnyThread; import androidx.annotation.IntDef; +import com.android.launcher3.DeviceProfile; +import com.android.launcher3.R; +import com.android.launcher3.config.FeatureFlags; + +import java.lang.annotation.Retention; + public class LayoutUtils { private static final int MULTI_WINDOW_STRATEGY_HALF_SCREEN = 1; @@ -112,7 +113,14 @@ public class LayoutUtils { Math.round(x + outWidth), Math.round(y + outHeight)); } - public static int getShelfTrackingDistance(DeviceProfile dp) { + public static int getShelfTrackingDistance(Context context, DeviceProfile dp) { + if (FeatureFlags.SWIPE_HOME.get()) { + // Track the bottom of the window rather than the top of the shelf. + int shelfHeight = dp.hotseatBarSizePx + dp.getInsets().bottom; + int spaceBetweenShelfAndRecents = (int) context.getResources().getDimension( + R.dimen.task_card_vert_space); + return shelfHeight + spaceBetweenShelfAndRecents; + } // Start from a third of bottom inset to provide some shelf overlap. return dp.hotseatBarSizePx + dp.getInsets().bottom / 3 - dp.edgeMarginPx * 2; } diff --git a/src/com/android/launcher3/config/BaseFlags.java b/src/com/android/launcher3/config/BaseFlags.java index 1b1b15220b..da9914262f 100644 --- a/src/com/android/launcher3/config/BaseFlags.java +++ b/src/com/android/launcher3/config/BaseFlags.java @@ -104,6 +104,10 @@ abstract class BaseFlags { public static final TogglableFlag ENABLE_QUICKSTEP_LIVE_TILE = new TogglableFlag( "ENABLE_QUICKSTEP_LIVE_TILE", false, "Enable live tile in Quickstep overview"); + public static final ToggleableGlobalSettingsFlag SWIPE_HOME + = new ToggleableGlobalSettingsFlag("SWIPE_HOME", false, + "[WIP] Swiping up on the nav bar goes home. Swipe and hold goes to recent apps."); + public static void initialize(Context context) { // Avoid the disk read for user builds if (Utilities.IS_DEBUG_DEVICE) {