EventHub: log error when getting axis info for non-existent device
It's possible that getAbsoluteAxisInfo not finding the device is the
cause of a hard-to-reproduce crash in GestureConverter, where nullopt is
returned for an axis despite the EventHub classification code requiring
that axis to classify a device as a touchpad. Trying to retrieve axis
info for a non-existent device is always an error of some kind, so let's
at least log that.
Bug: 374255515
Test: m checkinput
Flag: EXEMPT log only update
Change-Id: Ifb0c82d88c11ac31671e947d5f5805949931060f
diff --git a/services/inputflinger/reader/EventHub.cpp b/services/inputflinger/reader/EventHub.cpp
index f8cd973..f654312 100644
--- a/services/inputflinger/reader/EventHub.cpp
+++ b/services/inputflinger/reader/EventHub.cpp
@@ -43,6 +43,7 @@
#include <android-base/strings.h>
#include <cutils/properties.h>
#include <ftl/enum.h>
+#include <input/InputEventLabels.h>
#include <input/KeyCharacterMap.h>
#include <input/KeyLayoutMap.h>
#include <input/PrintTools.h>
@@ -1021,6 +1022,8 @@
std::scoped_lock _l(mLock);
const Device* device = getDeviceLocked(deviceId);
if (device == nullptr) {
+ ALOGE("Couldn't find device with ID %d, so returning null axis info for axis %s", deviceId,
+ InputEventLookup::getLinuxEvdevLabel(EV_ABS, axis, 0).code.c_str());
return std::nullopt;
}
// We can read the RawAbsoluteAxisInfo even if the device is disabled and doesn't have a valid