summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Anil Admal <aadmal@google.com> 2018-10-01 09:53:06 -0700
committer Anil Admal <aadmal@google.com> 2018-10-09 18:07:09 -0700
commit5cc7373ebf86629b02a7a7d16637a0e810a1f1c3 (patch)
treec06db14d40fd1124623eb5d8e1ad228d8a5c746c
parentd449ee6be2c4fa822799df0d8576b55811e40825 (diff)
Add back the SUPL network setup timeout.
The network request timeout functionality in the ConnectivityManager class was non functional. When it was addressed, the timeout that was in the GnssLocationProvider class was removed as it was referring to a constant in the ConnectivtyManager that was deleted. See b/35354391 for details. Fixes: 35354391 Test: Tested on a Pixel device using Android Q and GNSS Test App to clear AGPS aiding data and doing a get GPS location for the following scenarios: 1. Turned off mobile data connection but not WiFi. The cellular SUPL network request times out and GNSS HAL is notified of SUPL connection failure. GNSS HAL continues with XTRA only download through WiFi and completes the fix. 2. Turned off mobile data and WiFi connections. The cellular SUPL network request times out and GNSS HAL is notified of connection failure. GNSS HAL fails to download asssistance data through SUPL and XTRA and reports a fix after a long time (several minutes). 3. Both mobile and WiFi connections are on. GNSS HAL does does SUPL and XTRA requests and completes the fix. 4. Mobile data connection is on and WiFi connection is off. GNSS HAL does SUPL request and completes the fix. Change-Id: I6204c9a1b9aa4e55a91316ccc683051e847d826c
-rw-r--r--services/core/java/com/android/server/location/GnssLocationProvider.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/location/GnssLocationProvider.java b/services/core/java/com/android/server/location/GnssLocationProvider.java
index 31cf9e346195..53d54ba11e99 100644
--- a/services/core/java/com/android/server/location/GnssLocationProvider.java
+++ b/services/core/java/com/android/server/location/GnssLocationProvider.java
@@ -254,6 +254,9 @@ public class GnssLocationProvider implements LocationProviderInterface, InjectNt
private static final long LOCATION_UPDATE_MIN_TIME_INTERVAL_MILLIS = 1000;
// Default update duration in milliseconds for REQUEST_LOCATION.
private static final long LOCATION_UPDATE_DURATION_MILLIS = 10 * 1000;
+ // Default time limit in milliseconds for the ConnectivityManager to find a suitable
+ // network with SUPL connectivity or report an error.
+ private static final int SUPL_NETWORK_REQUEST_TIMEOUT_MILLIS = 10 * 1000;
/** simpler wrapper for ProviderRequest + Worksource */
private static class GpsRequest {
@@ -539,14 +542,23 @@ public class GnssLocationProvider implements LocationProviderInterface, InjectNt
new ConnectivityManager.NetworkCallback() {
@Override
public void onAvailable(Network network) {
+ if (DEBUG) Log.d(TAG, "SUPL network connection available.");
// Specific to a change to a SUPL enabled network becoming ready
sendMessage(UPDATE_NETWORK_STATE, 0 /*arg*/, network);
}
@Override
public void onLost(Network network) {
+ Log.i(TAG, "SUPL network connection lost.");
releaseSuplConnection(GPS_RELEASE_AGPS_DATA_CONN);
}
+
+ @Override
+ public void onUnavailable() {
+ Log.i(TAG, "SUPL network connection request timed out.");
+ // Could not setup the connection to the network in the specified time duration.
+ releaseSuplConnection(GPS_AGPS_DATA_CONN_FAILED);
+ }
};
private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
@@ -953,7 +965,8 @@ public class GnssLocationProvider implements LocationProviderInterface, InjectNt
NetworkRequest request = requestBuilder.build();
mConnMgr.requestNetwork(
request,
- mSuplConnectivityCallback);
+ mSuplConnectivityCallback,
+ SUPL_NETWORK_REQUEST_TIMEOUT_MILLIS);
}
private void handleReleaseSuplConnection(int agpsDataConnStatus) {
@@ -2796,4 +2809,3 @@ public class GnssLocationProvider implements LocationProviderInterface, InjectNt
private static native boolean native_set_satellite_blacklist(int[] constellations, int[] svIds);
}
-