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

Commit e74238d2 authored by Vadim Tryshev's avatar Vadim Tryshev Committed by Android (Google) Code Review
Browse files

Merge "Not waiting for animations for Launcher clicks" into tm-qpr-dev

parents c03bb43f befcfa40
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -45,7 +45,8 @@ public class AddToHomeScreenPrompt {
            mLauncher.clickObject(
                    mLauncher.waitForObjectInContainer(
                            mWidgetCell.getParent().getParent().getParent().getParent(),
                            By.text(ADD_AUTOMATICALLY)));
                            By.text(ADD_AUTOMATICALLY)),
                    LauncherInstrumentation.GestureScope.OUTSIDE_WITHOUT_PILFER);
            mLauncher.waitUntilLauncherObjectGone(getSelector());
        }
    }
+13 −10
Original line number Diff line number Diff line
@@ -1466,19 +1466,22 @@ public final class LauncherInstrumentation {
        return getRealDisplaySize().x - getWindowInsets().right - 1;
    }

    void clickObject(UiObject2 object) {
        waitForObjectEnabled(object, "clickObject");
        if (!isLauncher3() && getNavigationModel() != NavigationModel.THREE_BUTTON) {
            expectEvent(TestProtocol.SEQUENCE_TIS, LauncherInstrumentation.EVENT_TOUCH_DOWN_TIS);
            expectEvent(TestProtocol.SEQUENCE_TIS, LauncherInstrumentation.EVENT_TOUCH_UP_TIS);
        }
        object.click();
    /**
     * Click on the ui object right away without waiting for animation.
     *
     * [UiObject2.click] would wait for all animations finished before clicking. Not waiting for
     * animations because in some scenarios there is a playing animations when the click is
     * attempted.
     */
    void clickObject(UiObject2 uiObject, GestureScope gestureScope) {
        final long clickTime = SystemClock.uptimeMillis();
        final Point center = uiObject.getVisibleCenter();
        sendPointer(clickTime, clickTime, MotionEvent.ACTION_DOWN, center, gestureScope);
        sendPointer(clickTime, clickTime, MotionEvent.ACTION_UP, center, gestureScope);
    }

    void clickLauncherObject(UiObject2 object) {
        expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_TOUCH_DOWN);
        expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_TOUCH_UP);
        clickObject(object);
        clickObject(object, GestureScope.INSIDE);
    }

    void scrollToLastVisibleRow(
+1 −1
Original line number Diff line number Diff line
@@ -385,7 +385,7 @@ public final class Workspace extends Home {
                    Until.hasObject(installerAlert), LauncherInstrumentation.WAIT_TIME_MS));
            final UiObject2 ok = device.findObject(By.text("OK"));
            assertNotNull("OK button is not shown", ok);
            launcher.clickObject(ok);
            launcher.clickObject(ok, LauncherInstrumentation.GestureScope.OUTSIDE_WITHOUT_PILFER);
            assertTrue("Uninstall alert is not dismissed after clicking OK", device.wait(
                    Until.gone(installerAlert), LauncherInstrumentation.WAIT_TIME_MS));