diff options
author | Jeff Sharkey <jsharkey@android.com> | 2014-01-30 15:01:39 -0800 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2014-02-06 10:42:46 -0800 |
commit | dffbb9c4567e9d29d19964a83129e38dceab7055 (patch) | |
tree | 773bb59bc04f75e19e3a39acba06de574f75a385 /src/com/android/providers/downloads/Constants.java | |
parent | 9b731a5521f569c91aeb419d43fa098a34cf78cb (diff) | |
download | android_packages_providers_DownloadProvider-dffbb9c4567e9d29d19964a83129e38dceab7055.tar.gz android_packages_providers_DownloadProvider-dffbb9c4567e9d29d19964a83129e38dceab7055.tar.bz2 android_packages_providers_DownloadProvider-dffbb9c4567e9d29d19964a83129e38dceab7055.zip |
Many improvements to download storage management.
Change all data transfer to occur through FileDescriptors instead of
relying on local files. This paves the way for downloading directly
to content:// Uris in the future.
Rewrite storage management logic to preflight download when size is
known. If enough space is found, immediately reserve the space with
fallocate(), advising the kernel block allocator to try giving us a
contiguous block regions to reduce fragmentation. When preflighting
on internal storage or emulated external storage, ask PackageManager
to clear private app caches to free up space.
Since we fallocate() the entire file, use the database as the source
of truth for resume locations, which requires that we fsync() before
each database update.
Store in-progress downloads in separate directories to keep the OS
from deleting out from under us. Clean up filename generation logic
to break ties in this new dual-directory case.
Clearer enforcement of successful download preconditions around
content lengths and ETags. Move all database field mutations to
clearer DownloadInfoDelta object, and write back through single
code path.
Catch and log uncaught exceptions from DownloadThread. Tests to
verify new storage behaviors. Fixed existing test to reflect correct
RFC behavior.
Bug: 5287571, 3213677, 12663412
Change-Id: I6bb905eca7c7d1a6bc88df3db28b65d70f660221
Diffstat (limited to 'src/com/android/providers/downloads/Constants.java')
-rw-r--r-- | src/com/android/providers/downloads/Constants.java | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/com/android/providers/downloads/Constants.java b/src/com/android/providers/downloads/Constants.java index 89210a25..2803d1c6 100644 --- a/src/com/android/providers/downloads/Constants.java +++ b/src/com/android/providers/downloads/Constants.java @@ -80,9 +80,6 @@ public class Constants { */ public static final String FILENAME_SEQUENCE_SEPARATOR = "-"; - /** Where we store downloaded files on the external storage */ - public static final String DEFAULT_DL_SUBDIR = "/" + Environment.DIRECTORY_DOWNLOADS; - /** A magic filename that is allowed to exist within the system cache */ public static final String RECOVERY_DIRECTORY = "recovery"; @@ -123,16 +120,13 @@ public class Constants { public static final String MIMETYPE_APK = "application/vnd.android.package"; /** The buffer size used to stream the data */ - public static final int BUFFER_SIZE = 4096; + public static final int BUFFER_SIZE = 8192; /** The minimum amount of progress that has to be done before the progress bar gets updated */ - public static final int MIN_PROGRESS_STEP = 4096; + public static final int MIN_PROGRESS_STEP = 65536; /** The minimum amount of time that has to elapse before the progress bar gets updated, in ms */ - public static final long MIN_PROGRESS_TIME = 1500; - - /** The maximum number of rows in the database (FIFO) */ - public static final int MAX_DOWNLOADS = 1000; + public static final long MIN_PROGRESS_TIME = 2000; /** * The number of times that the download manager will retry its network @@ -177,4 +171,9 @@ public class Constants { public static final String STORAGE_AUTHORITY = "com.android.providers.downloads.documents"; public static final String STORAGE_ROOT_ID = "downloads"; + + /** + * Name of directory on cache partition containing in-progress downloads. + */ + public static final String DIRECTORY_CACHE_RUNNING = "partial_downloads"; } |