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

Commit f2b96844 authored by Michael Checo's avatar Michael Checo Committed by Android (Google) Code Review
Browse files

Merge changes from topic "rename-mouse-acceleration-api" into main

* changes:
  Rename setMousePointerAccelerationEnabled
  Refactor: Rename displaysWithMousePointerAccelerationDisabled
parents f650a80f 430e1643
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -265,8 +265,8 @@ class InputController {
        mInputManagerInternal.setPointerIconVisible(visible, displayId);
    }

    void setMousePointerAccelerationEnabled(boolean enabled, int displayId) {
        mInputManagerInternal.setMousePointerAccelerationEnabled(enabled, displayId);
    void setMouseScalingEnabled(boolean enabled, int displayId) {
        mInputManagerInternal.setMouseScalingEnabled(enabled, displayId);
    }

    void setDisplayEligibilityForPointerCapture(boolean isEligible, int displayId) {
+1 −1
Original line number Diff line number Diff line
@@ -1518,7 +1518,7 @@ final class VirtualDeviceImpl extends IVirtualDevice.Stub

        final long token = Binder.clearCallingIdentity();
        try {
            mInputController.setMousePointerAccelerationEnabled(false, displayId);
            mInputController.setMouseScalingEnabled(false, displayId);
            mInputController.setDisplayEligibilityForPointerCapture(/* isEligible= */ false,
                    displayId);
            if (isTrustedDisplay) {
+5 −2
Original line number Diff line number Diff line
@@ -104,13 +104,16 @@ public abstract class InputManagerInternal {
    public abstract PointF getCursorPosition(int displayId);

    /**
     * Enables or disables pointer acceleration for mouse movements.
     * Set whether all pointer scaling, including linear scaling based on the
     * user's pointer speed setting, should be enabled or disabled for mice.
     *
     * Note that this only affects pointer movements from mice (that is, pointing devices which send
     * relative motions, including trackballs and pointing sticks), not from other pointer devices
     * such as touchpads and styluses.
     *
     * Scaling is enabled by default on new displays until it is explicitly disabled.
     */
    public abstract void setMousePointerAccelerationEnabled(boolean enabled, int displayId);
    public abstract void setMouseScalingEnabled(boolean enabled, int displayId);

    /**
     * Sets the eligibility of windows on a given display for pointer capture. If a display is
+15 −15
Original line number Diff line number Diff line
@@ -1382,9 +1382,9 @@ public class InputManagerService extends IInputManager.Stub
        mNative.setPointerSpeed(speed);
    }

    private void setMousePointerAccelerationEnabled(boolean enabled, int displayId) {
    private void setMouseScalingEnabled(boolean enabled, int displayId) {
        updateAdditionalDisplayInputProperties(displayId,
                properties -> properties.mousePointerAccelerationEnabled = enabled);
                properties -> properties.mouseScalingEnabled = enabled);
    }

    private void setPointerIconVisible(boolean visible, int displayId) {
@@ -2232,8 +2232,8 @@ public class InputManagerService extends IInputManager.Stub
                    pw.println("displayId: " + mAdditionalDisplayInputProperties.keyAt(i));
                    final AdditionalDisplayInputProperties properties =
                            mAdditionalDisplayInputProperties.valueAt(i);
                    pw.println("mousePointerAccelerationEnabled: "
                            + properties.mousePointerAccelerationEnabled);
                    pw.println("mouseScalingEnabled: "
                            + properties.mouseScalingEnabled);
                    pw.println("pointerIconVisible: " + properties.pointerIconVisible);
                }
            } finally {
@@ -3575,8 +3575,8 @@ public class InputManagerService extends IInputManager.Stub
        }

        @Override
        public void setMousePointerAccelerationEnabled(boolean enabled, int displayId) {
            InputManagerService.this.setMousePointerAccelerationEnabled(enabled, displayId);
        public void setMouseScalingEnabled(boolean enabled, int displayId) {
            InputManagerService.this.setMouseScalingEnabled(enabled, displayId);
        }

        @Override
@@ -3716,15 +3716,15 @@ public class InputManagerService extends IInputManager.Stub
    private static class AdditionalDisplayInputProperties {

        static final boolean DEFAULT_POINTER_ICON_VISIBLE = true;
        static final boolean DEFAULT_MOUSE_POINTER_ACCELERATION_ENABLED = true;
        static final boolean DEFAULT_MOUSE_SCALING_ENABLED = true;

        /**
         * Whether to enable mouse pointer acceleration on this display. Note that this only affects
         * Whether to enable mouse pointer scaling on this display. Note that this only affects
         * pointer movements from mice (that is, pointing devices which send relative motions,
         * including trackballs and pointing sticks), not from other pointer devices such as
         * touchpads and styluses.
         */
        public boolean mousePointerAccelerationEnabled;
        public boolean mouseScalingEnabled;

        // Whether the pointer icon should be visible or hidden on this display.
        public boolean pointerIconVisible;
@@ -3734,12 +3734,12 @@ public class InputManagerService extends IInputManager.Stub
        }

        public boolean allDefaults() {
            return mousePointerAccelerationEnabled == DEFAULT_MOUSE_POINTER_ACCELERATION_ENABLED
            return mouseScalingEnabled == DEFAULT_MOUSE_SCALING_ENABLED
                    && pointerIconVisible == DEFAULT_POINTER_ICON_VISIBLE;
        }

        public void reset() {
            mousePointerAccelerationEnabled = DEFAULT_MOUSE_POINTER_ACCELERATION_ENABLED;
            mouseScalingEnabled = DEFAULT_MOUSE_SCALING_ENABLED;
            pointerIconVisible = DEFAULT_POINTER_ICON_VISIBLE;
        }
    }
@@ -3754,14 +3754,14 @@ public class InputManagerService extends IInputManager.Stub
                mAdditionalDisplayInputProperties.put(displayId, properties);
            }
            final boolean oldPointerIconVisible = properties.pointerIconVisible;
            final boolean oldMouseAccelerationEnabled = properties.mousePointerAccelerationEnabled;
            final boolean oldMouseScalingEnabled = properties.mouseScalingEnabled;
            updater.accept(properties);
            if (oldPointerIconVisible != properties.pointerIconVisible) {
                mNative.setPointerIconVisibility(displayId, properties.pointerIconVisible);
            }
            if (oldMouseAccelerationEnabled != properties.mousePointerAccelerationEnabled) {
                mNative.setMousePointerAccelerationEnabled(displayId,
                        properties.mousePointerAccelerationEnabled);
            if (oldMouseScalingEnabled != properties.mouseScalingEnabled) {
                mNative.setMouseScalingEnabled(displayId,
                        properties.mouseScalingEnabled);
            }
            if (properties.allDefaults()) {
                mAdditionalDisplayInputProperties.remove(displayId);
+2 −2
Original line number Diff line number Diff line
@@ -130,7 +130,7 @@ interface NativeInputManagerService {

    void setPointerSpeed(int speed);

    void setMousePointerAccelerationEnabled(int displayId, boolean enabled);
    void setMouseScalingEnabled(int displayId, boolean enabled);

    void setMouseReverseVerticalScrollingEnabled(boolean enabled);

@@ -421,7 +421,7 @@ interface NativeInputManagerService {
        public native void setPointerSpeed(int speed);

        @Override
        public native void setMousePointerAccelerationEnabled(int displayId, boolean enabled);
        public native void setMouseScalingEnabled(int displayId, boolean enabled);

        @Override
        public native void setMouseReverseVerticalScrollingEnabled(boolean enabled);
Loading