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

Commit 14c8f45b authored by Alex Chau's avatar Alex Chau Committed by Android (Google) Code Review
Browse files

Merge "Fix scroll task off screen to support different screen dimensions." into sc-v2-dev

parents 497d08aa 1b5975c2
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ import com.android.quickstep.views.RecentsView;

import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;

@@ -289,7 +288,6 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {

    @Test
    @PortraitLandscape
    @Ignore("b/203781041")
    public void testOverviewForTablet() throws Exception {
        if (!mLauncher.isTablet()) {
            return;
+3 −7
Original line number Diff line number Diff line
@@ -54,18 +54,14 @@ public class BaseOverview extends LauncherInstrumentation.VisibleContainer {
    }

    private void flingForwardImpl() {
        flingForwardImpl(0);
    }

    private void flingForwardImpl(int rightMargin) {
        try (LauncherInstrumentation.Closable c =
                     mLauncher.addContextLayer("want to fling forward in overview")) {
            LauncherInstrumentation.log("Overview.flingForward before fling");
            final UiObject2 overview = verifyActiveContainer();
            final int leftMargin =
                    mLauncher.getTargetInsets().left + mLauncher.getEdgeSensitivityWidth();
            mLauncher.scroll(overview, Direction.LEFT, new Rect(leftMargin + 1, 0, rightMargin, 0),
                    20, false);
            mLauncher.scroll(overview, Direction.LEFT, new Rect(leftMargin + 1, 0, 0, 0), 20,
                    false);
            try (LauncherInstrumentation.Closable c2 =
                         mLauncher.addContextLayer("flung forwards")) {
                verifyActiveContainer();
@@ -131,7 +127,7 @@ public class BaseOverview extends LauncherInstrumentation.VisibleContainer {

            OverviewTask task = getCurrentTask();
            mLauncher.assertNotNull("current task is null", task);
            flingForwardImpl(task.getTaskCenterX());
            mLauncher.scrollLeftByDistance(verifyActiveContainer(), task.getVisibleWidth());

            try (LauncherInstrumentation.Closable c2 =
                         mLauncher.addContextLayer("scrolled task off screen")) {
+24 −0
Original line number Diff line number Diff line
@@ -1190,10 +1190,19 @@ public final class LauncherInstrumentation {
        return getVisibleBounds(container).bottom - bottomGestureStartOnScreen;
    }

    int getRightGestureMarginInContainer(UiObject2 container) {
        final int rightGestureStartOnScreen = getRightGestureStartOnScreen();
        return getVisibleBounds(container).right - rightGestureStartOnScreen;
    }

    int getBottomGestureStartOnScreen() {
        return getRealDisplaySize().y - getBottomGestureSize();
    }

    int getRightGestureStartOnScreen() {
        return getRealDisplaySize().x - getWindowInsets().right;
    }

    void clickLauncherObject(UiObject2 object) {
        waitForObjectEnabled(object, "clickLauncherObject");
        expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_TOUCH_DOWN);
@@ -1235,6 +1244,21 @@ public final class LauncherInstrumentation {
                true);
    }

    void scrollLeftByDistance(UiObject2 container, int distance) {
        final Rect containerRect = getVisibleBounds(container);
        final int rightGestureMarginInContainer = getRightGestureMarginInContainer(container);
        scroll(
                container,
                Direction.LEFT,
                new Rect(
                        0,
                        containerRect.width() - distance - rightGestureMarginInContainer,
                        0,
                        rightGestureMarginInContainer),
                10,
                true);
    }

    void scroll(
            UiObject2 container, Direction direction, Rect margins, int steps, boolean slowDown) {
        final Rect rect = getVisibleBounds(container);
+4 −0
Original line number Diff line number Diff line
@@ -53,6 +53,10 @@ public final class OverviewTask {
        return mTask.getVisibleBounds().height();
    }

    int getVisibleWidth() {
        return mTask.getVisibleBounds().width();
    }

    int getTaskCenterX() {
        return mTask.getVisibleCenter().x;
    }