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

Commit 0dfe56cf authored by Alex Chau's avatar Alex Chau
Browse files

Increase motion pause timeout for tests

- In cuttlefish occasionally MOTION_MOVE and MOTION_UP takes more than 300ms due to lag, increasing the motion pause timeout to avoid getting false signals in tests

Bug: 194114179
Test: atest NexusLauncherOutOfProcTests:com.android.launcher3.memory.MemoryTests#testAppLaunchFromWorkspace
Change-Id: I0a33f34b5bf96f4f7ae56020c5a27f4ef9a0ff64
parent a67358bc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ public class DebugTestInformationHandler extends TestInformationHandler {
    }

    @Override
    public Bundle call(String method) {
    public Bundle call(String method, String arg) {
        final Bundle response = new Bundle();
        switch (method) {
            case TestProtocol.REQUEST_APP_LIST_FREEZE_FLAGS: {
@@ -161,7 +161,7 @@ public class DebugTestInformationHandler extends TestInformationHandler {
            }

            default:
                return super.call(method);
                return super.call(method, arg);
        }
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ public class QuickstepTestInformationHandler extends TestInformationHandler {
    }

    @Override
    public Bundle call(String method) {
    public Bundle call(String method, String arg) {
        final Bundle response = new Bundle();
        switch (method) {
            case TestProtocol.REQUEST_ALL_APPS_TO_OVERVIEW_SWIPE_HEIGHT: {
@@ -66,7 +66,7 @@ public class QuickstepTestInformationHandler extends TestInformationHandler {
            }
        }

        return super.call(method);
        return super.call(method, arg);
    }

    @Override
+4 −3
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.view.VelocityTracker;
import com.android.launcher3.Alarm;
import com.android.launcher3.R;
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.testing.TestProtocol;

/**
 * Given positions along x- or y-axis, tracks velocity and acceleration and determines when there is
@@ -118,9 +119,9 @@ public class MotionPauseDetector {
     * @param pointerIndex Index for the pointer being tracked in the motion event
     */
    public void addPosition(MotionEvent ev, int pointerIndex) {
        mForcePauseTimeout.setAlarm(mMakePauseHarderToTrigger
                ? HARDER_TRIGGER_TIMEOUT
                : FORCE_PAUSE_TIMEOUT);
        mForcePauseTimeout.setAlarm(TestProtocol.sForcePauseTimeout != null
                ? TestProtocol.sForcePauseTimeout
                : mMakePauseHarderToTrigger ? HARDER_TRIGGER_TIMEOUT : FORCE_PAUSE_TIMEOUT);
        float newVelocity = mVelocityProvider.addMotionEvent(ev, ev.getPointerId(pointerIndex));
        if (mPreviousVelocity != null) {
            checkMotionPaused(newVelocity, mPreviousVelocity, ev.getEventTime());
+8 −0
Original line number Diff line number Diff line
@@ -62,6 +62,10 @@ public class TestInformationHandler implements ResourceBasedOverride {
    }

    public Bundle call(String method) {
        return call(method, /*arg=*/ null);
    }

    public Bundle call(String method, String arg) {
        final Bundle response = new Bundle();
        switch (method) {
            case TestProtocol.REQUEST_HOME_TO_ALL_APPS_SWIPE_HEIGHT: {
@@ -129,6 +133,10 @@ public class TestInformationHandler implements ResourceBasedOverride {
                    mDeviceProfile.isTwoPanels);
                return response;

            case TestProtocol.REQUEST_SET_FORCE_PAUSE_TIMEOUT:
                TestProtocol.sForcePauseTimeout = Long.parseLong(arg);
                return response;

            default:
                return null;
        }
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ public class TestInformationProvider extends ContentProvider {
        if (Utilities.IS_RUNNING_IN_TEST_HARNESS) {
            TestInformationHandler handler = TestInformationHandler.newInstance(getContext());
            handler.init(getContext());
            return handler.call(method);
            return handler.call(method, arg);
        }
        return null;
    }
Loading