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

Commit 6aae325a authored by Yuhan Yang's avatar Yuhan Yang Committed by Android (Google) Code Review
Browse files

Merge "Update AUTOCLICK_DELAY_DEFAULT value to be 1 second" into main

parents 5baff06b 689f9392
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -145,9 +145,14 @@ public final class AccessibilityManager {
    /** @hide */
    /** @hide */
    public static final int DALTONIZER_CORRECT_DEUTERANOMALY = 12;
    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 */
    /** @hide */
    public static final int AUTOCLICK_DELAY_DEFAULT = 600;
    public static final int AUTOCLICK_DELAY_DEFAULT = 600;


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

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


+6 −2
Original line number Original line 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.MotionEvent.BUTTON_SECONDARY;
import static android.view.accessibility.AccessibilityManager.AUTOCLICK_CURSOR_AREA_SIZE_DEFAULT;
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_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_IGNORE_MINOR_CURSOR_MOVEMENT_DEFAULT;
import static android.view.accessibility.AccessibilityManager.AUTOCLICK_REVERT_TO_LEFT_CLICK_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.
    // TODO(b/393559560): Finalize scroll amount.
    private static final float SCROLL_AMOUNT = 1.0f;
    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 AccessibilityTraceManager mTrace;
    private final Context mContext;
    private final Context mContext;
    private final int mUserId;
    private final int mUserId;
@@ -204,7 +208,7 @@ public class AutoclickController extends BaseEventStreamTransformation {
                }
                }


                mClickScheduler = new ClickScheduler(
                mClickScheduler = new ClickScheduler(
                            handler, AUTOCLICK_DELAY_DEFAULT);
                            handler, DEFAULT_AUTOCLICK_DELAY_TIME);
                mAutoclickSettingsObserver = new AutoclickSettingsObserver(mUserId, handler);
                mAutoclickSettingsObserver = new AutoclickSettingsObserver(mUserId, handler);
                mAutoclickSettingsObserver.start(
                mAutoclickSettingsObserver.start(
                        mContext.getContentResolver(),
                        mContext.getContentResolver(),
@@ -528,7 +532,7 @@ public class AutoclickController extends BaseEventStreamTransformation {
                        Settings.Secure.getIntForUser(
                        Settings.Secure.getIntForUser(
                                mContentResolver,
                                mContentResolver,
                                Settings.Secure.ACCESSIBILITY_AUTOCLICK_DELAY,
                                Settings.Secure.ACCESSIBILITY_AUTOCLICK_DELAY,
                                AUTOCLICK_DELAY_DEFAULT,
                                DEFAULT_AUTOCLICK_DELAY_TIME,
                                mUserId);
                                mUserId);
                mClickScheduler.updateDelay(delay);
                mClickScheduler.updateDelay(delay);
            }
            }
+1 −1
Original line number Original line Diff line number Diff line
@@ -60,7 +60,7 @@ public class AutoclickIndicatorView extends View {
    // Current sweep angle of the animated ring.
    // Current sweep angle of the animated ring.
    private float mSweepAngle;
    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.
    // Status of whether the visual indicator should display or not.
    private boolean showIndicator = false;
    private boolean showIndicator = false;
+2 −1
Original line number Original line Diff line number Diff line
@@ -261,6 +261,7 @@ public class AutoclickControllerTest {
    }
    }


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


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