Add isResampled field to PointerCoords.
This field is set if a pointer's coordinate data were generated by
input resampling and did not originate from the input device.
Bug: 167946721
Test: atest libinput_tests
Change-Id: I30d9aee85d462e6536fa33be5242365b52a11a6c
diff --git a/include/input/Input.h b/include/input/Input.h
index 1a35196..08d9019 100644
--- a/include/input/Input.h
+++ b/include/input/Input.h
@@ -368,7 +368,7 @@
* Pointer coordinate data.
*/
struct PointerCoords {
- enum { MAX_AXES = 30 }; // 30 so that sizeof(PointerCoords) == 128
+ enum { MAX_AXES = 30 }; // 30 so that sizeof(PointerCoords) == 136
// Bitfield of axes that are present in this structure.
uint64_t bits __attribute__((aligned(8)));
@@ -377,8 +377,15 @@
// for each axis that is present in the structure according to 'bits'.
std::array<float, MAX_AXES> values;
+ // Whether these coordinate data were generated by resampling.
+ bool isResampled;
+
+ static_assert(sizeof(bool) == 1); // Ensure padding is correctly sized.
+ uint8_t empty[7];
+
inline void clear() {
BitSet64::clear(bits);
+ isResampled = false;
}
bool isEmpty() const {
@@ -769,6 +776,10 @@
AMOTION_EVENT_AXIS_ORIENTATION, pointerIndex, historicalIndex);
}
+ inline bool isResampled(size_t pointerIndex, size_t historicalIndex) const {
+ return getHistoricalRawPointerCoords(pointerIndex, historicalIndex)->isResampled;
+ }
+
ssize_t findPointerIndex(int32_t pointerId) const;
void initialize(int32_t id, int32_t deviceId, uint32_t source, int32_t displayId,