summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-10-10 03:04:27 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-10-10 03:04:27 +0000
commitdd6c5546adc4715854182358c2dd68691434efe9 (patch)
treeb9b2aa0d37e8e6bb35336956990ae1dc8452d14f
parent5ae953efca3b1ca49476e6163c809ccad46d1cfe (diff)
parentaca62c78f95d6800218c141b9b92aa8b32afc96a (diff)
downloadgps-dd6c5546adc4715854182358c2dd68691434efe9.tar.gz
Snap for 5058880 from aca62c78f95d6800218c141b9b92aa8b32afc96a to pi-qpr2-releaseandroid-9.0.0_r35android-9.0.0_r34android-9.0.0_r33android-9.0.0_r32android-9.0.0_r31pie-qpr2-release
Change-Id: If1e6bb5aebfa22ed6031ed2af6b018e4075b4a90
-rw-r--r--msm8998/core/LocApiBase.cpp29
-rw-r--r--msm8998/core/LocApiBase.h3
-rw-r--r--msm8998/gnss/GnssAdapter.cpp41
-rw-r--r--msm8998/gnss/GnssAdapter.h2
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,