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

Unverified Commit c94cee44 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 6f19af80
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -1235,6 +1235,12 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
                    Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD), false, this, userId);
            resolver.registerContentObserver(Settings.Secure.getUriFor(
                    Settings.Secure.ACCESSIBILITY_SOFT_KEYBOARD_MODE), false, this, userId);
            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(
@@ -1253,6 +1259,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
                    Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD);
            final Uri accessibilityRequestingNoImeUri = Settings.Secure.getUriFor(
                    Settings.Secure.ACCESSIBILITY_SOFT_KEYBOARD_MODE);
            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(
@@ -1277,6 +1285,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
                                InputMethodManager.SHOW_IMPLICIT, null,
                                SoftInputShowHideReason.SHOW_SETTINGS_ON_CHANGE);
                    }
                } else if (highTouchPollingRateUri.equals(uri)) {
                    updateTouchPollingRate();
                } else if (touchSensitivityUri.equals(uri)) {
                    updateTouchSensitivity();
                } else if (touchHoveringUri.equals(uri)) {
@@ -1951,6 +1961,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
        }

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

        if (DEBUG) Slog.d(TAG, "Switching user stage 3/3. newUserId=" + newUserId
@@ -2007,6 +2018,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
                mLineageHardware = LineageHardwareManager.getInstance(mContext);

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

                mKeyguardManager = mContext.getSystemService(KeyguardManager.class);
@@ -3547,6 +3559,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;