Fix InputDevice listener notification for merged controller.
Merged game controllers report unique device id combined from multiple
input devices, when notifying device listener input manager will send
a list of devices unique to each other.
When an event hub device is added to a input device, the generation Id
must be bumped to generate a device changed event for input device
listener.
Fixed the Sony game controller connection failure.
Fixed the duplicate device listing in input service dump.
Bug: 168338098
Test: atest inputflinger_tests
Change-Id: I535357a8a7dfa5db93ab6b2762adb5c8b7aa7d8b
diff --git a/services/inputflinger/reader/include/InputReader.h b/services/inputflinger/reader/include/InputReader.h
index 2d6ccf5..a902482 100644
--- a/services/inputflinger/reader/include/InputReader.h
+++ b/services/inputflinger/reader/include/InputReader.h
@@ -142,6 +142,11 @@
// to lookup the input device instance from the EventHub device id.
std::unordered_map<int32_t /*eventHubId*/, std::shared_ptr<InputDevice>> mDevices;
+ // An input device contains one or more eventHubId, this map provides a way to lookup the
+ // EventHubIds contained in the input device from the input device instance.
+ std::unordered_map<std::shared_ptr<InputDevice>, std::vector<int32_t> /*eventHubId*/>
+ mDeviceToEventHubIdsMap;
+
// low-level input event decoding and device management
void processEventsLocked(const RawEvent* rawEvents, size_t count);