diff options
author | Mike Cailean <mcailean@codeaurora.org> | 2018-09-25 17:13:46 -0700 |
---|---|---|
committer | Edwin Tung <edwintung@google.com> | 2018-10-04 15:56:14 +0800 |
commit | aca62c78f95d6800218c141b9b92aa8b32afc96a (patch) | |
tree | b9b2aa0d37e8e6bb35336956990ae1dc8452d14f | |
parent | 3c941518e307d96bc970144def838c9f2b0e1598 (diff) | |
download | gps-aca62c78f95d6800218c141b9b92aa8b32afc96a.tar.gz |
Set SV in use mask based on final fixesandroid-9.0.0_r47android-9.0.0_r46android-9.0.0_r45android-9.0.0_r44android-9.0.0_r43android-9.0.0_r42android-9.0.0_r41android-9.0.0_r40android-9.0.0_r37android-9.0.0_r36pie-qpr3-s1-releasepie-qpr3-releasepie-qpr3-b-releasepie-b4s4-dev
Do not set SV in use mask based on intermediate
position update from modem since it might contain
stale information. Reset the flag indicating SV
are used in fix for intermediate fixes.
Bug: 116682778
Test: CTS GnssMeasurementValuesTest pass
Change-Id: Iba5a37ec84f772208e473cc69dc35f07265f1444
-rw-r--r-- | msm8998/core/LocApiBase.cpp | 29 | ||||
-rw-r--r-- | msm8998/core/LocApiBase.h | 3 | ||||
-rw-r--r-- | msm8998/gnss/GnssAdapter.cpp | 41 | ||||
-rw-r--r-- | msm8998/gnss/GnssAdapter.h | 2 |
4 files changed, 48 insertions, 27 deletions
diff --git a/msm8998/core/LocApiBase.cpp b/msm8998/core/LocApiBase.cpp index 7e2ea25..019f44e 100644 --- a/msm8998/core/LocApiBase.cpp +++ b/msm8998/core/LocApiBase.cpp @@ -157,6 +157,35 @@ bool LocApiBase::isInSession() return inSession; } +bool LocApiBase::needReport(const UlpLocation& ulpLocation, + enum loc_sess_status status, + LocPosTechMask techMask) +{ + bool reported = false; + + if (LOC_SESS_SUCCESS == status) { + // this is a final fix + LocPosTechMask mask = + LOC_POS_TECH_MASK_SATELLITE | LOC_POS_TECH_MASK_SENSORS | LOC_POS_TECH_MASK_HYBRID; + // it is a Satellite fix or a sensor fix + reported = (mask & techMask); + } + else if (LOC_SESS_INTERMEDIATE == status && + LOC_SESS_INTERMEDIATE == ContextBase::mGps_conf.INTERMEDIATE_POS) { + // this is a intermediate fix and we accept intermediate + + // it is NOT the case that + // there is inaccuracy; and + // we care about inaccuracy; and + // the inaccuracy exceeds our tolerance + reported = !((ulpLocation.gpsLocation.flags & LOC_GPS_LOCATION_HAS_ACCURACY) && + (ContextBase::mGps_conf.ACCURACY_THRES != 0) && + (ulpLocation.gpsLocation.accuracy > ContextBase::mGps_conf.ACCURACY_THRES)); + } + + return reported; +} + void LocApiBase::addAdapter(LocAdapterBase* adapter) { for (int i = 0; i < MAX_ADAPTERS && mLocAdapters[i] != adapter; i++) { diff --git a/msm8998/core/LocApiBase.h b/msm8998/core/LocApiBase.h index 86610e7..d714ad9 100644 --- a/msm8998/core/LocApiBase.h +++ b/msm8998/core/LocApiBase.h @@ -103,6 +103,9 @@ public: inline void sendMsg(const LocMsg* msg) const { mMsgTask->sendMsg(msg); } + static bool needReport(const UlpLocation& ulpLocation, + enum loc_sess_status status, + LocPosTechMask techMask); void addAdapter(LocAdapterBase* adapter); void removeAdapter(LocAdapterBase* adapter); diff --git a/msm8998/gnss/GnssAdapter.cpp b/msm8998/gnss/GnssAdapter.cpp index 1896108..fadf350 100644 --- a/msm8998/gnss/GnssAdapter.cpp +++ b/msm8998/gnss/GnssAdapter.cpp @@ -1843,38 +1843,30 @@ GnssAdapter::reportPositionEvent(const UlpLocation& ulpLocation, sendMsg(new MsgReportPosition(*this, ulpLocation, locationExtended, status, techMask)); } +bool +GnssAdapter::needReport(const UlpLocation& ulpLocation, + enum loc_sess_status status, + LocPosTechMask techMask) { + bool reported = false; + + reported = LocApiBase::needReport(ulpLocation, status, techMask); + return reported; +} + void GnssAdapter::reportPosition(const UlpLocation& ulpLocation, const GpsLocationExtended& locationExtended, enum loc_sess_status status, LocPosTechMask techMask) { - bool reported = false; - // what's in the if is... (line by line) - // 1. this is a final fix; and - // 1.1 it is a Satellite fix; or - // 1.2 it is a sensor fix - // 2. (must be intermediate fix... implicit) - // 2.1 we accepte intermediate; and - // 2.2 it is NOT the case that - // 2.2.1 there is inaccuracy; and - // 2.2.2 we care about inaccuracy; and - // 2.2.3 the inaccuracy exceeds our tolerance - if ((LOC_SESS_SUCCESS == status && - ((LOC_POS_TECH_MASK_SATELLITE | - LOC_POS_TECH_MASK_SENSORS | - LOC_POS_TECH_MASK_HYBRID) & - techMask)) || - (LOC_SESS_INTERMEDIATE == ContextBase::mGps_conf.INTERMEDIATE_POS && - !((ulpLocation.gpsLocation.flags & - LOC_GPS_LOCATION_HAS_ACCURACY) && - (ContextBase::mGps_conf.ACCURACY_THRES != 0) && - (ulpLocation.gpsLocation.accuracy > - ContextBase::mGps_conf.ACCURACY_THRES)))) { + bool reported = needReport(ulpLocation, status, techMask); + mGnssSvIdUsedInPosAvail = false; + if (reported) { if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_GNSS_SV_USED_DATA) { mGnssSvIdUsedInPosAvail = true; mGnssSvIdUsedInPosition = locationExtended.gnss_sv_used_ids; } + for (auto it=mClientData.begin(); it != mClientData.end(); ++it) { if (nullptr != it->second.trackingCb) { Location location = {}; @@ -1887,11 +1879,6 @@ GnssAdapter::reportPosition(const UlpLocation& ulpLocation, it->second.gnssLocationInfoCb(locationInfo); } } - reported = true; - } else { - LOC_LOGI("%s: not reported. Status: %d, techMask: %d, flags %d, accuracy %f", - __func__, (int)status, (int)techMask, (int)ulpLocation.gpsLocation.flags, - (float)ulpLocation.gpsLocation.accuracy); } if (NMEA_PROVIDER_AP == ContextBase::mGps_conf.NMEA_PROVIDER && !mTrackingSessions.empty()) { diff --git a/msm8998/gnss/GnssAdapter.h b/msm8998/gnss/GnssAdapter.h index e8cebd5..81f14e2 100644 --- a/msm8998/gnss/GnssAdapter.h +++ b/msm8998/gnss/GnssAdapter.h @@ -227,6 +227,8 @@ public: virtual bool reportDataCallClosed(); /* ======== UTILITIES ================================================================= */ + bool needReport(const UlpLocation& ulpLocation, + enum loc_sess_status status, LocPosTechMask techMask); void reportPosition(const UlpLocation &ulpLocation, const GpsLocationExtended &locationExtended, enum loc_sess_status status, |