Support customize the path to lookup for hidl instrumenation libraries.
* This is required by VTS test with profiling: the test could now push the
profiling library to /data patition and set the path so that the
system could lookup and load profiling libraries under the customized
path.
* The custom path is set with property hal.instrumentation.lib.path
Test: manually tested with hidl_test.
Change-Id: Id05594d8f8e55536254400a6a82726093dc69f2f
diff --git a/HidlSupport.cpp b/HidlSupport.cpp
index 666c606..769db74 100644
--- a/HidlSupport.cpp
+++ b/HidlSupport.cpp
@@ -184,9 +184,17 @@
std::vector<InstrumentationCallback> *instrumentationCallbacks) {
#ifdef LIBHIDL_TARGET_DEBUGGABLE
std::vector<std::string> instrumentationLibPaths;
- instrumentationLibPaths.push_back(HAL_LIBRARY_PATH_SYSTEM);
- instrumentationLibPaths.push_back(HAL_LIBRARY_PATH_VENDOR);
- instrumentationLibPaths.push_back(HAL_LIBRARY_PATH_ODM);
+ char instrumentation_lib_path[PROPERTY_VALUE_MAX];
+ if (property_get("hal.instrumentation.lib.path",
+ instrumentation_lib_path,
+ "") > 0) {
+ instrumentationLibPaths.push_back(instrumentation_lib_path);
+ } else {
+ instrumentationLibPaths.push_back(HAL_LIBRARY_PATH_SYSTEM);
+ instrumentationLibPaths.push_back(HAL_LIBRARY_PATH_VENDOR);
+ instrumentationLibPaths.push_back(HAL_LIBRARY_PATH_ODM);
+ }
+
for (auto path : instrumentationLibPaths) {
DIR *dir = opendir(path.c_str());
if (dir == 0) {