Copy InputDeviceIdentifier instead of taking a reference
This line appears to be causing hwasan failures in the lab (see bug).
While a const& should extend the lifetime of the thing it's referring
to, that doesn't seem to be happening in this case, possibly because
getDeviceIdentifier isn't a simple getter. InputDeviceIdentifier isn't a
particularly large struct, and we intend to replace this code with an
IDC property anyway, so just take a copy of it.
Bug: 266534706, 251196347
Test: atest inputflinger_tests
Test: connect Sony gamepads, check old stack is used
Test: connect Apple Magic Trackpad 2, check new stack is used
Change-Id: I98f09f8226bc5e42082b07f9795eccc6de890879
diff --git a/services/inputflinger/reader/InputDevice.cpp b/services/inputflinger/reader/InputDevice.cpp
index bd41fa5..aba33bc 100644
--- a/services/inputflinger/reader/InputDevice.cpp
+++ b/services/inputflinger/reader/InputDevice.cpp
@@ -212,7 +212,7 @@
sysprop::InputProperties::enable_touchpad_gestures_library().value_or(false);
// TODO(b/246587538): Fix the new touchpad stack for Sony DualShock 4 (5c4, 9cc) and DualSense
// (ce6) touchpads, or at least load this setting from the IDC file.
- const InputDeviceIdentifier& identifier = contextPtr->getDeviceIdentifier();
+ const InputDeviceIdentifier identifier = contextPtr->getDeviceIdentifier();
const bool isSonyGamepadTouchpad = identifier.vendor == 0x054c &&
(identifier.product == 0x05c4 || identifier.product == 0x09cc ||
identifier.product == 0x0ce6);