Delete TouchState::deviceId
We are doing per-device pointer tracking now, so this CL helps remove
the assumptions around having a single active device.
For now, the behaviour is preserved. In the future, we will not need to
check the currently active device at the TouchState level.
Bug: 211379801
Test: m inputflinger_tests && $ANDROID_HOST_OUT/nativetest64/inputflinger_tests/inputflinger_tests
Change-Id: Ie13e9c93eefc04c2955de3b8a06c9c2da28c9d72
diff --git a/services/inputflinger/dispatcher/TouchedWindow.cpp b/services/inputflinger/dispatcher/TouchedWindow.cpp
index 6ab97f8..ae16520 100644
--- a/services/inputflinger/dispatcher/TouchedWindow.cpp
+++ b/services/inputflinger/dispatcher/TouchedWindow.cpp
@@ -134,6 +134,14 @@
return deviceIds;
}
+std::set<int32_t> TouchedWindow::getActiveDeviceIds() const {
+ std::set<int32_t> out;
+ for (const auto& [deviceId, _] : mDeviceStates) {
+ out.emplace(deviceId);
+ }
+ return out;
+}
+
bool TouchedWindow::hasPilferingPointers(int32_t deviceId) const {
const auto stateIt = mDeviceStates.find(deviceId);
if (stateIt == mDeviceStates.end()) {