diff options
author | 2024-09-12 18:49:39 +0000 | |
---|---|---|
committer | 2024-09-12 18:59:36 +0000 | |
commit | b632185b24c0df53f20f4cf0923593e662c2ce42 (patch) | |
tree | 91082867778c7ff263762ffbaed93f18329793b6 | |
parent | f20b6ba6b0f791dfdebd26c48014a2733370498f (diff) |
InputDevice: warn if a potential IDC file can't be opened
When probing for IDC files, we expect to get "File not found" errors,
but any other error could indicate a deeper problem (such as the
permissions issue that appears to be behind b/365593937). In that case,
it would be useful to have a warning log even if DEBUG_PROBE isn't set.
Test: remove the read permissions for everyone on an IDC file, then
watch logcat for the InputDevice tag while connecting the
corresponding device
Bug: 365593937
Flag: EXEMPT logging change
Change-Id: I022ec383f0c0b22a66524341530c055a69e05f0b
-rw-r--r-- | libs/input/InputDevice.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libs/input/InputDevice.cpp b/libs/input/InputDevice.cpp index 962ce09b46..c9030312f9 100644 --- a/libs/input/InputDevice.cpp +++ b/libs/input/InputDevice.cpp @@ -122,6 +122,10 @@ std::string getInputDeviceConfigurationFilePathByName( LOG_IF(INFO, DEBUG_PROBE) << "Found system-provided input device configuration file at " << path; return path; + } else if (errno != ENOENT) { + LOG(WARNING) << "Couldn't find a system-provided input device configuration file at " + << path << " due to error " << errno << " (" << strerror(errno) + << "); there may be an IDC file there that cannot be loaded."; } else { LOG_IF(ERROR, DEBUG_PROBE) << "Didn't find system-provided input device configuration file at " << path @@ -142,6 +146,10 @@ std::string getInputDeviceConfigurationFilePathByName( LOG_IF(INFO, DEBUG_PROBE) << "Found system user input device configuration file at " << path; return path; + } else if (errno != ENOENT) { + LOG(WARNING) << "Couldn't find a system user input device configuration file at " << path + << " due to error " << errno << " (" << strerror(errno) + << "); there may be an IDC file there that cannot be loaded."; } else { LOG_IF(ERROR, DEBUG_PROBE) << "Didn't find system user input device configuration file at " << path << ": " << strerror(errno); |