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

Commit 90fd5c0e authored by “Longbo's avatar “Longbo Committed by Longbo Wei
Browse files

a11y: Clicking exit to exit scroll mode

Bug: b/409308265
Test: AutoclickScrollPanelTest
Flag: com.android.server.accessibility.enable_autoclick_indicator
Change-Id: Ib389a138487239428402f313c1c4acda1023a1c2
parent 9523b841
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -132,6 +132,9 @@ public class AutoclickScrollPanel {
        setupHoverListenerForButton(mRightButton, DIRECTION_RIGHT);
        setupHoverListenerForButton(mDownButton, DIRECTION_DOWN);
        setupHoverListenerForButton(mExitButton, DIRECTION_EXIT);

       // Add click listener for exit button.
        mExitButton.setOnClickListener(v -> hide());
    }

    /**
+15 −0
Original line number Diff line number Diff line
@@ -335,6 +335,21 @@ public class AutoclickScrollPanelTest {
        assertThat(params.y).isLessThan(cursorY);
    }

    @Test
    public void exitButton_click_hidesPanel() {
        float cursorX = 300;
        float cursorY = 300;

        mScrollPanel.show(cursorX, cursorY);
        assertThat(mScrollPanel.isVisible()).isTrue();

        // Simulate clicking the exit button.
        mExitButton.performClick();

        // Verify the panel is hidden.
        assertThat(mScrollPanel.isVisible()).isFalse();
    }

    // Helper method to simulate a hover event on a view.
    private void triggerHoverEvent(View view, int action) {
        MotionEvent event = MotionEvent.obtain(