Loading sensors/common/default/2.X/multihal/HalProxy.cpp +20 −1 Original line number Diff line number Diff line Loading @@ -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 { Loading Loading @@ -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(); } Loading sensors/common/default/2.X/multihal/include/HalProxy.h +10 −0 Original line number Diff line number Diff line Loading @@ -266,6 +266,16 @@ class HalProxy : public V2_0::implementation::IScopedWakelockRefCounter, */ void initializeSensorList(); /** * Try using the default include directories as well as the directories defined in * kSubHalShareObjectLocations to get a handle for dlsym for a subhal. * * @param filename The file name to search for. * * @return The handle or nullptr if search failed. */ void* getHandleForSubHalSharedObject(const std::string& filename); /** * Calls the helper methods that all ctors use. */ Loading Loading
sensors/common/default/2.X/multihal/HalProxy.cpp +20 −1 Original line number Diff line number Diff line Loading @@ -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 { Loading Loading @@ -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(); } Loading
sensors/common/default/2.X/multihal/include/HalProxy.h +10 −0 Original line number Diff line number Diff line Loading @@ -266,6 +266,16 @@ class HalProxy : public V2_0::implementation::IScopedWakelockRefCounter, */ void initializeSensorList(); /** * Try using the default include directories as well as the directories defined in * kSubHalShareObjectLocations to get a handle for dlsym for a subhal. * * @param filename The file name to search for. * * @return The handle or nullptr if search failed. */ void* getHandleForSubHalSharedObject(const std::string& filename); /** * Calls the helper methods that all ctors use. */ Loading