diff --git a/utils/Android.mk b/utils/Android.mk index f34e1012..d672e3a1 100644 --- a/utils/Android.mk +++ b/utils/Android.mk @@ -19,7 +19,7 @@ LOCAL_SRC_FILES += \ linked_list.c \ loc_target.cpp \ loc_timer.c \ - ../platform_lib_abstractions/elapsed_millis_since_boot.cpp \ + platform_lib_abstractions/elapsed_millis_since_boot.cpp \ loc_misc_utils.cpp LOCAL_CFLAGS += \ @@ -34,7 +34,7 @@ LOCAL_LDFLAGS += -Wl,--export-dynamic ## Includes LOCAL_C_INCLUDES:= \ - $(LOCAL_PATH)/../platform_lib_abstractions + $(LOCAL_PATH)/platform_lib_abstractions LOCAL_COPY_HEADERS_TO:= gps.utils/ LOCAL_COPY_HEADERS:= \ @@ -45,9 +45,9 @@ LOCAL_COPY_HEADERS:= \ msg_q.h \ loc_target.h \ loc_timer.h \ - ../platform_lib_abstractions/platform_lib_includes.h \ - ../platform_lib_abstractions/platform_lib_time.h \ - ../platform_lib_abstractions/platform_lib_macros.h \ + platform_lib_abstractions/platform_lib_includes.h \ + platform_lib_abstractions/platform_lib_time.h \ + platform_lib_abstractions/platform_lib_macros.h \ loc_misc_utils.h LOCAL_MODULE := libgps.utils diff --git a/utils/loc_cfg.cpp b/utils/loc_cfg.cpp index 404f3ed2..7ffe6a43 100644 --- a/utils/loc_cfg.cpp +++ b/utils/loc_cfg.cpp @@ -329,9 +329,14 @@ int loc_update_conf(const char* conf_data, int32_t length, if (conf_data && length && config_table && table_length) { // make a copy, so we do not tokenize the original data char* conf_copy = (char*)malloc(length+1); - memcpy(conf_copy, conf_data, length); - // we hard NULL the end of string to be safe - conf_copy[length] = 0; + + if(conf_copy !=NULL) + { + memcpy(conf_copy, conf_data, length); + // we hard NULL the end of string to be safe + conf_copy[length] = 0; + } + // start with one record off uint32_t num_params = table_length - 1; char* saveptr = NULL; diff --git a/utils/loc_target.cpp b/utils/loc_target.cpp index 080e5768..08f5584d 100644 --- a/utils/loc_target.cpp +++ b/utils/loc_target.cpp @@ -46,7 +46,6 @@ #define MSM8930_ID_2 "116" #define APQ8030_ID_1 "157" #define APQ8074_ID_1 "184" -#define PDS_ID_1 "178" #define LINE_LEN 100 #define STR_LIQUID "Liquid" @@ -213,12 +212,8 @@ unsigned int loc_get_target(void) gTarget = TARGET_AUTO; goto detected; } - if( !memcmp(rd_hw_platform, STR_MTP, LENGTH(STR_MTP)) ){ - if( !memcmp(rd_id, PDS_ID_1, LENGTH(PDS_ID_1)) - && IS_STR_END(rd_id[LENGTH(PDS_ID_1)]) ) - gTarget = TARGET_PDS; - } - else if( !memcmp(baseband, STR_APQ, LENGTH(STR_APQ)) ){ + if( !memcmp(baseband, STR_APQ, LENGTH(STR_APQ)) ){ + if( !memcmp(rd_id, MPQ8064_ID_1, LENGTH(MPQ8064_ID_1)) && IS_STR_END(rd_id[LENGTH(MPQ8064_ID_1)]) ) gTarget = TARGET_MPQ; @@ -249,3 +244,17 @@ detected: LOC_LOGD("HAL: %s returned %d", __FUNCTION__, gTarget); return gTarget; } + +/*Reads the property ro.lean to identify if this is a lean target + Returns: + 0 if not a lean and mean target + 1 if this is a lean and mean target +*/ +int loc_identify_lean_target() +{ + int ret = 0; + char lean_target[PROPERTY_VALUE_MAX]; + property_get("ro.lean", lean_target, ""); + LOC_LOGD("%s:%d]: lean target: %s\n", __func__, __LINE__, lean_target); + return !(strncmp(lean_target, "true", PROPERTY_VALUE_MAX)); +} diff --git a/utils/loc_target.h b/utils/loc_target.h index d7364e91..3bb3b5e2 100644 --- a/utils/loc_target.h +++ b/utils/loc_target.h @@ -35,7 +35,6 @@ #define TARGET_MPQ TARGET_SET(GNSS_NONE,NO_SSC) #define TARGET_MSM_NO_SSC TARGET_SET(GNSS_MSM, NO_SSC) #define TARGET_QCA1530 TARGET_SET(GNSS_QCA1530, NO_SSC) -#define TARGET_PDS TARGET_SET(GNSS_PDS, NO_SSC) #define TARGET_AUTO TARGET_SET(GNSS_AUTO, NO_SSC) #define TARGET_UNKNOWN TARGET_SET(GNSS_UNKNOWN, NO_SSC) #define getTargetGnssType(target) (target>>1) @@ -53,6 +52,11 @@ void loc_get_target_baseband(char *baseband, int array_length); /*The character array passed to this function should have length of atleast PROPERTY_VALUE_MAX*/ void loc_get_platform_name(char *platform_name, int array_length); +/*Reads the property ro.lean to identify if this is a lean target + Returns: + 0 if not a lean and mean target + 1 if this is a lean and mean target*/ +int loc_identify_lean_target(); /* Please remember to update 'target_name' in loc_log.cpp, if do any changes to this enum. */ @@ -62,7 +66,6 @@ typedef enum { GNSS_GSS, GNSS_MDM, GNSS_QCA1530, - GNSS_PDS, GNSS_AUTO, GNSS_UNKNOWN }GNSS_TARGET; diff --git a/platform_lib_abstractions/elapsed_millis_since_boot.cpp b/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp similarity index 100% rename from platform_lib_abstractions/elapsed_millis_since_boot.cpp rename to utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp diff --git a/platform_lib_abstractions/platform_lib_includes.h b/utils/platform_lib_abstractions/platform_lib_includes.h similarity index 100% rename from platform_lib_abstractions/platform_lib_includes.h rename to utils/platform_lib_abstractions/platform_lib_includes.h diff --git a/platform_lib_abstractions/platform_lib_macros.h b/utils/platform_lib_abstractions/platform_lib_macros.h similarity index 100% rename from platform_lib_abstractions/platform_lib_macros.h rename to utils/platform_lib_abstractions/platform_lib_macros.h diff --git a/platform_lib_abstractions/platform_lib_time.h b/utils/platform_lib_abstractions/platform_lib_time.h similarity index 100% rename from platform_lib_abstractions/platform_lib_time.h rename to utils/platform_lib_abstractions/platform_lib_time.h