diff --git a/gps/Android.bp b/gps/Android.bp index 3c36073..e0fba1f 100644 --- a/gps/Android.bp +++ b/gps/Android.bp @@ -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", diff --git a/gps/Android.mk b/gps/Android.mk index 4f20907..f020087 100644 --- a/gps/Android.mk +++ b/gps/Android.mk @@ -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 \ diff --git a/gps/android/aidl-impl/Android.mk b/gps/android/aidl-impl/Android.mk index b7364ce..5bfce5b 100644 --- a/gps/android/aidl-impl/Android.mk +++ b/gps/android/aidl-impl/Android.mk @@ -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 \ diff --git a/gps/android/aidl-impl/GnssConfiguration.cpp b/gps/android/aidl-impl/GnssConfiguration.cpp index 1051848..d30afc0 100644 --- a/gps/android/aidl-impl/GnssConfiguration.cpp +++ b/gps/android/aidl-impl/GnssConfiguration.cpp @@ -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; } diff --git a/gps/android/aidl-impl/GnssMeasurementInterface.cpp b/gps/android/aidl-impl/GnssMeasurementInterface.cpp index c3379b8..e353c58 100644 --- a/gps/android/aidl-impl/GnssMeasurementInterface.cpp +++ b/gps/android/aidl-impl/GnssMeasurementInterface.cpp @@ -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); } diff --git a/gps/android/aidl-impl/location_api/GnssAPIClient.cpp b/gps/android/aidl-impl/location_api/GnssAPIClient.cpp index b9d9b10..3156740 100644 --- a/gps/android/aidl-impl/location_api/GnssAPIClient.cpp +++ b/gps/android/aidl-impl/location_api/GnssAPIClient.cpp @@ -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(); diff --git a/gps/core/data-items/DataItemConcreteTypes.cpp b/gps/core/data-items/DataItemConcreteTypes.cpp index 2a22efc..3ca7945 100644 --- a/gps/core/data-items/DataItemConcreteTypes.cpp +++ b/gps/core/data-items/DataItemConcreteTypes.cpp @@ -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); } diff --git a/gps/geofence/GeofenceAdapter.cpp b/gps/geofence/GeofenceAdapter.cpp index ed5fd0d..2eaf155 100644 --- a/gps/geofence/GeofenceAdapter.cpp +++ b/gps/geofence/GeofenceAdapter.cpp @@ -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; diff --git a/gps/gnss/GnssAdapter.cpp b/gps/gnss/GnssAdapter.cpp index d07f5d9..5b67511 100644 --- a/gps/gnss/GnssAdapter.cpp +++ b/gps/gnss/GnssAdapter.cpp @@ -1157,7 +1157,6 @@ GnssAdapter::setConfig() std::vector 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 errsList = {err}; diff --git a/gps/gnss/NativeAgpsHandler.cpp b/gps/gnss/NativeAgpsHandler.cpp index 5dd0317..822b957 100644 --- a/gps/gnss/NativeAgpsHandler.cpp +++ b/gps/gnss/NativeAgpsHandler.cpp @@ -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 @@ -50,7 +87,6 @@ void NativeAgpsHandler::notify(const unordered_set& dlist) { case NETWORKINFO_DATA_ITEM_ID: { NetworkInfoDataItem* networkInfo = static_cast(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 diff --git a/gps/gnss/location_gnss.cpp b/gps/gnss/location_gnss.cpp index 7ff03f5..2a40c6b 100644 --- a/gps/gnss/location_gnss.cpp +++ b/gps/gnss/location_gnss.cpp @@ -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); diff --git a/gps/location/LocationAPI.cpp b/gps/location/LocationAPI.cpp index ca51182..2157acd 100644 --- a/gps/location/LocationAPI.cpp +++ b/gps/location/LocationAPI.cpp @@ -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 || diff --git a/gps/utils/loc_cfg.cpp b/gps/utils/loc_cfg.cpp index 699a475..bb09ed4 100644 --- a/gps/utils/loc_cfg.cpp +++ b/gps/utils/loc_cfg.cpp @@ -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] = "--"; diff --git a/gps/utils/loc_log.cpp b/gps/utils/loc_log.cpp index 17beca5..b9ecd1b 100644 --- a/gps/utils/loc_log.cpp +++ b/gps/utils/loc_log.cpp @@ -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", diff --git a/gps/utils/loc_misc_utils.cpp b/gps/utils/loc_misc_utils.cpp index 916e5f7..806c6be 100644 --- a/gps/utils/loc_misc_utils.cpp +++ b/gps/utils/loc_misc_utils.cpp @@ -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)); diff --git a/gps/utils/loc_target.cpp b/gps/utils/loc_target.cpp index 19122b6..ef03f15 100644 --- a/gps/utils/loc_target.cpp +++ b/gps/utils/loc_target.cpp @@ -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 #include #include @@ -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);