diff options
author | kmobs <persiansown@gmail.com> | 2010-06-25 02:27:25 -0500 |
---|---|---|
committer | ctso <ctsoyars@gmail.com> | 2010-06-25 15:34:58 +0000 |
commit | 93c2daf850fd9b554c92e5ecbcb843d2659ad591 (patch) | |
tree | c369a4d7008d5ac4f7b9545930e896da8d466e1b | |
parent | 0ac16ba8432a459dbccf23ff28521ca808a104a8 (diff) | |
download | android_packages_providers_DownloadProvider-93c2daf850fd9b554c92e5ecbcb843d2659ad591.tar.gz android_packages_providers_DownloadProvider-93c2daf850fd9b554c92e5ecbcb843d2659ad591.tar.bz2 android_packages_providers_DownloadProvider-93c2daf850fd9b554c92e5ecbcb843d2659ad591.zip |
Incorporated EddieRingle's allow any file type to be downloaded
-rw-r--r-- | src/com/android/providers/downloads/DownloadService.java | 37 | ||||
-rw-r--r-- | src/com/android/providers/downloads/Helpers.java | 25 |
2 files changed, 0 insertions, 62 deletions
diff --git a/src/com/android/providers/downloads/DownloadService.java b/src/com/android/providers/downloads/DownloadService.java index 329d2c57..9a8789cf 100644 --- a/src/com/android/providers/downloads/DownloadService.java +++ b/src/com/android/providers/downloads/DownloadService.java @@ -612,43 +612,6 @@ public class DownloadService extends Service { mDownloads.add(arrayPos, info); - if (info.mStatus == 0 - && (info.mDestination == Downloads.Impl.DESTINATION_EXTERNAL - || info.mDestination == Downloads.Impl.DESTINATION_CACHE_PARTITION_PURGEABLE) - && info.mMimeType != null - && !DrmRawContent.DRM_MIMETYPE_MESSAGE_STRING.equalsIgnoreCase(info.mMimeType)) { - // Check to see if we are allowed to download this file. Only files - // that can be handled by the platform can be downloaded. - // special case DRM files, which we should always allow downloading. - Intent mimetypeIntent = new Intent(Intent.ACTION_VIEW); - - // We can provide data as either content: or file: URIs, - // so allow both. (I think it would be nice if we just did - // everything as content: URIs) - // Actually, right now the download manager's UId restrictions - // prevent use from using content: so it's got to be file: or - // nothing - - mimetypeIntent.setDataAndType(Uri.fromParts("file", "", null), info.mMimeType); - ResolveInfo ri = getPackageManager().resolveActivity(mimetypeIntent, - PackageManager.MATCH_DEFAULT_ONLY); - //Log.i(Constants.TAG, "*** QUERY " + mimetypeIntent + ": " + list); - - if (ri == null) { - if (Config.LOGD) { - Log.d(Constants.TAG, "no application to handle MIME type " + info.mMimeType); - } - info.mStatus = Downloads.Impl.STATUS_NOT_ACCEPTABLE; - - Uri uri = ContentUris.withAppendedId(Downloads.Impl.CONTENT_URI, info.mId); - ContentValues values = new ContentValues(); - values.put(Downloads.Impl.COLUMN_STATUS, Downloads.Impl.STATUS_NOT_ACCEPTABLE); - getContentResolver().update(uri, values, null, null); - info.sendIntentIfRequested(uri, this); - return; - } - } - if (info.canUseNetwork(networkAvailable, networkRoaming)) { if (info.isReadyToStart(now)) { if (Constants.LOGV) { diff --git a/src/com/android/providers/downloads/Helpers.java b/src/com/android/providers/downloads/Helpers.java index 1e07d421..c5e58cc2 100644 --- a/src/com/android/providers/downloads/Helpers.java +++ b/src/com/android/providers/downloads/Helpers.java @@ -99,31 +99,6 @@ public class Helpers { } return new DownloadFileInfo(null, null, Downloads.Impl.STATUS_NOT_ACCEPTABLE); } - if (!DrmRawContent.DRM_MIMETYPE_MESSAGE_STRING.equalsIgnoreCase(mimeType)) { - // Check to see if we are allowed to download this file. Only files - // that can be handled by the platform can be downloaded. - // special case DRM files, which we should always allow downloading. - Intent intent = new Intent(Intent.ACTION_VIEW); - - // We can provide data as either content: or file: URIs, - // so allow both. (I think it would be nice if we just did - // everything as content: URIs) - // Actually, right now the download manager's UId restrictions - // prevent use from using content: so it's got to be file: or - // nothing - - PackageManager pm = context.getPackageManager(); - intent.setDataAndType(Uri.fromParts("file", "", null), mimeType); - ResolveInfo ri = pm.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY); - //Log.i(Constants.TAG, "*** FILENAME QUERY " + intent + ": " + list); - - if (ri == null) { - if (Config.LOGD) { - Log.d(Constants.TAG, "no handler found for type " + mimeType); - } - return new DownloadFileInfo(null, null, Downloads.Impl.STATUS_NOT_ACCEPTABLE); - } - } } String filename = chooseFilename( url, hint, contentDisposition, contentLocation, destination); |