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

Commit 62d0bd72 authored by Harry Cutts's avatar Harry Cutts
Browse files

Clean up feature flag for new mouse pointer ballistics

This has launched and so can now be removed.

Bug: 320433834
Test: check pointer movements and adjusting pointer speed in settings
      with a USB mouse
Test: atest frameworks/native/services/inputflinger/tests/CursorInputMapper_test.cpp
Flag: EXEMPT removing
      com.android.input.flags.enable_new_mouse_pointer_ballistics

Change-Id: I6b4241a808993a555232b64aff3a32b01e0b8fef
parent e0d984c2
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -93,13 +93,6 @@ flag {
  bug: "309018874"
}

flag {
  name: "enable_new_mouse_pointer_ballistics"
  namespace: "input"
  description: "Change the acceleration curves for mouse pointer movements to match the touchpad ones"
  bug: "315313622"
}

flag {
  name: "rate_limit_user_activity_poke_in_dispatcher"
  namespace: "input"
+6 −7
Original line number Diff line number Diff line
@@ -137,19 +137,18 @@ struct InputReaderConfiguration {
    ui::LogicalDisplayId defaultPointerDisplayId;

    // The mouse pointer speed, as a number from -7 (slowest) to 7 (fastest).
    //
    // Currently only used when the enable_new_mouse_pointer_ballistics flag is enabled.
    int32_t mousePointerSpeed;

    // Displays on which an acceleration curve shouldn't be applied for pointer movements from mice.
    //
    // Currently only used when the enable_new_mouse_pointer_ballistics flag is enabled.
    std::set<ui::LogicalDisplayId> displaysWithMousePointerAccelerationDisabled;

    // Velocity control parameters for mouse pointer movements.
    // Velocity control parameters for touchpad pointer movements on the old touchpad stack (based
    // on TouchInputMapper).
    //
    // For mice, these are ignored and the values of mousePointerSpeed and
    // mousePointerAccelerationEnabled used instead.
    //
    // If the enable_new_mouse_pointer_ballistics flag is enabled, these are ignored and the values
    // of mousePointerSpeed and mousePointerAccelerationEnabled used instead.
    // TODO(b/281840344): remove this.
    VelocityControlParameters pointerVelocityControlParameters;

    // Velocity control parameters for mouse wheel movements.
+9 −29
Original line number Diff line number Diff line
@@ -33,8 +33,6 @@

#include "input/PrintTools.h"

namespace input_flags = com::android::input::flags;

namespace android {

// The default velocity control parameters that has no effect.
@@ -77,8 +75,7 @@ void CursorMotionAccumulator::finishSync() {
CursorInputMapper::CursorInputMapper(InputDeviceContext& deviceContext,
                                     const InputReaderConfiguration& readerConfig)
      : InputMapper(deviceContext, readerConfig),
        mLastEventTime(std::numeric_limits<nsecs_t>::min()),
        mEnableNewMousePointerBallistics(input_flags::enable_new_mouse_pointer_ballistics()) {}
        mLastEventTime(std::numeric_limits<nsecs_t>::min()) {}

uint32_t CursorInputMapper::getSources() const {
    return mSource;
@@ -207,8 +204,7 @@ std::list<NotifyArgs> CursorInputMapper::reset(nsecs_t when) {
    mDownTime = 0;
    mLastEventTime = std::numeric_limits<nsecs_t>::min();

    mOldPointerVelocityControl.reset();
    mNewPointerVelocityControl.reset();
    mPointerVelocityControl.reset();
    mWheelXVelocityControl.reset();
    mWheelYVelocityControl.reset();

@@ -291,11 +287,7 @@ std::list<NotifyArgs> CursorInputMapper::sync(nsecs_t when, nsecs_t readTime) {
    mWheelYVelocityControl.move(when, nullptr, &vscroll);
    mWheelXVelocityControl.move(when, &hscroll, nullptr);

    if (mEnableNewMousePointerBallistics) {
        mNewPointerVelocityControl.move(when, &deltaX, &deltaY);
    } else {
        mOldPointerVelocityControl.move(when, &deltaX, &deltaY);
    }
    mPointerVelocityControl.move(when, &deltaX, &deltaY);

    float xCursorPosition = AMOTION_EVENT_INVALID_CURSOR_POSITION;
    float yCursorPosition = AMOTION_EVENT_INVALID_CURSOR_POSITION;
@@ -486,27 +478,15 @@ void CursorInputMapper::configureOnPointerCapture(const InputReaderConfiguration
void CursorInputMapper::configureOnChangePointerSpeed(const InputReaderConfiguration& config) {
    if (mParameters.mode == Parameters::Mode::POINTER_RELATIVE) {
        // Disable any acceleration or scaling for the pointer when Pointer Capture is enabled.
        if (mEnableNewMousePointerBallistics) {
            mNewPointerVelocityControl.setAccelerationEnabled(false);
        } else {
            mOldPointerVelocityControl.setParameters(FLAT_VELOCITY_CONTROL_PARAMS);
        }
        mPointerVelocityControl.setAccelerationEnabled(false);
        mWheelXVelocityControl.setParameters(FLAT_VELOCITY_CONTROL_PARAMS);
        mWheelYVelocityControl.setParameters(FLAT_VELOCITY_CONTROL_PARAMS);
    } else {
        if (mEnableNewMousePointerBallistics) {
            mNewPointerVelocityControl.setAccelerationEnabled(
        mPointerVelocityControl.setAccelerationEnabled(
                config.displaysWithMousePointerAccelerationDisabled.count(
                        mDisplayId.value_or(ui::LogicalDisplayId::INVALID)) == 0);
            mNewPointerVelocityControl.setCurve(
        mPointerVelocityControl.setCurve(
                createAccelerationCurveForPointerSensitivity(config.mousePointerSpeed));
        } else {
            mOldPointerVelocityControl.setParameters(
                    (config.displaysWithMousePointerAccelerationDisabled.count(
                             mDisplayId.value_or(ui::LogicalDisplayId::INVALID)) == 0)
                            ? config.pointerVelocityControlParameters
                            : FLAT_VELOCITY_CONTROL_PARAMS);
        }
        mWheelXVelocityControl.setParameters(config.wheelVelocityControlParameters);
        mWheelYVelocityControl.setParameters(config.wheelVelocityControlParameters);
    }
+1 −3
Original line number Diff line number Diff line
@@ -104,8 +104,7 @@ private:

    // Velocity controls for mouse pointer and wheel movements.
    // The controls for X and Y wheel movements are separate to keep them decoupled.
    SimpleVelocityControl mOldPointerVelocityControl;
    CurvedVelocityControl mNewPointerVelocityControl;
    CurvedVelocityControl mPointerVelocityControl;
    SimpleVelocityControl mWheelXVelocityControl;
    SimpleVelocityControl mWheelYVelocityControl;

@@ -120,7 +119,6 @@ private:
    nsecs_t mDownTime;
    nsecs_t mLastEventTime;

    const bool mEnableNewMousePointerBallistics;
    bool mMouseReverseVerticalScrolling = false;

    explicit CursorInputMapper(InputDeviceContext& deviceContext,
+94 −179

File changed.

Preview size limit exceeded, changes collapsed.

Loading