diff options
author | Jeff Sharkey <jsharkey@android.com> | 2012-12-23 19:28:09 -0800 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2013-01-09 18:32:03 -0800 |
commit | 0de55602ec6d350548248feddc68c91b29326eff (patch) | |
tree | f64aa79577aa145c331a81bdbf23f12c6e8bd9be /src/com/android/providers/downloads/Helpers.java | |
parent | 8ac10e0e0667a4fe35191deebb5fa9786bf4226c (diff) | |
download | android_packages_providers_DownloadProvider-0de55602ec6d350548248feddc68c91b29326eff.tar.gz android_packages_providers_DownloadProvider-0de55602ec6d350548248feddc68c91b29326eff.tar.bz2 android_packages_providers_DownloadProvider-0de55602ec6d350548248feddc68c91b29326eff.zip |
Simplify download flow control, handle redirects.
Move redirection handling into a single loop, and handle each HTTP
response code inline to make flow control easier to reason about.
Fix race condition in tests by waiting for first status update.
Bug: 7887226
Change-Id: Id4bfd182941baad4cd0bb702376c4beeb7275bb2
Diffstat (limited to 'src/com/android/providers/downloads/Helpers.java')
-rw-r--r-- | src/com/android/providers/downloads/Helpers.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/com/android/providers/downloads/Helpers.java b/src/com/android/providers/downloads/Helpers.java index 225b8d49..059e9703 100644 --- a/src/com/android/providers/downloads/Helpers.java +++ b/src/com/android/providers/downloads/Helpers.java @@ -284,6 +284,9 @@ public class Helpers { private static String chooseUniqueFilename(int destination, String filename, String extension, boolean recoveryDir) throws StopRequestException { + // TODO: switch to actually creating the file here, otherwise we expose + // ourselves to race conditions. + String fullFilename = filename + extension; if (!new File(fullFilename).exists() && (!recoveryDir || |