power: gps: add gps read timeout

During download gps file, if network is disconnected, it do not release wakelock
to prevent system to sleep and consume more power until network is connected.
So set gps read tiemout.

Bug: 33469278

Change-Id: I41adf137559d88f76d9da6f63585bfdefc3117b1
Signed-off-by: z00208928 <zhangwei519@huawei.com>
This commit is contained in:
z00208928
2017-07-21 22:26:29 +08:00
committed by Zheng Zhang
parent a763fdba09
commit 45d68cb35b

View File

@@ -44,6 +44,7 @@ public class GpsXtraDownloader {
private static final long MAXIMUM_CONTENT_LENGTH_BYTES = 1000000; // 1MB.
private static final String DEFAULT_USER_AGENT = "Android";
private static final int CONNECTION_TIMEOUT_MS = (int) TimeUnit.SECONDS.toMillis(30);
private static final int READ_TIMEOUT_MS = (int) TimeUnit.SECONDS.toMillis(60);
private final String[] mXtraServers;
// to load balance our server requests
@@ -121,6 +122,7 @@ public class GpsXtraDownloader {
"x-wap-profile",
"http://www.openmobilealliance.org/tech/profiles/UAPROF/ccppschema-20021212#");
connection.setConnectTimeout(CONNECTION_TIMEOUT_MS);
connection.setReadTimeout(READ_TIMEOUT_MS);
connection.connect();
int statusCode = connection.getResponseCode();