Use std::bitset for tracking pointers in the dispatcher
Convert pointerIds to std::bitset. This will allow us to do
bitwise operations with other fields that already use std::bitset.
Bug: 211379801
Test: m inputflinger_tests && $ANDROID_HOST_OUT/nativetest64/inputflinger_tests/inputflinger_tests
Change-Id: I0347b5e171a0597fc88ba628f40dcf6cd59ea093
diff --git a/services/inputflinger/dispatcher/InputState.cpp b/services/inputflinger/dispatcher/InputState.cpp
index de8bfd5..ad5a7fd 100644
--- a/services/inputflinger/dispatcher/InputState.cpp
+++ b/services/inputflinger/dispatcher/InputState.cpp
@@ -374,7 +374,8 @@
}
std::vector<std::unique_ptr<MotionEntry>> InputState::synthesizeCancelationEventsForPointers(
- const MotionMemento& memento, const BitSet32 pointerIds, nsecs_t currentTime) {
+ const MotionMemento& memento, std::bitset<MAX_POINTER_ID + 1> pointerIds,
+ nsecs_t currentTime) {
std::vector<std::unique_ptr<MotionEntry>> events;
std::vector<uint32_t> canceledPointerIndices;
std::vector<PointerProperties> pointerProperties(MAX_POINTERS);
@@ -383,7 +384,7 @@
uint32_t pointerId = uint32_t(memento.pointerProperties[pointerIdx].id);
pointerProperties[pointerIdx].copyFrom(memento.pointerProperties[pointerIdx]);
pointerCoords[pointerIdx].copyFrom(memento.pointerCoords[pointerIdx]);
- if (pointerIds.hasBit(pointerId)) {
+ if (pointerIds.test(pointerId)) {
canceledPointerIndices.push_back(pointerIdx);
}
}