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

Commit ffd82808 authored by Longbo Wei's avatar Longbo Wei
Browse files

autoclick: Exit scroll mode when pausing autoclick

When autoclick is paused, we should exit Scroll Mode and hide the scroll
panel—same behavior as ChromeOS Classic

Bug: b/421228980
Test: atest
Flag: com.android.server.accessibility.enable_autoclick_indicator
Change-Id: I8a014107ce6401ceb5e69c3c094e4ca92ec06474
parent 93fd7e40
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -187,6 +187,9 @@ public class AutoclickController extends BaseEventStreamTransformation {
                public void toggleAutoclickPause(boolean paused) {
                    if (paused) {
                        cancelPendingClick();
                        if (mActiveClickType == AUTOCLICK_TYPE_SCROLL) {
                            exitScrollMode();
                        }
                    }
                }

+21 −0
Original line number Diff line number Diff line
@@ -645,6 +645,27 @@ public class AutoclickControllerTest {
        assertThat(mController.mClickScheduler.getScheduledClickTimeForTesting()).isEqualTo(-1);
    }

    @Test
    @EnableFlags(com.android.server.accessibility.Flags.FLAG_ENABLE_AUTOCLICK_INDICATOR)
    public void toggleAutoclickPause_inScrollMode_exitsScrollMode() {
        // Initialize the controller.
        injectFakeMouseActionHoverMoveEvent();

        // Set the active click type to scroll.
        mController.clickPanelController.handleAutoclickTypeChange(
                AutoclickTypePanel.AUTOCLICK_TYPE_SCROLL);
        mController.mAutoclickScrollPanel.show();

        // Verify it's visible before pause.
        assertThat(mController.mAutoclickScrollPanel.isVisible()).isTrue();

        // Pause autoclick.
        mController.clickPanelController.toggleAutoclickPause(true);

        // Verify scroll panel is now hidden.
        assertThat(mController.mAutoclickScrollPanel.isVisible()).isFalse();
    }

    @Test
    @EnableFlags(com.android.server.accessibility.Flags.FLAG_ENABLE_AUTOCLICK_INDICATOR)
    public void onMotionEvent_flagOn_lazyInitAutoclickScrollPanel() {