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

Commit f4cf80ea authored by Alex Chau's avatar Alex Chau
Browse files

Handle swipe up after quick switch in overview grid

- If swipe up after task launches, move the task to be the first and focused it
- If swipe up before task launches, make sure the task can be sanpped to by moving ClearAllButton further away
- Before snapping to page on swipe up, make sure scroll calculation is up to date and consider the target gesture state
- Removed home task special casing in fallback recents, as the snapped page logic handles invariant scroll generically
- Invoke reset when launching home in fallback recents

Bug: 175939487
Fixes: 184262404
Fixes: 185468049
Test: Manual
Change-Id: I5a6c581f15cd62748cfe6c77342d959f4dd1bfaf
parent 18260ccb
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -968,6 +968,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
            if (mRecentsView != null) {
                int nearestPage = mRecentsView.getDestinationPage();
                boolean isScrolling = false;
                // Update page scroll before snapping to page to make sure we snapped to the
                // position calculated with target gesture in mind.
                mRecentsView.updateScrollSynchronously();
                if (mRecentsView.getNextPage() != nearestPage) {
                    // We shouldn't really scroll to the next page when swiping up to recents.
                    // Only allow settling on the next page if it's nearest to the center.
+14 −5
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ package com.android.quickstep.fallback;

import static com.android.quickstep.GestureState.GestureEndTarget.RECENTS;
import static com.android.quickstep.fallback.RecentsState.DEFAULT;
import static com.android.quickstep.fallback.RecentsState.HOME;
import static com.android.quickstep.fallback.RecentsState.MODAL_TASK;

import android.annotation.TargetApi;
@@ -97,6 +98,15 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity, RecentsSta
        }
    }

    @Override
    public void onGestureAnimationEnd() {
        if (mCurrentGestureEndTarget == GestureState.GestureEndTarget.HOME) {
            // Clean-up logic that occurs when recents is no longer in use/visible.
            reset();
        }
        super.onGestureAnimationEnd();
    }

    @Override
    public void setCurrentTask(int runningTaskId) {
        super.setCurrentTask(runningTaskId);
@@ -155,11 +165,6 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity, RecentsSta
        super.setRunningTaskHidden(isHidden);
    }

    @Override
    protected boolean isHomeTask(TaskView taskView) {
        return mHomeTaskInfo != null && taskView.hasTaskId(mHomeTaskInfo.taskId);
    }

    @Override
    public void setModalStateEnabled(boolean isModalState) {
        super.setModalStateEnabled(isModalState);
@@ -182,6 +187,10 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity, RecentsSta

    @Override
    public void onStateTransitionComplete(RecentsState finalState) {
        if (finalState == HOME) {
            // Clean-up logic that occurs when recents is no longer in use/visible.
            reset();
        }
        setOverlayEnabled(finalState == DEFAULT || finalState == MODAL_TASK);
        setFreezeViewVisibility(false);
    }
+3 −3
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ public class ClearAllButton extends Button {
        }
    }

    public void onRecentsViewScroll(int scrollFromEdge, boolean gridEnabled) {
    public void onRecentsViewScroll(int scroll, boolean gridEnabled) {
        RecentsView recentsView = getRecentsView();
        if (recentsView == null) {
            return;
@@ -109,8 +109,8 @@ public class ClearAllButton extends Button {
            return;
        }

        int leftEdgeScroll = recentsView.getLeftMostChildScroll();
        int adjustedScrollFromEdge = scrollFromEdge - leftEdgeScroll;
        int clearAllScroll = recentsView.getClearAllScroll();
        int adjustedScrollFromEdge = Math.abs(scroll - clearAllScroll);
        float shift = Math.min(adjustedScrollFromEdge, orientationSize);
        mNormalTranslationPrimary = mIsRtl ? -shift : shift;
        if (!gridEnabled) {
+184 −107

File changed.

Preview size limit exceeded, changes collapsed.

+21 −8

File changed.

Preview size limit exceeded, changes collapsed.