summaryrefslogtreecommitdiffstats
path: root/src/com/android/providers/downloads/DownloadThread.java
diff options
context:
space:
mode:
authorVasu Nori <vnori@google.com>2010-12-13 16:29:29 -0800
committerVasu Nori <vnori@google.com>2010-12-14 15:11:19 -0800
commit9aadb4b3f2b3c914166ebfae8851fbecaf536f4f (patch)
tree56e8adaa5a2d5e6f649a24ea7acd270002c9e258 /src/com/android/providers/downloads/DownloadThread.java
parent331d169b4a0099e888ff603abdb1be88c30bba21 (diff)
downloadandroid_packages_providers_DownloadProvider-9aadb4b3f2b3c914166ebfae8851fbecaf536f4f.tar.gz
android_packages_providers_DownloadProvider-9aadb4b3f2b3c914166ebfae8851fbecaf536f4f.tar.bz2
android_packages_providers_DownloadProvider-9aadb4b3f2b3c914166ebfae8851fbecaf536f4f.zip
Download dir: /data/data/com.android.providers.downloads/cache NOT /cache
bug:3264401 still to do: make sure only N bytes are taken up by downloads dir N = a value specific to each device. default = 100MB. Change-Id: I2a49f4b3831d3a8d7be13b5fd46d85d56e831e38
Diffstat (limited to 'src/com/android/providers/downloads/DownloadThread.java')
-rw-r--r--src/com/android/providers/downloads/DownloadThread.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/com/android/providers/downloads/DownloadThread.java b/src/com/android/providers/downloads/DownloadThread.java
index a1d91019..c497d5cf 100644
--- a/src/com/android/providers/downloads/DownloadThread.java
+++ b/src/com/android/providers/downloads/DownloadThread.java
@@ -437,7 +437,8 @@ public class DownloadThread extends Thread {
return;
} catch (IOException ex) {
if (mInfo.isOnCache()) {
- if (Helpers.discardPurgeableFiles(mContext, Constants.BUFFER_SIZE)) {
+ if (Helpers.discardPurgeableFiles(mInfo.mDestination, mContext,
+ Constants.BUFFER_SIZE)) {
continue;
}
} else if (!Helpers.isExternalMediaMounted()) {
@@ -446,7 +447,7 @@ public class DownloadThread extends Thread {
}
long availableBytes =
- Helpers.getAvailableBytes(Helpers.getFilesystemRoot(state.mFilename));
+ Helpers.getAvailableBytes(Helpers.getFilesystemRoot(mContext, state.mFilename));
if (availableBytes < bytesRead) {
throw new StopRequest(Downloads.Impl.STATUS_INSUFFICIENT_SPACE_ERROR,
"insufficient space while writing destination file", ex);
@@ -802,7 +803,8 @@ public class DownloadThread extends Thread {
private void setupDestinationFile(State state, InnerState innerState)
throws StopRequest {
if (!TextUtils.isEmpty(state.mFilename)) { // only true if we've already run a thread for this download
- if (!Helpers.isFilenameValid(state.mFilename)) {
+ if (!Helpers.isFilenameValid(state.mFilename,
+ Helpers.getDownloadsDataDirectory(mContext))) {
// this should never happen
throw new StopRequest(Downloads.Impl.STATUS_FILE_ERROR,
"found invalid internal destination filename");