From 80a535d83ea9ed21f443fdc701c743569ae53eec Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Tue, 26 Feb 2013 12:43:56 -0800 Subject: 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 --- src/com/android/providers/downloads/DownloadService.java | 4 ++-- src/com/android/providers/downloads/DownloadThread.java | 4 ++-- 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 c8e55d7d..d6ed9d6d 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 48eebfc0..a0b3e54a 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; -- cgit v1.2.3