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

Commit c3c0664a authored by Brian Isganitis's avatar Brian Isganitis
Browse files

Add AllApps TAPL APIs for toggling with meta key.

Test: TAPL
Bug: 300147433
Flag: No
Change-Id: Ie4d91ac77a325febb521806a008f8fcad5869f85
parent be6956c9
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -161,6 +161,10 @@ public class QuickstepTestInformationHandler extends TestInformationHandler {
                response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD,
                        SystemUiProxy.INSTANCE.get(mContext).isDragAndDropReady());
                return response;

            case TestProtocol.REQUEST_REFRESH_OVERVIEW_TARGET:
                runOnTISBinder(TouchInteractionService.TISBinder::refreshOverviewTarget);
                return response;
        }

        return super.call(method, arg, extras);
+10 −6
Original line number Diff line number Diff line
@@ -409,18 +409,16 @@ public class TouchInteractionService extends Service {
         * Sets a proxy to bypass swipe up behavior
         */
        public void setSwipeUpProxy(Function<GestureState, AnimatedFloat> proxy) {
            TouchInteractionService tis = mTis.get();
            if (tis == null) return;
            tis.mSwipeUpProxyProvider = proxy != null ? proxy : (i -> null);
            executeForTouchInteractionService(
                    tis -> tis.mSwipeUpProxyProvider = proxy != null ? proxy : (i -> null));
        }

        /**
         * Sets the task id where gestures should be blocked
         */
        public void setGestureBlockedTaskId(int taskId) {
            TouchInteractionService tis = mTis.get();
            if (tis == null) return;
            tis.mDeviceState.setGestureBlockingTaskId(taskId);
            executeForTouchInteractionService(
                    tis -> tis.mDeviceState.setGestureBlockingTaskId(taskId));
        }

        /** Sets a listener to be run on Overview Target updates. */
@@ -434,6 +432,12 @@ public class TouchInteractionService extends Service {
                mOnOverviewTargetChangeListener = null;
            }
        }

        /** Refreshes the current overview target. */
        public void refreshOverviewTarget() {
            executeForTouchInteractionService(tis -> tis.onOverviewTargetChange(
                    tis.mOverviewComponentObserver.isHomeAndOverviewSame()));
        }
    }

    private static boolean sConnected = false;
+1 −0
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@ public final class TestProtocol {
            "taskbar-all-apps-top-padding";
    public static final String REQUEST_ALL_APPS_TOP_PADDING = "all-apps-top-padding";
    public static final String REQUEST_ALL_APPS_BOTTOM_PADDING = "all-apps-bottom-padding";
    public static final String REQUEST_REFRESH_OVERVIEW_TARGET = "refresh-overview-target";

    public static final String REQUEST_WORKSPACE_CELL_LAYOUT_SIZE = "workspace-cell-layout-size";
    public static final String REQUEST_WORKSPACE_CELL_CENTER = "workspace-cell-center";
+13 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.launcher3.tapl;

import static android.view.KeyEvent.KEYCODE_META_RIGHT;

import static com.android.launcher3.tapl.LauncherInstrumentation.DEFAULT_POLL_INTERVAL;
import static com.android.launcher3.tapl.LauncherInstrumentation.WAIT_TIME_MS;

@@ -359,6 +361,17 @@ public abstract class AllApps extends LauncherInstrumentation.VisibleContainer {
        }
    }

    /** Presses the meta keyboard shortcut to dismiss AllApps. */
    public void dismissByKeyboardShortcut() {
        try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck()) {
            mLauncher.getDevice().pressKeyCode(KEYCODE_META_RIGHT);
            try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
                    "pressed meta key")) {
                verifyVisibleContainerOnDismiss();
            }
        }
    }

    protected abstract void verifyVisibleContainerOnDismiss();

    /**
+16 −0
Original line number Diff line number Diff line
@@ -1313,6 +1313,16 @@ public final class LauncherInstrumentation {
        }
    }

    void waitForObjectFocused(UiObject2 object, String waitReason) {
        try {
            assertTrue("Timed out waiting for object to be focused for " + waitReason + " "
                            + object.getResourceName(),
                    object.wait(Until.focused(true), WAIT_TIME_MS));
        } catch (StaleObjectException e) {
            fail("The object disappeared from screen");
        }
    }

    @NonNull
    UiObject2 waitForObjectInContainer(UiObject2 container, BySelector selector) {
        return waitForObjectsInContainer(container, selector).get(0);
@@ -1977,6 +1987,12 @@ public final class LauncherInstrumentation {
        getTestInfo(TestProtocol.REQUEST_RECREATE_TASKBAR);
    }

    // TODO(b/270393900): Remove with ENABLE_ALL_APPS_SEARCH_IN_TASKBAR flag cleanup.
    /** Refreshes the known overview target in TIS. */
    public void refreshOverviewTarget() {
        getTestInfo(TestProtocol.REQUEST_REFRESH_OVERVIEW_TARGET);
    }

    public List<String> getHotseatIconNames() {
        return getTestInfo(TestProtocol.REQUEST_HOTSEAT_ICON_NAMES)
                .getStringArrayList(TestProtocol.TEST_INFO_RESPONSE_FIELD);
Loading