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

Commit e406900f authored by Daniel Estrada Alva's avatar Daniel Estrada Alva Committed by Android (Google) Code Review
Browse files

Merge "Add timeout for XTRA data connection. b/22540683"

parents 9c5e5016 ac6d8962
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -19,13 +19,14 @@ package com.android.server.location;
import android.text.TextUtils;
import android.util.Log;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import libcore.io.Streams;

import java.io.IOException;
import java.util.Properties;
import java.util.Random;
import java.util.concurrent.TimeUnit;

import libcore.io.Streams;

/**
 * A class for downloading GPS XTRA data.
@@ -37,6 +38,7 @@ public class GpsXtraDownloader {
    private static final String TAG = "GpsXtraDownloader";
    private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
    private static final String DEFAULT_USER_AGENT = "Android";
    private static final int CONNECTION_TIMEOUT_MS = (int) TimeUnit.SECONDS.toMillis(30);

    private final String[] mXtraServers;
    // to load balance our server requests
@@ -113,6 +115,7 @@ public class GpsXtraDownloader {
            connection.setRequestProperty(
                    "x-wap-profile",
                    "http://www.openmobilealliance.org/tech/profiles/UAPROF/ccppschema-20021212#");
            connection.setConnectTimeout(CONNECTION_TIMEOUT_MS);

            connection.connect();
            int statusCode = connection.getResponseCode();