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

Commit 5dd52965 authored by Luca Zuccarini's avatar Luca Zuccarini Committed by Android (Google) Code Review
Browse files

Merge changes from topic "b/260218332-1" into tm-qpr-dev

* changes:
  Add a CUJ for closing All Apps manually.
  Add Tapl support for swiping from All Apps to Workspace.
parents eef0b164 d3841f36
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -186,12 +186,17 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
            case MotionEvent.ACTION_DOWN:
                InteractionJankMonitorWrapper.begin(
                        mLauncher.getRootView(), InteractionJankMonitorWrapper.CUJ_OPEN_ALL_APPS);
                InteractionJankMonitorWrapper.begin(
                        mLauncher.getRootView(),
                        InteractionJankMonitorWrapper.CUJ_CLOSE_ALL_APPS_SWIPE);
                break;

            case MotionEvent.ACTION_CANCEL:
            case MotionEvent.ACTION_UP:
                InteractionJankMonitorWrapper.cancel(
                        InteractionJankMonitorWrapper.CUJ_OPEN_ALL_APPS);
                InteractionJankMonitorWrapper.cancel(
                        InteractionJankMonitorWrapper.CUJ_CLOSE_ALL_APPS_SWIPE);
                break;
        }
        return super.onControllerInterceptTouchEvent(ev);
@@ -204,6 +209,10 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
        if (newToState != ALL_APPS) {
            InteractionJankMonitorWrapper.cancel(InteractionJankMonitorWrapper.CUJ_OPEN_ALL_APPS);
        }
        if (newToState != NORMAL) {
            InteractionJankMonitorWrapper.cancel(
                    InteractionJankMonitorWrapper.CUJ_CLOSE_ALL_APPS_SWIPE);
        }
    }

    @Override
@@ -211,6 +220,9 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
        super.onReachedFinalState(toState);
        if (toState == ALL_APPS) {
            InteractionJankMonitorWrapper.end(InteractionJankMonitorWrapper.CUJ_OPEN_ALL_APPS);
        } else if (toState == NORMAL) {
            InteractionJankMonitorWrapper.end(
                    InteractionJankMonitorWrapper.CUJ_CLOSE_ALL_APPS_SWIPE);
        }
    }

@@ -218,5 +230,7 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
    protected void clearState() {
        super.clearState();
        InteractionJankMonitorWrapper.cancel(InteractionJankMonitorWrapper.CUJ_OPEN_ALL_APPS);
        InteractionJankMonitorWrapper.cancel(
                InteractionJankMonitorWrapper.CUJ_CLOSE_ALL_APPS_SWIPE);
    }
}
+9 −0
Original line number Diff line number Diff line
@@ -193,6 +193,15 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
                isInState(() -> LauncherState.ALL_APPS));
    }

    @Test
    @PortraitLandscape
    public void testAllAppsSwitchToWorkspace() {
        assertNotNull("switchToWorkspace() returned null",
                mLauncher.getWorkspace().switchToAllApps().switchToWorkspace());
        assertTrue("Launcher internal state is not Workspace",
                isInState(() -> LauncherState.NORMAL));
    }

    @Test
    @PortraitLandscape
    public void testAllAppsDeadzoneForTablet() throws Exception {
+1 −1
Original line number Diff line number Diff line
@@ -244,7 +244,7 @@ public abstract class AllApps extends LauncherInstrumentation.VisibleContainer {
        return mLauncher.waitForObjectInContainer(allAppsContainer, "apps_list_view");
    }

    private UiObject2 getSearchBox(UiObject2 allAppsContainer) {
    protected UiObject2 getSearchBox(UiObject2 allAppsContainer) {
        return mLauncher.waitForObjectInContainer(allAppsContainer, "search_container_all_apps");
    }

+42 −0
Original line number Diff line number Diff line
@@ -15,11 +15,17 @@
 */
package com.android.launcher3.tapl;

import static com.android.launcher3.testing.shared.TestProtocol.NORMAL_STATE_ORDINAL;

import android.graphics.Rect;

import androidx.annotation.NonNull;
import androidx.test.uiautomator.UiObject2;

import com.android.launcher3.testing.shared.TestProtocol;

import java.util.Objects;

public class HomeAllApps extends AllApps {
    private static final String BOTTOM_SHEET_RES_ID = "bottom_sheet_background";

@@ -27,6 +33,42 @@ public class HomeAllApps extends AllApps {
        super(launcher);
    }

    /**
     * Swipes down to Workspace.
     *
     * @return the Workspace object.
     */
    @NonNull
    public Workspace switchToWorkspace() {
        try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck();
             LauncherInstrumentation.Closable c =
                     mLauncher.addContextLayer("want to switch from all apps to workspace")) {
            UiObject2 allAppsContainer = verifyActiveContainer();

            final Rect searchBoxBounds = Objects.requireNonNull(
                    mLauncher.getVisibleBounds(getSearchBox(allAppsContainer)));
            final int startX = searchBoxBounds.centerX();
            final int startY = searchBoxBounds.bottom;
            final int endY = mLauncher.getDevice().getDisplayHeight();
            LauncherInstrumentation.log(
                    "switchToWorkspace: startY = " + startY + ", endY = " + endY
                            + ", slop = " + mLauncher.getTouchSlop());

            mLauncher.swipeToState(
                    startX,
                    startY,
                    startX,
                    endY,
                    12 /* steps */,
                    NORMAL_STATE_ORDINAL, LauncherInstrumentation.GestureScope.INSIDE);

            try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
                    "swiped to workspace")) {
                return mLauncher.getWorkspace();
            }
        }
    }

    @Override
    protected LauncherInstrumentation.ContainerType getContainerType() {
        return LauncherInstrumentation.ContainerType.HOME_ALL_APPS;