summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/Android.mk4
-rw-r--r--utils/Makefile.am2
-rw-r--r--utils/loc_cfg.cpp38
-rw-r--r--utils/loc_cfg.h5
-rw-r--r--utils/loc_misc_utils.cpp31
-rw-r--r--utils/loc_misc_utils.h28
6 files changed, 95 insertions, 13 deletions
diff --git a/utils/Android.mk b/utils/Android.mk
index b8320de..3887696 100644
--- a/utils/Android.mk
+++ b/utils/Android.mk
@@ -9,9 +9,11 @@ include $(CLEAR_VARS)
## Libs
LOCAL_SHARED_LIBRARIES := \
+ libdl \
libutils \
libcutils \
- liblog
+ liblog \
+ libprocessgroup
LOCAL_SRC_FILES += \
loc_log.cpp \
diff --git a/utils/Makefile.am b/utils/Makefile.am
index 33afc1b..50e1e9a 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -61,7 +61,7 @@ libgps_utils_la_LDFLAGS = -Wl,-z,defs -lpthread -shared -version-info 1:0:0
libgps_utils_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
endif
-libgps_utils_la_LIBADD = $(CUTILS_LIBS)
+libgps_utils_la_LIBADD = $(CUTILS_LIBS) -ldl
#Create and Install libraries
lib_LTLIBRARIES = libgps_utils.la
diff --git a/utils/loc_cfg.cpp b/utils/loc_cfg.cpp
index 3676bd5..8160cc1 100644
--- a/utils/loc_cfg.cpp
+++ b/utils/loc_cfg.cpp
@@ -58,6 +58,7 @@
static uint32_t DEBUG_LEVEL = 0xff;
static uint32_t TIMESTAMP = 0;
static uint32_t DATUM_TYPE = 0;
+static bool sVendorEnhanced = true;
/* Parameter spec table */
static const loc_param_s_type loc_param_table[] =
@@ -87,6 +88,13 @@ const char LOC_PATH_APDR_CONF[] = LOC_PATH_APDR_CONF_STR;
const char LOC_PATH_XTWIFI_CONF[] = LOC_PATH_XTWIFI_CONF_STR;
const char LOC_PATH_QUIPC_CONF[] = LOC_PATH_QUIPC_CONF_STR;
+bool isVendorEnhanced() {
+ return sVendorEnhanced;
+}
+void setVendorEnhanced(bool vendorEnhanced) {
+ sVendorEnhanced = vendorEnhanced;
+}
+
/*===========================================================================
FUNCTION loc_get_datum_type
@@ -487,6 +495,7 @@ typedef struct {
char feature_supl_wifi[LOC_MAX_PARAM_STRING];
char feature_wifi_supplicant_info[LOC_MAX_PARAM_STRING];
char auto_platform[LOC_MAX_PARAM_STRING];
+ unsigned int vendor_enhanced_process;
} loc_launcher_conf;
/* process configuration parameters */
@@ -509,15 +518,16 @@ static const loc_param_s_type loc_feature_conf_table[] = {
/* location process conf, e.g.: izat.conf Parameter spec table */
static const loc_param_s_type loc_process_conf_parameter_table[] = {
- {"PROCESS_NAME", &conf.proc_name, NULL, 's'},
- {"PROCESS_ARGUMENT", &conf.proc_argument, NULL, 's'},
- {"PROCESS_STATE", &conf.proc_status, NULL, 's'},
- {"PROCESS_GROUPS", &conf.group_list, NULL, 's'},
- {"PREMIUM_FEATURE", &conf.premium_feature, NULL, 'n'},
- {"IZAT_FEATURE_MASK", &conf.loc_feature_mask, NULL, 'n'},
- {"PLATFORMS", &conf.platform_list, NULL, 's'},
- {"BASEBAND", &conf.baseband, NULL, 's'},
- {"HARDWARE_TYPE", &conf.auto_platform, NULL, 's'},
+ {"PROCESS_NAME", &conf.proc_name, NULL, 's'},
+ {"PROCESS_ARGUMENT", &conf.proc_argument, NULL, 's'},
+ {"PROCESS_STATE", &conf.proc_status, NULL, 's'},
+ {"PROCESS_GROUPS", &conf.group_list, NULL, 's'},
+ {"PREMIUM_FEATURE", &conf.premium_feature, NULL, 'n'},
+ {"IZAT_FEATURE_MASK", &conf.loc_feature_mask, NULL, 'n'},
+ {"PLATFORMS", &conf.platform_list, NULL, 's'},
+ {"BASEBAND", &conf.baseband, NULL, 's'},
+ {"HARDWARE_TYPE", &conf.auto_platform, NULL, 's'},
+ {"VENDOR_ENHANCED_PROCESS", &conf.vendor_enhanced_process, NULL, 'n'},
};
/*===========================================================================
@@ -758,6 +768,13 @@ int loc_read_process_conf(const char* conf_file_name, uint32_t * process_count_p
continue;
}
+ if (!isVendorEnhanced() && (conf.vendor_enhanced_process != 0)) {
+ LOC_LOGD("%s:%d]: Process %s is disabled via vendor enhanced process check",
+ __func__, __LINE__, conf.proc_name);
+ child_proc[j].proc_status = DISABLED_VIA_VENDOR_ENHANCED_CHECK;
+ continue;
+ }
+
if(strcmp(conf.proc_status, "DISABLED") == 0) {
LOC_LOGD("%s:%d]: Process %s is disabled in conf file",
__func__, __LINE__, conf.proc_name);
@@ -871,7 +888,8 @@ int loc_read_process_conf(const char* conf_file_name, uint32_t * process_count_p
if((config_mask & CONFIG_MASK_TARGET_CHECK) &&
(config_mask & CONFIG_MASK_BASEBAND_CHECK) &&
(config_mask & CONFIG_MASK_AUTOPLATFORM_CHECK) &&
- (child_proc[j].proc_status != DISABLED_FROM_CONF)) {
+ (child_proc[j].proc_status != DISABLED_FROM_CONF) &&
+ (child_proc[j].proc_status != DISABLED_VIA_VENDOR_ENHANCED_CHECK)) {
//Set args
//The first argument passed through argv is usually the name of the
diff --git a/utils/loc_cfg.h b/utils/loc_cfg.h
index aa00148..5c77dc6 100644
--- a/utils/loc_cfg.h
+++ b/utils/loc_cfg.h
@@ -84,7 +84,8 @@ typedef enum {
ENABLED,
RUNNING,
DISABLED,
- DISABLED_FROM_CONF
+ DISABLED_FROM_CONF,
+ DISABLED_VIA_VENDOR_ENHANCED_CHECK
} loc_process_e_status;
typedef struct {
@@ -112,6 +113,8 @@ extern "C" {
* MODULE EXPORTED FUNCTIONS
*
*============================================================================*/
+bool isVendorEnhanced();
+void setVendorEnhanced(bool vendorEnhanced);
void loc_read_conf(const char* conf_file_name,
const loc_param_s_type* config_table,
uint32_t table_length);
diff --git a/utils/loc_misc_utils.cpp b/utils/loc_misc_utils.cpp
index b7c8406..70fdbc3 100644
--- a/utils/loc_misc_utils.cpp
+++ b/utils/loc_misc_utils.cpp
@@ -30,6 +30,7 @@
#define LOG_TAG "LocSvc_misc_utils"
#include <stdio.h>
#include <string.h>
+#include <dlfcn.h>
#include <log_util.h>
#include <loc_misc_utils.h>
#include <ctype.h>
@@ -112,3 +113,33 @@ void loc_util_trim_space(char *org_string)
err:
return;
}
+
+inline void logDlError(const char* failedCall) {
+ const char * err = dlerror();
+ LOC_LOGe("%s error: %s", failedCall, (nullptr == err) ? "unknown" : err);
+}
+
+void* dlGetSymFromLib(void*& libHandle, const char* libName, const char* symName)
+{
+ void* sym = nullptr;
+ if ((nullptr != libHandle || nullptr != libName) && nullptr != symName) {
+ if (nullptr == libHandle) {
+ libHandle = dlopen(libName, RTLD_NOW);
+ if (nullptr == libHandle) {
+ logDlError("dlopen");
+ }
+ }
+ // NOT else, as libHandle gets assigned 5 line above
+ if (nullptr != libHandle) {
+ sym = dlsym(libHandle, symName);
+ if (nullptr == sym) {
+ logDlError("dlsym");
+ }
+ }
+ } else {
+ LOC_LOGe("Either libHandle (%p) or libName (%p) must not be null; "
+ "symName (%p) can not be null.", libHandle, libName, symName);
+ }
+
+ return sym;
+}
diff --git a/utils/loc_misc_utils.h b/utils/loc_misc_utils.h
index 7d66d84..fad1b6d 100644
--- a/utils/loc_misc_utils.h
+++ b/utils/loc_misc_utils.h
@@ -92,6 +92,34 @@ SIDE EFFECTS
N/A
===========================================================================*/
void loc_util_trim_space(char *org_string);
+
+/*===========================================================================
+FUNCTION dlGetSymFromLib
+
+DESCRIPTION
+ Handy function to get a pointer to a symbol from a library.
+
+ If libHandle is not null, it will be used as the handle to the library. In
+ that case libName wll not be used;
+ libHandle is an in / out parameter.
+ If libHandle is null, libName will be used to dlopen.
+ Either libHandle or libName must not be nullptr.
+ symName must not be null.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ pointer to symName. Could be nullptr if
+ Parameters are incorrect; or
+ libName can not be opened; or
+ symName can not be found.
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+void* dlGetSymFromLib(void*& libHandle, const char* libName, const char* symName);
+
#ifdef __cplusplus
}
#endif