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

Unverified Commit 965dff3f authored by Ramii Ahmed's avatar Ramii Ahmed Committed by Michael Bestas
Browse files

Introduce high touch polling rate feature control

Change-Id: I82c96d696e65d7c9cb345d37b071905a5d2f48de
parent d0b9efa3
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -1182,6 +1182,12 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
                    Settings.Secure.ACCESSIBILITY_SOFT_KEYBOARD_MODE), false, this, userId);
            resolver.registerContentObserver(Settings.Secure.getUriFor(
                    STYLUS_HANDWRITING_ENABLED), false, this);
            if (mLineageHardware.isSupported(
                    LineageHardwareManager.FEATURE_HIGH_TOUCH_POLLING_RATE)) {
                resolver.registerContentObserver(LineageSettings.System.getUriFor(
                        LineageSettings.System.HIGH_TOUCH_POLLING_RATE_ENABLE),
                        false, this, userId);
            }
            if (mLineageHardware.isSupported(
                    LineageHardwareManager.FEATURE_HIGH_TOUCH_SENSITIVITY)) {
                resolver.registerContentObserver(LineageSettings.System.getUriFor(
@@ -1202,6 +1208,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
                    Settings.Secure.ACCESSIBILITY_SOFT_KEYBOARD_MODE);
            final Uri stylusHandwritingEnabledUri = Settings.Secure.getUriFor(
                    STYLUS_HANDWRITING_ENABLED);
            final Uri highTouchPollingRateUri = LineageSettings.System.getUriFor(
                    LineageSettings.System.HIGH_TOUCH_POLLING_RATE_ENABLE);
            final Uri touchSensitivityUri = LineageSettings.System.getUriFor(
                    LineageSettings.System.HIGH_TOUCH_SENSITIVITY_ENABLE);
            final Uri touchHoveringUri = LineageSettings.Secure.getUriFor(
@@ -1225,6 +1233,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
                    }
                } else if (stylusHandwritingEnabledUri.equals(uri)) {
                    InputMethodManager.invalidateLocalStylusHandwritingAvailabilityCaches();
                } else if (highTouchPollingRateUri.equals(uri)) {
                    updateTouchPollingRate();
                } else if (touchSensitivityUri.equals(uri)) {
                    updateTouchSensitivity();
                } else if (touchHoveringUri.equals(uri)) {
@@ -1912,6 +1922,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
                    mSettings.getEnabledInputMethodListLocked());
        }

        updateTouchPollingRate();
        updateTouchSensitivity();
        updateTouchHovering();

@@ -1971,6 +1982,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
                // Must happen before registerContentObserverLocked
                mLineageHardware = LineageHardwareManager.getInstance(mContext);

                updateTouchPollingRate();
                updateTouchSensitivity();
                updateTouchHovering();

@@ -3363,6 +3375,15 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
        sendOnNavButtonFlagsChangedLocked();
    }

    private void updateTouchPollingRate() {
        if (!mLineageHardware.isSupported(LineageHardwareManager.FEATURE_HIGH_TOUCH_POLLING_RATE)) {
            return;
        }
        final boolean enabled = LineageSettings.System.getInt(mContext.getContentResolver(),
                LineageSettings.System.HIGH_TOUCH_POLLING_RATE_ENABLE, 0) == 1;
        mLineageHardware.set(LineageHardwareManager.FEATURE_HIGH_TOUCH_POLLING_RATE, enabled);
    }

    private void updateTouchSensitivity() {
        if (!mLineageHardware.isSupported(LineageHardwareManager.FEATURE_HIGH_TOUCH_SENSITIVITY)) {
            return;