From a250b9063caba339668dda3d3307f2245ad779dc Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 9 Apr 2018 22:55:59 +0200 Subject: power: add back check for ro.vendor.extension_library This partially reverts I0ce40bbefb8c867dda8ee5eb1f948af2106e692d, "power: Using PerfHAL API". Especially older systems don't provide libqti-perfd-client.so but this is hardcoded since the aforementioned change. Use the former code checking for ro.vendor.extension_library and try to load that library if the property exists before falling back to loading libqti-perfd-client.so. Change-Id: If89e3b88062be10af7cfd43b6ba92a22fda32754 Signed-off-by: Corinna Vinschen --- utils.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/utils.c b/utils.c index 6c769e6..db1637d 100644 --- a/utils.c +++ b/utils.c @@ -60,13 +60,22 @@ static struct list_node active_hint_list_head; const char* pkg = "QTI PowerHAL"; static void* get_qcopt_handle() { + char qcopt_lib_path[PATH_MAX] = {0}; void* handle = NULL; dlerror(); - handle = dlopen(PERF_HAL_PATH, RTLD_NOW); + if (property_get("ro.vendor.extension_library", qcopt_lib_path, NULL)) { + handle = dlopen(qcopt_lib_path, RTLD_NOW); + if (!handle) { + ALOGE("Unable to open %s: %s\n", qcopt_lib_path, dlerror()); + } + } if (!handle) { - ALOGE("Unable to open %s: %s\n", PERF_HAL_PATH, dlerror()); + handle = dlopen(PERF_HAL_PATH, RTLD_NOW); + if (!handle) { + ALOGE("Unable to open %s: %s\n", PERF_HAL_PATH, dlerror()); + } } return handle; -- cgit v1.2.3