diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2017-05-04 02:05:14 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-05-04 02:05:14 +0000 |
commit | d3f4f14218049bde7f5c5061f560c2554c6f6a0d (patch) | |
tree | 7965ca410f6c0e2b954fc9843b3e62c41cef6ae7 | |
parent | 43346aad0191ca95ddec6fadaea0fd70be53f380 (diff) | |
parent | 900cfac9eecf7b7318a9adccd8a18bbf3da3bdd1 (diff) | |
download | libhardware-d3f4f14218049bde7f5c5061f560c2554c6f6a0d.tar.gz |
Merge "Move default multihal configuration file to /vendor/..." into oc-dev
-rw-r--r-- | modules/sensors/multihal.cpp | 31 | ||||
-rw-r--r-- | modules/sensors/multihal.h | 5 |
2 files changed, 28 insertions, 8 deletions
diff --git a/modules/sensors/multihal.cpp b/modules/sensors/multihal.cpp index 2810118f..887a4ba5 100644 --- a/modules/sensors/multihal.cpp +++ b/modules/sensors/multihal.cpp @@ -500,15 +500,32 @@ static bool starts_with(const char* s, const char* prefix) { * The vector must not be null. */ static void get_so_paths(std::vector<std::string> *so_paths) { - std::string line; - std::ifstream conf_file(MULTI_HAL_CONFIG_FILE_PATH); - - if(!conf_file) { - ALOGW("No multihal config file found at %s", MULTI_HAL_CONFIG_FILE_PATH); + const std::vector<const char *> config_path_list( + { MULTI_HAL_CONFIG_FILE_PATH, DEPRECATED_MULTI_HAL_CONFIG_FILE_PATH }); + + std::ifstream stream; + const char *path = nullptr; + for (auto i : config_path_list) { + std::ifstream f(i); + if (f) { + stream = std::move(f); + path = i; + break; + } + } + if(!stream) { + ALOGW("No multihal config file found"); return; } - ALOGV("Multihal config file found at %s", MULTI_HAL_CONFIG_FILE_PATH); - while (std::getline(conf_file, line)) { + + ALOGE_IF(strcmp(path, DEPRECATED_MULTI_HAL_CONFIG_FILE_PATH) == 0, + "Multihal configuration file path %s is not compatible with Treble " + "requirements. Please move it to %s.", + path, MULTI_HAL_CONFIG_FILE_PATH); + + ALOGV("Multihal config file found at %s", path); + std::string line; + while (std::getline(stream, line)) { ALOGV("config file line: '%s'", line.c_str()); so_paths->push_back(line); } diff --git a/modules/sensors/multihal.h b/modules/sensors/multihal.h index 210c7cce..234f2f07 100644 --- a/modules/sensors/multihal.h +++ b/modules/sensors/multihal.h @@ -19,7 +19,10 @@ #include <hardware/sensors.h> #include <hardware/hardware.h> -static const char* MULTI_HAL_CONFIG_FILE_PATH = "/system/etc/sensors/hals.conf"; +static const char* MULTI_HAL_CONFIG_FILE_PATH = "/vendor/etc/sensors/hals.conf"; + +// Depracated because system partition HAL config file does not satisfy treble requirements. +static const char* DEPRECATED_MULTI_HAL_CONFIG_FILE_PATH = "/system/etc/sensors/hals.conf"; struct sensors_module_t *get_multi_hal_module_info(void); |