FR 45623 - Adding TBM Threshold
Adding a threshold for time between
measurements tracking option and
falling back to power mode M2
Change-Id: I9c2fef3016af233b24da710acdab2cf62bc2f375
CRs-Fixed: 2221797
diff --git a/sdm845/android/Gnss.cpp b/sdm845/android/Gnss.cpp
index 5626eec..895cb0e 100644
--- a/sdm845/android/Gnss.cpp
+++ b/sdm845/android/Gnss.cpp
@@ -396,7 +396,7 @@
GnssAPIClient* api = getApi();
if (api) {
GnssPowerMode powerMode = lowPowerMode?
- GNSS_POWER_MODE_M3 : GNSS_POWER_MODE_M2;
+ GNSS_POWER_MODE_M4 : GNSS_POWER_MODE_M2;
retVal = api->gnssSetPositionMode(mode, recurrence, minIntervalMs,
preferredAccuracyMeters, preferredTimeMs, powerMode);
}
diff --git a/sdm845/gnss/GnssAdapter.cpp b/sdm845/gnss/GnssAdapter.cpp
index 6d3052f..37c70eb 100644
--- a/sdm845/gnss/GnssAdapter.cpp
+++ b/sdm845/gnss/GnssAdapter.cpp
@@ -2017,6 +2017,13 @@
LOC_LOGv("Ignoring power mode, feature not supported.");
mTrackingOptions.powerMode = GNSS_POWER_MODE_INVALID;
}
+ if (mApi.isFeatureSupported(LOC_SUPPORTED_FEATURE_AGPM_V02) &&
+ GNSS_POWER_MODE_M4 == mTrackingOptions.powerMode &&
+ mTrackingOptions.tbm > TRACKING_TBM_THRESHOLD_MILLIS) {
+ LOC_LOGd("TBM (%d) > %d Falling back to M2 power mode",
+ mTrackingOptions.tbm, TRACKING_TBM_THRESHOLD_MILLIS);
+ mTrackingOptions.powerMode = GNSS_POWER_MODE_M2;
+ }
// Api doesn't support multiple clients for time based tracking, so mutiplex
err = mAdapter.startTrackingMultiplex(mTrackingOptions);
if (LOCATION_ERROR_SUCCESS == err) {
@@ -2181,6 +2188,13 @@
LOC_LOGv("Ignoring power mode, feature not supported.");
mTrackingOptions.powerMode = GNSS_POWER_MODE_INVALID;
}
+ if (mApi.isFeatureSupported(LOC_SUPPORTED_FEATURE_AGPM_V02) &&
+ GNSS_POWER_MODE_M4 == mTrackingOptions.powerMode &&
+ mTrackingOptions.tbm > TRACKING_TBM_THRESHOLD_MILLIS) {
+ LOC_LOGd("TBM (%d) > %d Falling back to M2 power mode",
+ mTrackingOptions.tbm, TRACKING_TBM_THRESHOLD_MILLIS);
+ mTrackingOptions.powerMode = GNSS_POWER_MODE_M2;
+ }
// Api doesn't support multiple clients for time based tracking, so mutiplex
err = mAdapter.updateTrackingMultiplex(
mClient, mSessionId, mTrackingOptions);
diff --git a/sdm845/location/LocationAPI.h b/sdm845/location/LocationAPI.h
index 25e8914..5a2b2b3 100644
--- a/sdm845/location/LocationAPI.h
+++ b/sdm845/location/LocationAPI.h
@@ -476,7 +476,7 @@
struct TrackingOptions : LocationOptions {
GnssPowerMode powerMode; /* Power Mode to be used for time based tracking
sessions */
- uint32_t tbm; /* Time interval between measurements.
+ uint32_t tbm; /* Time interval between measurements specified in millis.
Applicable to background power modes */
inline TrackingOptions() :
diff --git a/sdm845/utils/gps_extended_c.h b/sdm845/utils/gps_extended_c.h
index 49ba802..01f469d 100644
--- a/sdm845/utils/gps_extended_c.h
+++ b/sdm845/utils/gps_extended_c.h
@@ -95,6 +95,9 @@
#define LOC_AGPS_CERTIFICATE_MAX_LENGTH 2000
#define LOC_AGPS_CERTIFICATE_MAX_SLOTS 10
+/* TBM Threshold for tracking in background power mode : in millis */
+#define TRACKING_TBM_THRESHOLD_MILLIS 480000
+
typedef uint32_t LocPosTechMask;
#define LOC_POS_TECH_MASK_DEFAULT ((LocPosTechMask)0x00000000)
#define LOC_POS_TECH_MASK_SATELLITE ((LocPosTechMask)0x00000001)