Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eaa98b52 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add back the SUPL network setup timeout."

parents 02f5329c 5cc7373e
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -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);
}