sm8450-common: gps: HAL: Location compilation bringup for wearables

Enable few more important compilation flags which will consider
warnings as errors. Most of these flags were configured to be
only warning for mobile SPs, but for wearable SPs some of them
are configured to be errors. So configure these as in common
GNSS flags so that same set of flags could be applied to mobile
SPs too.
Fix compilation errors which were showing up, when these flags
were enabled.

Change-Id: I62ef74419d4416252dfc8b25251ba3a51d522bfd
CRs-Fixed: 3292623
This commit is contained in:
Vamana Murthi
2022-09-09 23:31:05 +05:30
committed by Arian
parent 8ab15e722f
commit cd7a05c656
16 changed files with 110 additions and 29 deletions

View File

@@ -1,5 +1,12 @@
GNSS_CFLAGS = [
"-Werror",
"-Wformat",
"-Wformat-extra-args",
"-Wunused-label",
"-Wunused-variable",
"-Wunused-function",
"-Wimplicit-fallthrough",
"-Wno-unused-parameter",
"-Wno-error=unused-parameter",
"-Wno-error=macro-redefined",
"-Wno-error=reorder",

View File

@@ -3,6 +3,13 @@ ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
# Set required flags
GNSS_CFLAGS := \
-Werror \
-Wformat \
-Wformat-extra-args \
-Wunused-label \
-Wunused-variable \
-Wunused-function \
-Wimplicit-fallthrough \
-Wno-unused-parameter \
-Wno-error=unused-parameter \
-Wno-error=macro-redefined \
-Wno-error=reorder \

View File

@@ -29,13 +29,18 @@ LOCAL_SHARED_LIBRARIES := \
android.hardware.gnss-V1-ndk \
liblog \
libcutils \
libqti_vndfwk_detect_vendor \
libutils \
libloc_core \
libgps.utils \
libdl \
liblocation_api
ifneq ($(TARGET_SUPPORTS_WEARABLES),true)
LOCAL_SHARED_LIBRARIES += libqti_vndfwk_detect_vendor
else
LOCAL_SHARED_LIBRARIES += libqti_vndfwk_detect
endif
LOCAL_CFLAGS += $(GNSS_CFLAGS)
include $(BUILD_SHARED_LIBRARY)
@@ -65,9 +70,14 @@ LOCAL_SHARED_LIBRARIES := \
libutils \
libgps.utils \
liblocation_api \
libqti_vndfwk_detect_vendor \
libbinder_ndk
ifneq ($(TARGET_SUPPORTS_WEARABLES),true)
LOCAL_SHARED_LIBRARIES += libqti_vndfwk_detect_vendor
else
LOCAL_SHARED_LIBRARIES += libqti_vndfwk_detect
endif
LOCAL_SHARED_LIBRARIES += \
libhidlbase \
android.hardware.gnss@1.0 \

View File

@@ -255,7 +255,7 @@ bool GnssConfiguration::setBlocklistedSource(GnssSvIdSource& copyToSource,
break;
default:
copyToSource.constellation = GNSS_SV_TYPE_UNKNOWN;
LOC_LOGe("Invalid constellation %hhu", copyFromSource.constellation);
LOC_LOGe("Invalid constellation %d", copyFromSource.constellation);
retVal = false;
break;
}

View File

@@ -538,7 +538,7 @@ void GnssMeasurementInterface::convertElapsedRealtimeNanos(
elapsedRealtime.flags |= elapsedRealtime.HAS_TIME_UNCERTAINTY_NS;
elapsedRealtime.timeUncertaintyNs = in.clock.elapsedRealTimeUnc;
LOC_LOGd("elapsedRealtime.timestampNs=%" PRIi64 ""
" elapsedRealtime.timeUncertaintyNs=%" PRIi64 " elapsedRealtime.flags=0x%X",
" elapsedRealtime.timeUncertaintyNs=%lf elapsedRealtime.flags=0x%X",
elapsedRealtime.timestampNs,
elapsedRealtime.timeUncertaintyNs, elapsedRealtime.flags);
}

View File

@@ -145,7 +145,7 @@ void GnssAPIClient::gnssConfigurationUpdate(const GnssConfig& gnssConfig) {
// callbacks
void GnssAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask) {
LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
LOC_LOGD("%s]: (0x%" PRIx64 ")", __FUNCTION__, capabilitiesMask);
mLocationCapabilitiesMask = capabilitiesMask;
mLocationCapabilitiesCached = true;
mMutex.lock();

View File

@@ -237,7 +237,9 @@ void TimeZoneChangeDataItem::stringify(string& valueStr) {
valueStr.clear ();
valueStr = TIMEZONECHANGE_FIELD_ENABLED;
valueStr += ": ";
valueStr += "true";
char time [30];
snprintf (time, 30, "%" PRIi64, d->mCurrTimeMillis);
valueStr += string (time);
} while (0);
EXIT_LOG_WITH_ERROR("%d", result);
}
@@ -249,7 +251,9 @@ void TimeChangeDataItem::stringify(string& valueStr) {
valueStr.clear ();
valueStr = TIMECHANGE_FIELD_ENABLED;
valueStr += ": ";
valueStr += "true";
char time [30];
snprintf (time, 30, "%" PRIi64, d->mCurrTimeMillis);
valueStr += string (time);
} while (0);
EXIT_LOG_WITH_ERROR("%d", result);
}

View File

