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

Commit 1d68267d authored by “Longbo's avatar “Longbo Committed by Longbo Wei
Browse files

autoclick: Log the state of autoclick settings

Log the autoclick settings state when autoclick is turned off, as this
precisely reflects the user’s configuration.

Video: http://shortn/_aMrq4wkKl9

Bug: b/409768370
Test: AutoclickControllerTest
Flag: com.android.server.accessibility.enable_autoclick_indicator
Change-Id: I6c40a94e3766bfac6a1f77f7181b58caf209a7db
parent 83e02f0c
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -110,6 +110,7 @@ public class AutoclickController extends BaseEventStreamTransformation {

    private final AccessibilityTraceManager mTrace;
    private final Context mContext;
    private int mCursorAreaSize;
    private final int mUserId;

    // The position where scroll actually happens.
@@ -343,6 +344,12 @@ public class AutoclickController extends BaseEventStreamTransformation {
            mAutoclickSettingsObserver = null;
        }
        if (mClickScheduler != null) {
            // Log the current autoclick settings state (delay, cursor size etc.)
            AutoclickLogger.logAutoclickSettingsState(
                    mClickScheduler.mDelay,
                    mCursorAreaSize,
                    mClickScheduler.mIgnoreMinorCursorMovement,
                    mClickScheduler.mRevertToLeftClick);
            mClickScheduler.cancel();
            mClickScheduler = null;
        }
@@ -777,7 +784,8 @@ public class AutoclickController extends BaseEventStreamTransformation {

        // Cursor area size corresponds to the ring indicator radius size.
        public void updateCursorAreaSize(int size) {
            mAutoclickIndicatorView.setRadius(size);
            mCursorAreaSize = size;
            mAutoclickIndicatorView.setRadius(mCursorAreaSize);
        }
    }

+22 −0
Original line number Diff line number Diff line
@@ -62,4 +62,26 @@ public class AutoclickLogger {
        FrameworkStatsLog.write(FrameworkStatsLog.AUTOCLICK_SESSION_DURATION_REPORTED,
                sessionDurationSeconds);
    }

    /**
     * Logs the state of autoclick settings.
     *
     * @param delayBeforeClickMs        Delay in milliseconds before autoclick triggers.
     * @param cursorAreaSize            Size  for the autoclick cursor indicator.
     * @param ignoreMinorCursorMovement Whether to ignore small cursor movements.
     * @param revertToLeftClick         Whether to revert to left click after performing autoclick.
     */
    public static void logAutoclickSettingsState(
            long delayBeforeClickMs,
            int cursorAreaSize,
            boolean ignoreMinorCursorMovement,
            boolean revertToLeftClick) {

        FrameworkStatsLog.write(
                FrameworkStatsLog.AUTOCLICK_SETTINGS_STATE_REPORTED,
                delayBeforeClickMs,
                cursorAreaSize,
                ignoreMinorCursorMovement,
                revertToLeftClick);
    }
}