Make VelocityTracker 1D
Currently, VelocityTracker is strictly tied to X and Y axes. It's APIs
act on both axes, and its component structs (e.g. Position, Estimator)
are tied to both X and Y axes. As a step towards supporting more axes
for velocity tracking, this change:
- removes the Position struct: stores/processes data as pure floats, one
axis at a time
- makes Estimator and Strategy specific to a single axis, instead of
dealing with both/only X and Y at the same time
Furthermore, we have pulled into VelocityTracker the logic to compute
all velocity. This helps making the immediate JNI layer light-weight in
addition to allowing us to test the logic (which is non-trivial and
benefits from tests).
Bug: 32830165
Test: VelocityTracker_test unaffected (atest libinput_tests)
Change-Id: I181af7a033eb647e9cb97db9b86a36ae972290a5
diff --git a/include/input/VelocityControl.h b/include/input/VelocityControl.h
index 1acc2ae..f4c7061 100644
--- a/include/input/VelocityControl.h
+++ b/include/input/VelocityControl.h
@@ -98,7 +98,7 @@
VelocityControlParameters mParameters;
nsecs_t mLastMovementTime;
- VelocityTracker::Position mRawPosition;
+ float mRawPositionX, mRawPositionY;
VelocityTracker mVelocityTracker;
};