diff options
author | 2024-02-26 01:13:51 +0000 | |
---|---|---|
committer | 2024-02-26 01:13:51 +0000 | |
commit | 6e245a3ea3b1497f2b962dd09c11002ebde8f08b (patch) | |
tree | 8dd2a63cf2c363dd7b7bf412cbff8ec8ecf16c1e | |
parent | 9180f87bfaac7d0f063d1f59fa572e4751899af6 (diff) | |
parent | 05d40cd779aaa5cc768dff895d9211c687789e58 (diff) |
Merge "Do not use hard-coded apex name" into main am: c2e6966523 am: 05d40cd779
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2975191
Change-Id: Id5125ec34cdd7e0cdbb203a848f9e8dbb12afb7b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | libs/input/InputDevice.cpp | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/libs/input/InputDevice.cpp b/libs/input/InputDevice.cpp index d4dbc45090..c348833747 100644 --- a/libs/input/InputDevice.cpp +++ b/libs/input/InputDevice.cpp @@ -20,12 +20,14 @@ #include <unistd.h> #include <ctype.h> +#include <android-base/properties.h> #include <android-base/stringprintf.h> #include <ftl/enum.h> #include <gui/constants.h> #include <input/InputDevice.h> #include <input/InputEventLabels.h> +using android::base::GetProperty; using android::base::StringPrintf; namespace android { @@ -96,21 +98,22 @@ std::string getInputDeviceConfigurationFilePathByName( // Treblized input device config files will be located /product/usr, /system_ext/usr, // /odm/usr or /vendor/usr. - // These files may also be in the com.android.input.config APEX. - const char* rootsForPartition[]{ - "/product", - "/system_ext", - "/odm", - "/vendor", - "/apex/com.android.input.config/etc", - getenv("ANDROID_ROOT"), + std::vector<std::string> pathPrefixes{ + "/product/usr/", + "/system_ext/usr/", + "/odm/usr/", + "/vendor/usr/", }; - for (size_t i = 0; i < size(rootsForPartition); i++) { - if (rootsForPartition[i] == nullptr) { - continue; - } - path = rootsForPartition[i]; - path += "/usr/"; + // These files may also be in the APEX pointed by input_device.config_file.apex sysprop. + if (auto apex = GetProperty("input_device.config_file.apex", ""); !apex.empty()) { + pathPrefixes.push_back("/apex/" + apex + "/etc/usr/"); + } + // ANDROID_ROOT may not be set on host + if (auto android_root = getenv("ANDROID_ROOT"); android_root != nullptr) { + pathPrefixes.push_back(std::string(android_root) + "/usr/"); + } + for (const auto& prefix : pathPrefixes) { + path = prefix; appendInputDeviceConfigurationFileRelativePath(path, name, type); #if DEBUG_PROBE ALOGD("Probing for system provided input device configuration file: path='%s'", |