Update use of A-GPS modes in GpsLocationProvider
b/20664846
This change reflects the documentation changes made in gps.h for the
upcoming Android release.
Change-Id: Id3e04492febdabd42e91a12e221d1192947b8061
diff --git a/services/core/java/com/android/server/location/GpsLocationProvider.java b/services/core/java/com/android/server/location/GpsLocationProvider.java
index d3240ec..6bd646d 100644
--- a/services/core/java/com/android/server/location/GpsLocationProvider.java
+++ b/services/core/java/com/android/server/location/GpsLocationProvider.java
@@ -952,13 +952,18 @@
return GPS_POSITION_MODE_STANDALONE;
}
}
+ // MS-Based is the preferred mode for Assisted-GPS position computation, so we favor
+ // such mode when it is available
+ if (hasCapability(GPS_CAPABILITY_MSB) && (suplMode & AGPS_SUPL_MODE_MSB) != 0) {
+ return GPS_POSITION_MODE_MS_BASED;
+ }
+ // for now, just as the legacy code did, we fallback to MS-Assisted if it is available,
+ // do fallback only for single-shot requests, because it is too expensive to do for
+ // periodic requests as well
if (singleShot
&& hasCapability(GPS_CAPABILITY_MSA)
&& (suplMode & AGPS_SUPL_MODE_MSA) != 0) {
return GPS_POSITION_MODE_MS_ASSISTED;
- } else if (hasCapability(GPS_CAPABILITY_MSB)
- && (suplMode & AGPS_SUPL_MODE_MSB) != 0) {
- return GPS_POSITION_MODE_MS_BASED;
}
}
return GPS_POSITION_MODE_STANDALONE;