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

Commit 689f9392 authored by Yuhan Yang's avatar Yuhan Yang
Browse files

Update AUTOCLICK_DELAY_DEFAULT value to be 1 second

Bug: 390460859
Test: atest AutoclickControllerTest
Flag: com.android.server.accessibility.enable_autoclick_indicator
Change-Id: Ic410a15436b645328805612ecc127ceace36a04d
parent 584dcda0
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -145,9 +145,14 @@ public final class AccessibilityManager {
    /** @hide */
    public static final int DALTONIZER_CORRECT_DEUTERANOMALY = 12;

    // TODO(b/407054269): Clean up usages of AUTOCLICK_DELAY_DEFAULT after
    // enable_autoclick_indicator is released.
    /** @hide */
    public static final int AUTOCLICK_DELAY_DEFAULT = 600;

    /** @hide */
    public static final int AUTOCLICK_DELAY_WITH_INDICATOR_DEFAULT = 1000;

    /** @hide */
    public static final int AUTOCLICK_CURSOR_AREA_SIZE_DEFAULT = 60;

+6 −2
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.view.MotionEvent.BUTTON_PRIMARY;
import static android.view.MotionEvent.BUTTON_SECONDARY;
import static android.view.accessibility.AccessibilityManager.AUTOCLICK_CURSOR_AREA_SIZE_DEFAULT;
import static android.view.accessibility.AccessibilityManager.AUTOCLICK_DELAY_DEFAULT;
import static android.view.accessibility.AccessibilityManager.AUTOCLICK_DELAY_WITH_INDICATOR_DEFAULT;
import static android.view.accessibility.AccessibilityManager.AUTOCLICK_IGNORE_MINOR_CURSOR_MOVEMENT_DEFAULT;
import static android.view.accessibility.AccessibilityManager.AUTOCLICK_REVERT_TO_LEFT_CLICK_DEFAULT;

@@ -86,6 +87,9 @@ public class AutoclickController extends BaseEventStreamTransformation {
    // TODO(b/393559560): Finalize scroll amount.
    private static final float SCROLL_AMOUNT = 1.0f;

    private static final int DEFAULT_AUTOCLICK_DELAY_TIME = Flags.enableAutoclickIndicator()
            ? AUTOCLICK_DELAY_WITH_INDICATOR_DEFAULT : AUTOCLICK_DELAY_DEFAULT;

    private final AccessibilityTraceManager mTrace;
    private final Context mContext;
    private final int mUserId;
@@ -204,7 +208,7 @@ public class AutoclickController extends BaseEventStreamTransformation {
                }

                mClickScheduler = new ClickScheduler(
                            handler, AUTOCLICK_DELAY_DEFAULT);
                            handler, DEFAULT_AUTOCLICK_DELAY_TIME);
                mAutoclickSettingsObserver = new AutoclickSettingsObserver(mUserId, handler);
                mAutoclickSettingsObserver.start(
                        mContext.getContentResolver(),
@@ -528,7 +532,7 @@ public class AutoclickController extends BaseEventStreamTransformation {
                        Settings.Secure.getIntForUser(
                                mContentResolver,
                                Settings.Secure.ACCESSIBILITY_AUTOCLICK_DELAY,
                                AUTOCLICK_DELAY_DEFAULT,
                                DEFAULT_AUTOCLICK_DELAY_TIME,
                                mUserId);
                mClickScheduler.updateDelay(delay);
            }
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ public class AutoclickIndicatorView extends View {
    // Current sweep angle of the animated ring.
    private float mSweepAngle;

    private int mAnimationDuration = AccessibilityManager.AUTOCLICK_DELAY_DEFAULT;
    private int mAnimationDuration = AccessibilityManager.AUTOCLICK_DELAY_WITH_INDICATOR_DEFAULT;

    // Status of whether the visual indicator should display or not.
    private boolean showIndicator = false;
+2 −1
Original line number Diff line number Diff line
@@ -261,6 +261,7 @@ public class AutoclickControllerTest {
    }

    @Test
    @EnableFlags(com.android.server.accessibility.Flags.FLAG_ENABLE_AUTOCLICK_INDICATOR)
    public void onMotionEvent_initClickSchedulerDelayFromSetting() {
        injectFakeMouseActionHoverMoveEvent();

@@ -268,7 +269,7 @@ public class AutoclickControllerTest {
                Settings.Secure.getIntForUser(
                        mTestableContext.getContentResolver(),
                        Settings.Secure.ACCESSIBILITY_AUTOCLICK_DELAY,
                        AccessibilityManager.AUTOCLICK_DELAY_DEFAULT,
                        AccessibilityManager.AUTOCLICK_DELAY_WITH_INDICATOR_DEFAULT,
                        mTestableContext.getUserId());
        assertThat(mController.mClickScheduler.getDelayForTesting()).isEqualTo(delay);
    }