diff options
author | Vasu Nori <vnori@google.com> | 2011-03-10 11:57:56 -0800 |
---|---|---|
committer | Vasu Nori <vnori@google.com> | 2011-03-10 15:20:25 -0800 |
commit | 6baceb7073ed7858d3424ccf774e5f6a946bec59 (patch) | |
tree | c2b3466f2dee3b0ec9a01dbe649206f0ec48932b /src/com/android/providers/downloads/DownloadThread.java | |
parent | 34cebab410fe28edb9eb1bba6df96ceaa0224739 (diff) | |
download | android_packages_providers_DownloadProvider-6baceb7073ed7858d3424ccf774e5f6a946bec59.tar.gz android_packages_providers_DownloadProvider-6baceb7073ed7858d3424ccf774e5f6a946bec59.tar.bz2 android_packages_providers_DownloadProvider-6baceb7073ed7858d3424ccf774e5f6a946bec59.zip |
(master) bug:3204324 allow no more than certain number of concurrent downloads
Change-Id: Ibbce0782fcf7649209d6f56be240209cebd9045b
Diffstat (limited to 'src/com/android/providers/downloads/DownloadThread.java')
-rw-r--r-- | src/com/android/providers/downloads/DownloadThread.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/com/android/providers/downloads/DownloadThread.java b/src/com/android/providers/downloads/DownloadThread.java index 100ebcab..77f7fa1f 100644 --- a/src/com/android/providers/downloads/DownloadThread.java +++ b/src/com/android/providers/downloads/DownloadThread.java @@ -171,16 +171,18 @@ public class DownloadThread extends Thread { finalStatus = Downloads.Impl.STATUS_SUCCESS; } catch (StopRequestException error) { // remove the cause before printing, in case it contains PII - errorMsg = "Aborting request for download " + mInfo.mId + ": " + error.getMessage(); - Log.w(Constants.TAG, errorMsg); + errorMsg = error.getMessage(); + String msg = "Aborting request for download " + mInfo.mId + ": " + errorMsg; + Log.w(Constants.TAG, msg); if (Constants.LOGV) { - Log.w(Constants.TAG, errorMsg, error); + Log.w(Constants.TAG, msg, error); } finalStatus = error.mFinalStatus; // fall through to finally block } catch (Throwable ex) { //sometimes the socket code throws unchecked exceptions - errorMsg = "Exception for id " + mInfo.mId + ": " + ex.getMessage(); - Log.w(Constants.TAG, errorMsg, ex); + errorMsg = ex.getMessage(); + String msg = "Exception for id " + mInfo.mId + ": " + errorMsg; + Log.w(Constants.TAG, msg, ex); finalStatus = Downloads.Impl.STATUS_UNKNOWN_ERROR; // falls through to the code that reports an error } finally { @@ -196,7 +198,7 @@ public class DownloadThread extends Thread { notifyDownloadCompleted(finalStatus, state.mCountRetry, state.mRetryAfter, state.mGotData, state.mFilename, state.mNewUri, state.mMimeType, errorMsg); - mInfo.mHasActiveThread = false; + DownloadHandler.getInstance().dequeueDownload(mInfo.mId); } mStorageManager.incrementNumDownloadsSoFar(); } |