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

Commit 54c1920e authored by Amanda Lin Dietz's avatar Amanda Lin Dietz Committed by Biswarup Pal
Browse files

[Blinking Text Cursor Setting] Update ViewConfiguration API to instance

This updates the implementation of
ViewConfiguration#getTextCursorBlinkIntervalMillis to read the setting
using the device id when possible.

Flag: android.view.accessibility.text_cursor_blink_interval
Bug: 402134144
Bug: 385781377
Bug: 420978789
Test: Manually tested locally.

Change-Id: Iebbd398e31c534fe0ea637be352f6a2272756b3b
parent 926b83c0
Loading
Loading
Loading
Loading
+16 −6
Original line number Diff line number Diff line
@@ -424,6 +424,8 @@ public class ViewConfiguration {
    private final int mMultiPressTimeoutMillis;
    private final float mScrollFriction;

    private int mDeviceId = Context.DEVICE_ID_INVALID;

    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 123768915)
    private boolean sHasPermanentMenuKey;
    @UnsupportedAppUsage
@@ -626,11 +628,11 @@ public class ViewConfiguration {
        mDoubleTapMinTimeMillis = res.getInteger(R.integer.config_doubleTapMinTimeMillis);
        mScrollFriction = res.getFloat(R.dimen.config_scrollFriction);

        int deviceId = context.getDeviceId();
        mDeviceId = context.getDeviceId();
        mLongPressTimeoutMillis = AppGlobals.getIntCoreSetting(Settings.Secure.LONG_PRESS_TIMEOUT,
                DEFAULT_LONG_PRESS_TIMEOUT, deviceId);
                DEFAULT_LONG_PRESS_TIMEOUT, mDeviceId);
        mMultiPressTimeoutMillis = AppGlobals.getIntCoreSetting(Settings.Secure.MULTI_PRESS_TIMEOUT,
                DEFAULT_MULTI_PRESS_TIMEOUT, deviceId);
                DEFAULT_MULTI_PRESS_TIMEOUT, mDeviceId);
    }

    /**
@@ -814,9 +816,17 @@ public class ViewConfiguration {
     */
    @FlaggedApi(android.view.accessibility.Flags.FLAG_TEXT_CURSOR_BLINK_INTERVAL)
    public int getTextCursorBlinkIntervalMillis() {
        int value = AppGlobals.getIntCoreSetting(
        int value;
        if (mDeviceId != Context.DEVICE_ID_INVALID) {
            value = AppGlobals.getIntCoreSetting(
                    Settings.Secure.ACCESSIBILITY_TEXT_CURSOR_BLINK_INTERVAL_MS,
                    sResourceCache.getDefaultTextCursorBlinkInterval(),
                    mDeviceId);
        } else {
            value = AppGlobals.getIntCoreSetting(
                    Settings.Secure.ACCESSIBILITY_TEXT_CURSOR_BLINK_INTERVAL_MS,
                    sResourceCache.getDefaultTextCursorBlinkInterval());
        }

        int noBlink = sResourceCache.getNoBlinkTextCursorBlinkInterval();
        int minBlink = sResourceCache.getMinTextCursorBlinkInterval();