From 4b345c82acab9f25da05cb9c85b91ff65b3f3a8d Mon Sep 17 00:00:00 2001 From: Madhanraj Chelladurai Date: Thu, 17 Mar 2016 11:58:51 +0530 Subject: [PATCH] gps: include support to check hardware type property automotive platform introduced a new android property called ro.hardware.type to detect automotive platform for the purpose of having automotive specific features. Added changes in loc_target to detect auto platform. Change-Id: Ib886b96b2e95dafc151bead041e5fc3d6740c468 CRs-Fixed: 992647 --- utils/loc_target.cpp | 20 +++++++++++++++++++- utils/loc_target.h | 4 ++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/utils/loc_target.cpp b/utils/loc_target.cpp index faaedf6c..9985b89c 100644 --- a/utils/loc_target.cpp +++ b/utils/loc_target.cpp @@ -174,6 +174,20 @@ void loc_get_platform_name(char *platform_name, int array_length) } } +/*The character array passed to this function should have length + of atleast PROPERTY_VALUE_MAX*/ +void loc_get_auto_platform_name(char *platform_name, int array_length) +{ + if(platform_name && (array_length >= PROPERTY_VALUE_MAX)) { + property_get("ro.hardware.type", platform_name, ""); + LOC_LOGD("%s:%d]: Autoplatform name: %s\n", __func__, __LINE__, platform_name); + } + else { + LOC_LOGE("%s:%d]: Null parameter or array length less than PROPERTY_VALUE_MAX\n", + __func__, __LINE__); + } +} + unsigned int loc_get_target(void) { if (gTarget != (unsigned int)-1) @@ -190,6 +204,7 @@ unsigned int loc_get_target(void) char rd_id[LINE_LEN]; char rd_mdm[LINE_LEN]; char baseband[LINE_LEN]; + char rd_auto_platform[LINE_LEN]; if (is_qca1530()) { gTarget = TARGET_QCA1530; @@ -208,7 +223,10 @@ unsigned int loc_get_target(void) } else { read_a_line(id_dep, rd_id, LINE_LEN); } - if( !memcmp(baseband, STR_AUTO, LENGTH(STR_AUTO)) ) + + /*check automotive platform*/ + loc_get_auto_platform_name(rd_auto_platform, sizeof(rd_auto_platform)); + if( !memcmp(rd_auto_platform, STR_AUTO, LENGTH(STR_AUTO)) ) { gTarget = TARGET_AUTO; goto detected; diff --git a/utils/loc_target.h b/utils/loc_target.h index 3bb3b5e2..b76ed884 100644 --- a/utils/loc_target.h +++ b/utils/loc_target.h @@ -52,6 +52,10 @@ 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); +/*The character array passed to this function should have length + of atleast PROPERTY_VALUE_MAX*/ +void loc_get_auto_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