summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2013-02-26 12:43:56 -0800
committerJeff Sharkey <jsharkey@android.com>2013-02-26 12:43:56 -0800
commit80a535d83ea9ed21f443fdc701c743569ae53eec (patch)
tree7de1281353a6dd415628287afd345791e43d2c1f
parent7ce206b2108714035eeed29c1dc268a3f1ccf359 (diff)
downloadandroid_packages_providers_DownloadProvider-80a535d83ea9ed21f443fdc701c743569ae53eec.zip
android_packages_providers_DownloadProvider-80a535d83ea9ed21f443fdc701c743569ae53eec.tar.gz
android_packages_providers_DownloadProvider-80a535d83ea9ed21f443fdc701c743569ae53eec.tar.bz2
Adjust timeouts to reduce false-positive bugs.
Otherwise we end up triggering MSG_FINAL_UPDATE while still waiting for socket timeouts. Using 20 seconds for timeout is more sane, and matches Volley. Bug: 8233041 Change-Id: Ia7220033a5942c46ca1d79a88e2b3f530cb3edac
-rw-r--r--src/com/android/providers/downloads/DownloadService.java4
-rw-r--r--src/com/android/providers/downloads/DownloadThread.java4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/com/android/providers/downloads/DownloadService.java b/src/com/android/providers/downloads/DownloadService.java
index c8e55d7..d6ed9d6 100644
--- a/src/com/android/providers/downloads/DownloadService.java
+++ b/src/com/android/providers/downloads/DownloadService.java
@@ -16,7 +16,7 @@
package com.android.providers.downloads;
-import static android.text.format.DateUtils.MINUTE_IN_MILLIS;
+import static android.text.format.DateUtils.SECOND_IN_MILLIS;
import static com.android.providers.downloads.Constants.TAG;
import android.app.AlarmManager;
@@ -210,7 +210,7 @@ public class DownloadService extends Service {
mUpdateHandler.removeMessages(MSG_FINAL_UPDATE);
mUpdateHandler.sendMessageDelayed(
mUpdateHandler.obtainMessage(MSG_FINAL_UPDATE, mLastStartId, -1),
- MINUTE_IN_MILLIS);
+ 90 * SECOND_IN_MILLIS);
}
private static final int MSG_UPDATE = 1;
diff --git a/src/com/android/providers/downloads/DownloadThread.java b/src/com/android/providers/downloads/DownloadThread.java
index 48eebfc..a0b3e54 100644
--- a/src/com/android/providers/downloads/DownloadThread.java
+++ b/src/com/android/providers/downloads/DownloadThread.java
@@ -23,7 +23,7 @@ import static android.provider.Downloads.Impl.STATUS_HTTP_DATA_ERROR;
import static android.provider.Downloads.Impl.STATUS_TOO_MANY_REDIRECTS;
import static android.provider.Downloads.Impl.STATUS_WAITING_FOR_NETWORK;
import static android.provider.Downloads.Impl.STATUS_WAITING_TO_RETRY;
-import static android.text.format.DateUtils.MINUTE_IN_MILLIS;
+import static android.text.format.DateUtils.SECOND_IN_MILLIS;
import static com.android.providers.downloads.Constants.TAG;
import static java.net.HttpURLConnection.HTTP_INTERNAL_ERROR;
import static java.net.HttpURLConnection.HTTP_MOVED_PERM;
@@ -80,7 +80,7 @@ public class DownloadThread implements Runnable {
private static final int HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
private static final int HTTP_TEMP_REDIRECT = 307;
- private static final int DEFAULT_TIMEOUT = (int) MINUTE_IN_MILLIS;
+ private static final int DEFAULT_TIMEOUT = (int) (20 * SECOND_IN_MILLIS);
private final Context mContext;
private final DownloadInfo mInfo;