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

Commit 13a423c3 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Expect state transition to overview while holding the swipe from home" into sc-v2-dev

parents 6168de06 58a11ac9
Loading
Loading
Loading
Loading
+30 −15
Original line number Diff line number Diff line
@@ -71,6 +71,10 @@ public class Background extends LauncherInstrumentation.VisibleContainer {
        return mLauncher.isTablet();
    }

    protected boolean zeroButtonToOverviewGestureStateTransitionWhileHolding() {
        return false;
    }

    protected void goToOverviewUnchecked() {
        switch (mLauncher.getNavigationModel()) {
            case ZERO_BUTTON: {
@@ -90,21 +94,32 @@ public class Background extends LauncherInstrumentation.VisibleContainer {

                mLauncher.sendPointer(
                        downTime, downTime, MotionEvent.ACTION_DOWN, start, gestureScope);
                mLauncher.executeAndWaitForLauncherEvent(
                        () -> mLauncher.movePointer(
                Runnable swipeAndHold = () -> mLauncher.movePointer(
                        downTime,
                        downTime,
                        ZERO_BUTTON_SWIPE_UP_GESTURE_DURATION,
                        start,
                        end,
                                gestureScope),
                        event -> TestProtocol.PAUSE_DETECTED_MESSAGE.equals(event.getClassName()),
                        () -> "Pause wasn't detected", "swiping and holding");
                mLauncher.runToState(
                        () -> mLauncher.sendPointer(
                        gestureScope);
                String swipeAndHoldAction = "swiping and holding";
                Runnable up = () -> mLauncher.sendPointer(
                        downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, end,
                                gestureScope),
                        OVERVIEW_STATE_ORDINAL, "sending UP event");
                        gestureScope);
                String upAction = "sending UP event";
                if (zeroButtonToOverviewGestureStateTransitionWhileHolding()) {
                    mLauncher.runToState(swipeAndHold, OVERVIEW_STATE_ORDINAL, swipeAndHoldAction);
                    try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(upAction)) {
                        up.run();
                    }
                } else {
                    mLauncher.executeAndWaitForLauncherEvent(
                            swipeAndHold,
                            event -> TestProtocol.PAUSE_DETECTED_MESSAGE.equals(
                                    event.getClassName()),
                            () -> "Pause wasn't detected",
                            swipeAndHoldAction);
                    mLauncher.runToState(up, OVERVIEW_STATE_ORDINAL, upAction);
                }
                break;
            }

+4 −0
Original line number Diff line number Diff line
@@ -63,4 +63,8 @@ public abstract class Home extends Background {
        return true;
    }

    @Override
    protected boolean zeroButtonToOverviewGestureStateTransitionWhileHolding() {
        return true;
    }
}
 No newline at end of file