diff options
Diffstat (limited to 'src/com/android/providers/downloads/DownloadThread.java')
-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 2995bfb6..461d8cea 100644 --- a/src/com/android/providers/downloads/DownloadThread.java +++ b/src/com/android/providers/downloads/DownloadThread.java @@ -26,6 +26,7 @@ import android.os.PowerManager; import android.os.Process; import android.provider.Downloads; import android.provider.DrmStore; +import android.text.TextUtils; import android.util.Log; import android.util.Pair; @@ -87,7 +88,6 @@ public class DownloadThread extends Thread { public State(DownloadInfo info) { mMimeType = sanitizeMimeType(info.mMimeType); - mRedirectCount = info.mRedirectCount; mRequestUri = info.mUri; mFilename = info.mFileName; } @@ -199,7 +199,7 @@ public class DownloadThread extends Thread { } cleanupDestination(state, finalStatus); notifyDownloadCompleted(finalStatus, state.mCountRetry, state.mRetryAfter, - state.mRedirectCount, state.mGotData, state.mFilename, + state.mGotData, state.mFilename, state.mNewUri, state.mMimeType); mInfo.mHasActiveThread = false; } @@ -790,7 +790,7 @@ public class DownloadThread extends Thread { */ private void setupDestinationFile(State state, InnerState innerState) throws StopRequest { - if (state.mFilename != null) { // only true if we've already run a thread for this download + if (!TextUtils.isEmpty(state.mFilename)) { // only true if we've already run a thread for this download if (!Helpers.isFilenameValid(state.mFilename)) { // this should never happen throw new StopRequest(Downloads.Impl.STATUS_FILE_ERROR, @@ -853,17 +853,17 @@ public class DownloadThread extends Thread { * Stores information about the completed download, and notifies the initiating application. */ private void notifyDownloadCompleted( - int status, boolean countRetry, int retryAfter, int redirectCount, boolean gotData, + int status, boolean countRetry, int retryAfter, boolean gotData, String filename, String uri, String mimeType) { notifyThroughDatabase( - status, countRetry, retryAfter, redirectCount, gotData, filename, uri, mimeType); + status, countRetry, retryAfter, gotData, filename, uri, mimeType); if (Downloads.Impl.isStatusCompleted(status)) { mInfo.sendIntentIfRequested(); } } private void notifyThroughDatabase( - int status, boolean countRetry, int retryAfter, int redirectCount, boolean gotData, + int status, boolean countRetry, int retryAfter, boolean gotData, String filename, String uri, String mimeType) { ContentValues values = new ContentValues(); values.put(Downloads.Impl.COLUMN_STATUS, status); @@ -873,7 +873,7 @@ public class DownloadThread extends Thread { } values.put(Downloads.Impl.COLUMN_MIME_TYPE, mimeType); values.put(Downloads.Impl.COLUMN_LAST_MODIFICATION, mSystemFacade.currentTimeMillis()); - values.put(Constants.RETRY_AFTER_X_REDIRECT_COUNT, retryAfter + (redirectCount << 28)); + values.put(Constants.RETRY_AFTER_X_REDIRECT_COUNT, retryAfter); if (!countRetry) { values.put(Constants.FAILED_CONNECTIONS, 0); } else if (gotData) { |