bug:3297328 set download destination dir to /sdcard/Download
downlaoded files should go into /sdcard/Download, like they used to
in GB and earlier.
But a minor difference in the download dir name:
it used to be /sdcard/download in before HC
/sdcard/Download in HC
how serious is this difference?
Change-Id: Ib56d8ee6a1393fd781399281be98b8c52831ebe1
diff --git a/src/com/android/browser/DownloadHandler.java b/src/com/android/browser/DownloadHandler.java
index cbf26f4..40278f4 100644
--- a/src/com/android/browser/DownloadHandler.java
+++ b/src/com/android/browser/DownloadHandler.java
@@ -183,7 +183,9 @@
Uri uri = Uri.parse(addressString);
final DownloadManager.Request request = new DownloadManager.Request(uri);
request.setMimeType(mimetype);
- request.setDestinationInExternalFilesDir(activity, null, filename);
+ // set downloaded file destination to /sdcard/Download.
+ // or, should it be set to one of several Environment.DIRECTORY* dirs depending on mimetype?
+ request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, filename);
// let this downloaded file be scanned by MediaScanner - so that it can
// show up in Gallery app, for example.
request.allowScanningByMediaScanner();
diff --git a/src/com/android/browser/FetchUrlMimeType.java b/src/com/android/browser/FetchUrlMimeType.java
index 2538d90..85c588e 100644
--- a/src/com/android/browser/FetchUrlMimeType.java
+++ b/src/com/android/browser/FetchUrlMimeType.java
@@ -27,6 +27,7 @@
import android.content.Context;
import android.net.Proxy;
import android.net.http.AndroidHttpClient;
+import android.os.Environment;
import android.webkit.MimeTypeMap;
import android.webkit.URLUtil;
@@ -116,7 +117,7 @@
}
String filename = URLUtil.guessFileName(mUri, contentDisposition,
mimeType);
- mRequest.setDestinationInExternalFilesDir(mActivity, null, filename);
+ mRequest.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, filename);
}
// Start the download