add /system/vendor/lib as valid search path for sensor HALs
MultiHal will now accept sensor HALs listed in the hals.conf file that reside in either /system/lib/hw or /system/vendor/lib. Bug: 14994424 Change-Id: I13f17352b97c36b97cfbcee8c9b6a0d2e1ed6dc3
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
|
||||
static const char* CONFIG_FILENAME = "/system/etc/sensors/hals.conf";
|
||||
static const char* LEGAL_SUBHAL_PATH_PREFIX = "/system/lib/hw/";
|
||||
static const char* LEGAL_SUBHAL_ALTERNATE_PATH_PREFIX = "/system/vendor/lib/";
|
||||
static const int MAX_CONF_LINE_LENGTH = 1024;
|
||||
|
||||
static pthread_mutex_t init_modules_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
@@ -440,14 +441,15 @@ static void get_so_paths(std::vector<char*> *so_paths) {
|
||||
}
|
||||
ALOGV("config file line #%d: '%s'", ++line_count, line);
|
||||
char *real_path = realpath(line, NULL);
|
||||
if (starts_with(real_path, LEGAL_SUBHAL_PATH_PREFIX)) {
|
||||
if (starts_with(real_path, LEGAL_SUBHAL_PATH_PREFIX) ||
|
||||
starts_with(real_path, LEGAL_SUBHAL_ALTERNATE_PATH_PREFIX)) {
|
||||
ALOGV("accepting valid path '%s'", real_path);
|
||||
char* compact_line = new char[strlen(real_path) + 1];
|
||||
strcpy(compact_line, real_path);
|
||||
so_paths->push_back(compact_line);
|
||||
} else {
|
||||
ALOGW("rejecting path '%s' because it does not start with '%s'",
|
||||
real_path, LEGAL_SUBHAL_PATH_PREFIX);
|
||||
ALOGW("rejecting path '%s' because it does not start with '%s' or '%s'",
|
||||
real_path, LEGAL_SUBHAL_PATH_PREFIX, LEGAL_SUBHAL_ALTERNATE_PATH_PREFIX);
|
||||
}
|
||||
free(real_path);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user