@@ -919,8 +919,6 @@ GeofenceAdapter::updateSystemPowerStateCommand(PowerStateType powerState)
void
GeofenceAdapter::pauseOrResumeGeofences(bool pauseOrResume /*false - pause, true - resume*/)
{
LocationError error;
for (auto it = mGeofenceIds.begin(); it != mGeofenceIds.end(); ++it) {
uint32_t hwId = it->second;

View File

@@ -1157,7 +1157,6 @@ GnssAdapter::setConfig()
std::vector<LocationError> GnssAdapter::gnssUpdateConfig(const std::string& oldMoServerUrl,
const std::string& moServerUrl, const std::string& serverUrl,
GnssConfig& gnssConfigRequested, GnssConfig& gnssConfigNeedEngineUpdate, size_t count) {
loc_gps_cfg_s gpsConf = ContextBase::mGps_conf;
size_t index = 0;
LocationError err = LOCATION_ERROR_SUCCESS;
std::vector<LocationError> errsList = {err};

View File

@@ -26,6 +26,43 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/*
Changes from Qualcomm Innovation Center are provided under the following license:
Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted (subject to the limitations in the
disclaimer below) provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#define LOG_TAG "LocSvc_NativeAgpsHandler"
#include <LocAdapterBase.h>
@@ -50,7 +87,6 @@ void NativeAgpsHandler::notify(const unordered_set<IDataItemCore*>& dlist) {
case NETWORKINFO_DATA_ITEM_ID: {
NetworkInfoDataItem* networkInfo = static_cast<NetworkInfoDataItem*>(each);
uint64_t mobileBit = (uint64_t )1 << loc_core::TYPE_MOBILE;
uint64_t allTypes = networkInfo->mAllTypes;
mConnected = ((networkInfo->mAllTypes & mobileBit) == mobileBit);
/**
* mApn Telephony preferred Access Point Name to use for

View File

@@ -87,7 +87,6 @@ static uint32_t setConstrainedTunc (bool enable, float tuncConstraint,
static uint32_t setPositionAssistedClockEstimator(bool enable);
static uint32_t gnssUpdateSvConfig(const GnssSvTypeConfig& constellationEnablementConfig,
const GnssSvIdConfig& blacklistSvConfig);
static uint32_t gnssResetSvConfig();
static uint32_t configLeverArm(const LeverArmConfigInfo& configInfo);
static uint32_t configRobustLocation(bool enable, bool enableForE911);
static uint32_t configMinGpsWeek(uint16_t minGpsWeek);

View File

@@ -131,17 +131,6 @@ static void loadLibGeofencing() {
}
}
static bool needsGnssTrackingInfo(LocationCallbacks& locationCallbacks)
{
return (locationCallbacks.gnssLocationInfoCb != nullptr ||
locationCallbacks.engineLocationsInfoCb != nullptr ||
locationCallbacks.gnssSvCb != nullptr ||
locationCallbacks.gnssNmeaCb != nullptr ||
locationCallbacks.gnssDataCb != nullptr ||
locationCallbacks.gnssMeasurementsCb != nullptr ||
locationCallbacks.gnssNHzMeasurementsCb != nullptr);
}
static bool isGnssClient(LocationCallbacks& locationCallbacks)
{
return (locationCallbacks.gnssNiCb != nullptr ||

View File

@@ -584,11 +584,10 @@ int loc_read_process_conf(const char* conf_file_name, uint32_t * process_count_p
loc_process_info_s_type *child_proc = nullptr;
volatile int i=0;
unsigned int j=0;
gid_t gid_list[LOC_PROCESS_MAX_NUM_GROUPS];
char *split_strings[MAX_NUM_STRINGS];
int name_length=0, group_list_length=0, platform_length=0, baseband_length=0, ngroups=0, ret=0;
int auto_platform_length = 0, soc_id_list_length=0;
int group_index=0, nstrings=0, status_length=0;
int nstrings=0, status_length=0;
FILE* conf_fp = nullptr;
char platform_name[PROPERTY_VALUE_MAX], baseband_name[PROPERTY_VALUE_MAX];
int low_ram_target=0;
@@ -596,7 +595,6 @@ int loc_read_process_conf(const char* conf_file_name, uint32_t * process_count_p
unsigned int loc_service_mask=0;
unsigned char config_mask = 0;
unsigned char proc_list_length=0;
int gtp_cell_ap_enabled = 0;
char arg_gtp_waa[LOC_PROCESS_MAX_ARG_STR_LENGTH] = "--";
char arg_gtp_modem_cell[LOC_PROCESS_MAX_ARG_STR_LENGTH] = "--";
char arg_gtp_wifi[LOC_PROCESS_MAX_ARG_STR_LENGTH] = "--";

View File

@@ -141,7 +141,6 @@ RETURN VALUE
===========================================================================*/
const char *loc_get_target_name(unsigned int target)
{
int64_t index = 0;
static char ret[BUFFER_SIZE];
snprintf(ret, sizeof(ret), " %s with%s SSC",

View File

@@ -175,7 +175,7 @@ uint64_t getQTimerDeltaNanos()
char qtimer_val_string[100];
char *temp;
uint64_t local_qtimer = 0, remote_qtimer = 0;
int mdm_fd = -1, wlan_fd = -1, ret = 0;
int mdm_fd = -1, ret = 0;
uint64_t delta = 0;
memset(qtimer_val_string, '\0', sizeof(qtimer_val_string));

View File

@@ -27,6 +27,42 @@
*
*/
/*
Changes from Qualcomm Innovation Center are provided under the following license:
Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted (subject to the limitations in the
disclaimer below) provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -142,7 +178,6 @@ void loc_get_auto_platform_name(char *platform_name, int array_length)
*/
int loc_identify_low_ram_target()
{
int ret = 0;
char low_ram_target[PROPERTY_VALUE_MAX];
property_get("ro.config.low_ram", low_ram_target, "");
LOC_LOGd("low ram target: %s\n", low_ram_target);