diff options
author | Jeff Sharkey <jsharkey@android.com> | 2013-01-05 09:47:36 -0800 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2013-01-05 09:47:36 -0800 |
commit | 701d66efeff513a7509eeaafab6e47f4f6edb857 (patch) | |
tree | 6d5cd0c778dcb8c3bfc8f8c4db1a650861859e48 /src/com/android/providers/downloads/DownloadInfo.java | |
parent | b62364ce70074dbdea03aafdc0f64c7ba39c3a69 (diff) | |
download | android_packages_providers_DownloadProvider-701d66efeff513a7509eeaafab6e47f4f6edb857.tar.gz android_packages_providers_DownloadProvider-701d66efeff513a7509eeaafab6e47f4f6edb857.tar.bz2 android_packages_providers_DownloadProvider-701d66efeff513a7509eeaafab6e47f4f6edb857.zip |
Remove singleton StorageManager.
Now DownloadService creates and owns the lifecycle of its own
StorageManager instance.
Change-Id: I8f6bedc02f1dbe610a8e6a25d55383a12716d344
Diffstat (limited to 'src/com/android/providers/downloads/DownloadInfo.java')
-rw-r--r-- | src/com/android/providers/downloads/DownloadInfo.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/com/android/providers/downloads/DownloadInfo.java b/src/com/android/providers/downloads/DownloadInfo.java index 5172b696..2ea7d84d 100644 --- a/src/com/android/providers/downloads/DownloadInfo.java +++ b/src/com/android/providers/downloads/DownloadInfo.java @@ -54,8 +54,9 @@ public class DownloadInfo { mCursor = cursor; } - public DownloadInfo newDownloadInfo(Context context, SystemFacade systemFacade) { - DownloadInfo info = new DownloadInfo(context, systemFacade); + public DownloadInfo newDownloadInfo(Context context, SystemFacade systemFacade, + StorageManager storageManager) { + DownloadInfo info = new DownloadInfo(context, systemFacade, storageManager); updateFromDatabase(info); readRequestHeaders(info); return info; @@ -229,12 +230,15 @@ public class DownloadInfo { public int mFuzz; private List<Pair<String, String>> mRequestHeaders = new ArrayList<Pair<String, String>>(); - private SystemFacade mSystemFacade; - private Context mContext; - private DownloadInfo(Context context, SystemFacade systemFacade) { + private final Context mContext; + private final SystemFacade mSystemFacade; + private final StorageManager mStorageManager; + + private DownloadInfo(Context context, SystemFacade systemFacade, StorageManager storageManager) { mContext = context; mSystemFacade = systemFacade; + mStorageManager = storageManager; mFuzz = Helpers.sRandom.nextInt(1001); } @@ -572,7 +576,7 @@ public class DownloadInfo { void startDownloadThread() { DownloadThread downloader = new DownloadThread(mContext, mSystemFacade, this, - StorageManager.getInstance(mContext)); + mStorageManager); mSystemFacade.startThread(downloader); } |