Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 107dd8dd authored by Tony Wickham's avatar Tony Wickham
Browse files

Track bottom of the app window when ENABLE_OVERVIEW_ACTIONS is true

- Fix the shelf tracking distance since there's no shelf.
- Pullback against a swipe up from an app later

Bug: 143361609
Change-Id: I296fb9bcb20d7d45931006f20512f0dc4a54212b
parent 2e0b8e39
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@ package com.android.quickstep;


import static com.android.launcher3.anim.Interpolators.ACCEL_1_5;
import static com.android.launcher3.anim.Interpolators.ACCEL_1_5;
import static com.android.launcher3.anim.Interpolators.DEACCEL;
import static com.android.launcher3.anim.Interpolators.DEACCEL;
import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC;
import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC;
@@ -75,9 +76,11 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten
    protected static final Rect TEMP_RECT = new Rect();
    protected static final Rect TEMP_RECT = new Rect();


    // Start resisting when swiping past this factor of mTransitionDragLength.
    // Start resisting when swiping past this factor of mTransitionDragLength.
    private static final float DRAG_LENGTH_FACTOR_START_PULLBACK = 1.4f;
    private static final float DRAG_LENGTH_FACTOR_START_PULLBACK = ENABLE_OVERVIEW_ACTIONS.get()
            ? 2.8f : 1.4f;
    // This is how far down we can scale down, where 0f is full screen and 1f is recents.
    // This is how far down we can scale down, where 0f is full screen and 1f is recents.
    private static final float DRAG_LENGTH_FACTOR_MAX_PULLBACK = 1.8f;
    private static final float DRAG_LENGTH_FACTOR_MAX_PULLBACK = ENABLE_OVERVIEW_ACTIONS.get()
            ? 3.6f : 1.8f;
    private static final Interpolator PULLBACK_INTERPOLATOR = DEACCEL;
    private static final Interpolator PULLBACK_INTERPOLATOR = DEACCEL;


    // The distance needed to drag to reach the task size in recents.
    // The distance needed to drag to reach the task size in recents.
+10 −4
Original line number Original line Diff line number Diff line
@@ -15,6 +15,8 @@
 */
 */
package com.android.quickstep.util;
package com.android.quickstep.util;


import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;

import static java.lang.annotation.RetentionPolicy.SOURCE;
import static java.lang.annotation.RetentionPolicy.SOURCE;


import android.content.Context;
import android.content.Context;
@@ -26,7 +28,6 @@ import androidx.annotation.IntDef;


import com.android.launcher3.DeviceProfile;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.R;
import com.android.launcher3.config.FeatureFlags;
import com.android.quickstep.SysUINavigationMode;
import com.android.quickstep.SysUINavigationMode;


import java.lang.annotation.Retention;
import java.lang.annotation.Retention;
@@ -58,7 +59,7 @@ public class LayoutUtils {
        } else {
        } else {
            Resources res = context.getResources();
            Resources res = context.getResources();


            if (FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get()) {
            if (ENABLE_OVERVIEW_ACTIONS.get()) {
                //TODO: this needs to account for the swipe gesture height and accessibility
                //TODO: this needs to account for the swipe gesture height and accessibility
                // UI when shown.
                // UI when shown.
                extraSpace = 0;
                extraSpace = 0;
@@ -111,7 +112,7 @@ public class LayoutUtils {
            final int paddingResId;
            final int paddingResId;
            if (dp.isVerticalBarLayout()) {
            if (dp.isVerticalBarLayout()) {
                paddingResId = R.dimen.landscape_task_card_horz_space;
                paddingResId = R.dimen.landscape_task_card_horz_space;
            } else if (FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get()) {
            } else if (ENABLE_OVERVIEW_ACTIONS.get()) {
                paddingResId = R.dimen.portrait_task_card_horz_space_big_overview;
                paddingResId = R.dimen.portrait_task_card_horz_space_big_overview;
            } else {
            } else {
                paddingResId = R.dimen.portrait_task_card_horz_space;
                paddingResId = R.dimen.portrait_task_card_horz_space;
@@ -146,6 +147,11 @@ public class LayoutUtils {


    public static int getShelfTrackingDistance(Context context, DeviceProfile dp) {
    public static int getShelfTrackingDistance(Context context, DeviceProfile dp) {
        // Track the bottom of the window.
        // Track the bottom of the window.
        if (ENABLE_OVERVIEW_ACTIONS.get()) {
            Rect taskSize = new Rect();
            calculateLauncherTaskSize(context, dp, taskSize);
            return (dp.heightPx - taskSize.height()) / 2;
        }
        int shelfHeight = dp.hotseatBarSizePx + dp.getInsets().bottom;
        int shelfHeight = dp.hotseatBarSizePx + dp.getInsets().bottom;
        int spaceBetweenShelfAndRecents = (int) context.getResources().getDimension(
        int spaceBetweenShelfAndRecents = (int) context.getResources().getDimension(
                R.dimen.task_card_vert_space);
                R.dimen.task_card_vert_space);
@@ -157,7 +163,7 @@ public class LayoutUtils {
     * @return the margin in pixels.
     * @return the margin in pixels.
     */
     */
    public static int thumbnailBottomMargin(Resources resources) {
    public static int thumbnailBottomMargin(Resources resources) {
        if (FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get()) {
        if (ENABLE_OVERVIEW_ACTIONS.get()) {
            return resources.getDimensionPixelSize(R.dimen.overview_actions_height);
            return resources.getDimensionPixelSize(R.dimen.overview_actions_height);
        } else {
        } else {
            return 0;
            return 0;