summaryrefslogtreecommitdiff
path: root/sensors/common/default/2.X/multihal/HalProxy.cpp
diff options
context:
space:
mode:
authorSteven Laver <lavers@google.com>2020-05-04 22:18:20 -0700
committerSteven Laver <lavers@google.com>2020-05-06 11:48:56 -0700
commit19a172e0208b6d3dcbcdb793107550a6837f79be (patch)
tree1646968c9627def5f7144bedca21f1ff51900546 /sensors/common/default/2.X/multihal/HalProxy.cpp
parentc7b41816dfb92b9f104439a19c78abc4f68971e0 (diff)
parent7d054ed1deae08cb23eb54c063c12772e96831fd (diff)
Merge RP1A.200504.002
Change-Id: I1c488a4fc4dee824e058a48b606499840cf5a35b
Diffstat (limited to 'sensors/common/default/2.X/multihal/HalProxy.cpp')
-rw-r--r--sensors/common/default/2.X/multihal/HalProxy.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/sensors/common/default/2.X/multihal/HalProxy.cpp b/sensors/common/default/2.X/multihal/HalProxy.cpp
index a09e9e938e..75ffc17a67 100644
--- a/sensors/common/default/2.X/multihal/HalProxy.cpp
+++ b/sensors/common/default/2.X/multihal/HalProxy.cpp
@@ -426,7 +426,7 @@ void HalProxy::initializeSubHalListFromConfigFile(const char* configFileName) {
} else {
std::string subHalLibraryFile;
while (subHalConfigStream >> subHalLibraryFile) {
- void* handle = dlopen(subHalLibraryFile.c_str(), RTLD_NOW);
+ void* handle = getHandleForSubHalSharedObject(subHalLibraryFile);
if (handle == nullptr) {
ALOGE("dlopen failed for library: %s", subHalLibraryFile.c_str());
} else {
@@ -491,6 +491,25 @@ void HalProxy::initializeSensorList() {
}
}
+void* HalProxy::getHandleForSubHalSharedObject(const std::string& filename) {
+ static const std::string kSubHalShareObjectLocations[] = {
+ "", // Default locations will be searched
+#ifdef __LP64__
+ "/vendor/lib64/hw/", "/odm/lib64/hw/"
+#else
+ "/vendor/lib/hw/", "/odm/lib/hw/"
+#endif
+ };
+
+ for (const std::string& dir : kSubHalShareObjectLocations) {
+ void* handle = dlopen((dir + filename).c_str(), RTLD_NOW);
+ if (handle != nullptr) {
+ return handle;
+ }
+ }
+ return nullptr;
+}
+
void HalProxy::init() {
initializeSensorList();
}