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

Commit 1ac72db9 authored by vadimt's avatar vadimt
Browse files

Removing 2-button support from tests

Bug: 187761685
Test: presubmit
Change-Id: I932dd8cbc7524732e3ff83a35d7034b3e5ff75d9
parent 7b597375
Loading
Loading
Loading
Loading
+2 −16
Original line number Diff line number Diff line
@@ -20,9 +20,7 @@ import static androidx.test.InstrumentationRegistry.getInstrumentation;

import static com.android.quickstep.NavigationModeSwitchRule.Mode.ALL;
import static com.android.quickstep.NavigationModeSwitchRule.Mode.THREE_BUTTON;
import static com.android.quickstep.NavigationModeSwitchRule.Mode.TWO_BUTTON;
import static com.android.quickstep.NavigationModeSwitchRule.Mode.ZERO_BUTTON;
import static com.android.systemui.shared.system.QuickStepContract.NAV_BAR_MODE_2BUTTON_OVERLAY;
import static com.android.systemui.shared.system.QuickStepContract.NAV_BAR_MODE_3BUTTON_OVERLAY;
import static com.android.systemui.shared.system.QuickStepContract.NAV_BAR_MODE_GESTURAL_OVERLAY;

@@ -61,7 +59,7 @@ public class NavigationModeSwitchRule implements TestRule {
    public static final int WAIT_TIME_MS = 10000;

    public enum Mode {
        THREE_BUTTON, TWO_BUTTON, ZERO_BUTTON, ALL
        THREE_BUTTON, ZERO_BUTTON, ALL
    }

    // Annotation for tests that need to be run with quickstep enabled and disabled.
@@ -99,9 +97,6 @@ public class NavigationModeSwitchRule implements TestRule {
                        if (mode == ZERO_BUTTON || mode == ALL) {
                            evaluateWithZeroButtons();
                        }
                        if (mode == TWO_BUTTON || mode == ALL) {
                            evaluateWithTwoButtons();
                        }
                        if (mode == THREE_BUTTON || mode == ALL) {
                            evaluateWithThreeButtons();
                        }
@@ -123,13 +118,6 @@ public class NavigationModeSwitchRule implements TestRule {
                    }
                }

                private void evaluateWithTwoButtons() throws Throwable {
                    if (setActiveOverlay(mLauncher, NAV_BAR_MODE_2BUTTON_OVERLAY,
                            LauncherInstrumentation.NavigationModel.TWO_BUTTON, description)) {
                        base.evaluate();
                    }
                }

                private void evaluateWithZeroButtons() throws Throwable {
                    if (setActiveOverlay(mLauncher, NAV_BAR_MODE_GESTURAL_OVERLAY,
                            LauncherInstrumentation.NavigationModel.ZERO_BUTTON, description)) {
@@ -145,8 +133,6 @@ public class NavigationModeSwitchRule implements TestRule {
    public static String getCurrentOverlayPackage(int currentInteractionMode) {
        return QuickStepContract.isGesturalMode(currentInteractionMode)
                ? NAV_BAR_MODE_GESTURAL_OVERLAY
                : QuickStepContract.isSwipeUpMode(currentInteractionMode)
                        ? NAV_BAR_MODE_2BUTTON_OVERLAY
                : NAV_BAR_MODE_3BUTTON_OVERLAY;
    }

+0 −22
Original line number Diff line number Diff line
@@ -16,23 +16,16 @@

package com.android.quickstep;

import static com.android.launcher3.util.RaceConditionReproducer.enterEvt;
import static com.android.launcher3.util.RaceConditionReproducer.exitEvt;

import android.content.Intent;

import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;

import com.android.launcher3.Launcher;
import com.android.launcher3.ui.TaplTestsLauncher3;
import com.android.launcher3.util.RaceConditionReproducer;
import com.android.quickstep.NavigationModeSwitchRule.Mode;
import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch;
import com.android.quickstep.inputconsumers.OtherActivityInputConsumer;

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

@@ -65,21 +58,6 @@ public class StartLauncherViaGestureTests extends AbstractQuickStepTest {
        eventProcessor.finishIteration();
    }

    @Test
    @Ignore // Ignoring until race condition repro framework is changes for multi-process case.
    @NavigationModeSwitch(mode = Mode.TWO_BUTTON)
    public void testPressHome() {
        runTest(enterEvt(Launcher.ON_CREATE_EVT),
                exitEvt(Launcher.ON_CREATE_EVT),
                enterEvt(OtherActivityInputConsumer.DOWN_EVT),
                exitEvt(OtherActivityInputConsumer.DOWN_EVT));

        runTest(enterEvt(OtherActivityInputConsumer.DOWN_EVT),
                exitEvt(OtherActivityInputConsumer.DOWN_EVT),
                enterEvt(Launcher.ON_CREATE_EVT),
                exitEvt(Launcher.ON_CREATE_EVT));
    }

    @Test
    @NavigationModeSwitch
    public void testStressPressHome() {
+10 −55
Original line number Diff line number Diff line
@@ -134,31 +134,6 @@ public class Background extends LauncherInstrumentation.VisibleContainer {
                break;
            }

            case TWO_BUTTON: {
                final int startX;
                final int startY;
                final int endX;
                final int endY;
                final int swipeLength = mLauncher.getTestInfo(getSwipeHeightRequestName()).
                        getInt(TestProtocol.TEST_INFO_RESPONSE_FIELD) + mLauncher.getTouchSlop();

                if (mLauncher.getDevice().isNaturalOrientation()) {
                    startX = endX = mLauncher.getDevice().getDisplayWidth() / 2;
                    startY = getSwipeStartY();
                    endY = startY - swipeLength;
                } else {
                    startX = getSwipeStartX();
                    // TODO(b/184059820) make horizontal swipe use swipe width not height, for the
                    // moment just double the swipe length.
                    endX = startX - swipeLength * 2;
                    startY = endY = mLauncher.getDevice().getDisplayHeight() / 2;
                }

                mLauncher.swipeToState(startX, startY, endX, endY, 10, OVERVIEW_STATE_ORDINAL,
                        LauncherInstrumentation.GestureScope.OUTSIDE_WITH_PILFER);
                break;
            }

            case THREE_BUTTON:
                if (mLauncher.isTablet()) {
                    mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN,
@@ -253,11 +228,7 @@ public class Background extends LauncherInstrumentation.VisibleContainer {
                     "want to quick switch to the previous app")) {
            verifyActiveContainer();
            final boolean launcherWasVisible = mLauncher.isLauncherVisible();
            boolean transposeInLandscape = false;
            switch (mLauncher.getNavigationModel()) {
                case TWO_BUTTON:
                    transposeInLandscape = true;
                    // Fall through, zero button and two button modes behave the same.
                case ZERO_BUTTON: {
                    final int startX;
                    final int startY;
@@ -265,33 +236,17 @@ public class Background extends LauncherInstrumentation.VisibleContainer {
                    final int endY;
                    final int cornerRadius = (int) Math.ceil(mLauncher.getWindowCornerRadius());
                    if (toRight) {
                        if (mLauncher.getDevice().isNaturalOrientation() || !transposeInLandscape) {
                        // Swipe from the bottom left to the bottom right of the screen.
                        startX = cornerRadius;
                        startY = getSwipeStartY();
                        endX = mLauncher.getDevice().getDisplayWidth() - cornerRadius;
                        endY = startY;
                    } else {
                            // Swipe from the bottom right to the top right of the screen.
                            startX = getSwipeStartX();
                            startY = mLauncher.getRealDisplaySize().y - 1 - cornerRadius;
                            endX = startX;
                            endY = cornerRadius;
                        }
                    } else {
                        if (mLauncher.getDevice().isNaturalOrientation() || !transposeInLandscape) {
                        // Swipe from the bottom right to the bottom left of the screen.
                        startX = mLauncher.getDevice().getDisplayWidth() - cornerRadius;
                        startY = getSwipeStartY();
                        endX = cornerRadius;
                        endY = startY;
                        } else {
                            // Swipe from the bottom left to the top left of the screen.
                            startX = getSwipeStartX();
                            startY = cornerRadius;
                            endX = startX;
                            endY = mLauncher.getRealDisplaySize().y - 1 - cornerRadius;
                        }
                    }

                    final boolean isZeroButton = mLauncher.getNavigationModel()
+1 −10
Original line number Diff line number Diff line
@@ -124,7 +124,7 @@ public final class LauncherInstrumentation {
        WORKSPACE, ALL_APPS, OVERVIEW, WIDGETS, BACKGROUND, FALLBACK_OVERVIEW
    }

    public enum NavigationModel {ZERO_BUTTON, TWO_BUTTON, THREE_BUTTON}
    public enum NavigationModel {ZERO_BUTTON, THREE_BUTTON}

    // Where the gesture happens: outside of Launcher, inside or from inside to outside and
    // whether the gesture recognition triggers pilfer.
@@ -391,8 +391,6 @@ public final class LauncherInstrumentation {
    public static NavigationModel getNavigationModel(int currentInteractionMode) {
        if (QuickStepContract.isGesturalMode(currentInteractionMode)) {
            return NavigationModel.ZERO_BUTTON;
        } else if (QuickStepContract.isSwipeUpMode(currentInteractionMode)) {
            return NavigationModel.TWO_BUTTON;
        } else if (QuickStepContract.isLegacyMode(currentInteractionMode)) {
            return NavigationModel.THREE_BUTTON;
        }
@@ -873,10 +871,6 @@ public final class LauncherInstrumentation {
                log("Hierarchy before clicking home:");
                dumpViewHierarchy();
                action = "clicking home button";
                if (!isLauncher3() && getNavigationModel() == NavigationModel.TWO_BUTTON) {
                    expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_DOWN_TIS);
                    expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_UP_TIS);
                }
                if (isTablet()) {
                    expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_TOUCH_DOWN);
                    expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_TOUCH_UP);
@@ -917,9 +911,6 @@ public final class LauncherInstrumentation {
                if (isTablet()) {
                    expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_TOUCH_DOWN);
                    expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_TOUCH_UP);
                } else if (!isLauncher3() && getNavigationModel() == NavigationModel.TWO_BUTTON) {
                    expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_DOWN_TIS);
                    expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_UP_TIS);
                }
            }
            if (launcherVisible) {