From 3e1f6ff817247a5003df0f2c9f27acaf84ad40ec Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Mon, 24 Oct 2011 15:15:54 -0700 Subject: 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 --- src/com/android/providers/downloads/DownloadThread.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') 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(); -- cgit v1.2.3