diff options
author | Jeff Sharkey <jsharkey@android.com> | 2011-10-24 15:15:54 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2011-10-24 15:15:54 -0700 |
commit | 3e1f6ff817247a5003df0f2c9f27acaf84ad40ec (patch) | |
tree | 0b5a89bca80463f7180e19360e30758e958c177f /src | |
parent | c5c30ba14d411b3e23c983912e7fea4f449c9f54 (diff) | |
download | android_packages_providers_DownloadProvider-3e1f6ff817247a5003df0f2c9f27acaf84ad40ec.tar.gz android_packages_providers_DownloadProvider-3e1f6ff817247a5003df0f2c9f27acaf84ad40ec.tar.bz2 android_packages_providers_DownloadProvider-3e1f6ff817247a5003df0f2c9f27acaf84ad40ec.zip |
Sanity check only after updating from file size.
Database values can be stale, so delay sanity check until after
updating from file size on disk.
Bug: 5484249
Change-Id: Ia648a575d4a3a391a1f06a866c8282f2d569f15e
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/providers/downloads/DownloadThread.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/com/android/providers/downloads/DownloadThread.java b/src/com/android/providers/downloads/DownloadThread.java index 63a51a8f..9080e725 100644 --- a/src/com/android/providers/downloads/DownloadThread.java +++ b/src/com/android/providers/downloads/DownloadThread.java @@ -162,13 +162,6 @@ public class DownloadThread extends Thread { boolean finished = false; while(!finished) { - if (state.mCurrentBytes == state.mTotalBytes) { - Log.i(Constants.TAG, "Skipping initiating request for download " + - mInfo.mId + "; already completed"); - finished = true; - break; - } - Log.i(Constants.TAG, "Initiating request for download " + mInfo.mId); // Set or unset proxy, which may have changed since last GET request. // setDefaultProxy() supports null as proxy parameter. @@ -243,6 +236,13 @@ public class DownloadThread extends Thread { setupDestinationFile(state, innerState); addRequestHeaders(state, request); + // skip when already finished; remove after fixing race in 5217390 + if (state.mCurrentBytes == state.mTotalBytes) { + Log.i(Constants.TAG, "Skipping initiating request for download " + + mInfo.mId + "; already completed"); + return; + } + // check just before sending the request to avoid using an invalid connection at all checkConnectivity(); |