Add VelocityTracker Support for AXIS_SCROLL
AXIS_SCROLL motion events report diffs in movement between successive
events, so we have introduced a concept of cumulative-axes in this CL to
support AXIS_SCROLL.
Demo: go/rsb-fling-demo-1
Bug: 32830165
Test: atest libinput_tests; manual fling with rotating side button
Change-Id: Ic124b5c6d4d4bc30d1a45c49be4e5e8856d6c974
diff --git a/include/input/VelocityTracker.h b/include/input/VelocityTracker.h
index 6fac19f..f6556d6 100644
--- a/include/input/VelocityTracker.h
+++ b/include/input/VelocityTracker.h
@@ -160,7 +160,8 @@
void configureStrategy(int32_t axis);
- static std::unique_ptr<VelocityTrackerStrategy> createStrategy(const Strategy strategy);
+ static std::unique_ptr<VelocityTrackerStrategy> createStrategy(const Strategy strategy,
+ bool isCumulative);
};
@@ -306,7 +307,7 @@
class ImpulseVelocityTrackerStrategy : public VelocityTrackerStrategy {
public:
- ImpulseVelocityTrackerStrategy();
+ ImpulseVelocityTrackerStrategy(bool deltaValues);
virtual ~ImpulseVelocityTrackerStrategy();
virtual void clearPointers(BitSet32 idBits);
@@ -331,6 +332,11 @@
inline float getPosition(uint32_t id) const { return positions[idBits.getIndexOfBit(id)]; }
};
+ // Whether or not the input movement values for the strategy come in the form of delta values.
+ // If the input values are not deltas, the strategy needs to calculate deltas as part of its
+ // velocity calculation.
+ const bool mDeltaValues;
+
size_t mIndex;
Movement mMovements[HISTORY_SIZE];
};