Use std::vector for pointers in InputState
This simplifies calls to other APIs, because we can now pass the vector
by ref instead of having to separately store the pointerCount.
Bug: 211379801
Test: TEST=inputflinger_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST
Change-Id: I0f8af524afe99fee93b937890754d9676f8af5e7
diff --git a/services/inputflinger/dispatcher/InputState.h b/services/inputflinger/dispatcher/InputState.h
index 32df034..3adbba0 100644
--- a/services/inputflinger/dispatcher/InputState.h
+++ b/services/inputflinger/dispatcher/InputState.h
@@ -97,9 +97,8 @@
float xCursorPosition;
float yCursorPosition;
nsecs_t downTime;
- uint32_t pointerCount;
- PointerProperties pointerProperties[MAX_POINTERS];
- PointerCoords pointerCoords[MAX_POINTERS];
+ std::vector<PointerProperties> pointerProperties;
+ std::vector<PointerCoords> pointerCoords;
// Track for which pointers the target doesn't know about.
int32_t firstNewPointerIdx = INVALID_POINTER_INDEX;
bool hovering;
@@ -107,6 +106,7 @@
void setPointers(const MotionEntry& entry);
void mergePointerStateTo(MotionMemento& other) const;
+ size_t getPointerCount() const;
};
const IdGenerator& mIdGenerator; // InputDispatcher owns it so we won't have dangling reference.