diff options
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/providers/downloads/Constants.java | 3 | ||||
-rw-r--r-- | src/com/android/providers/downloads/DownloadService.java | 45 | ||||
-rw-r--r-- | src/com/android/providers/downloads/Helpers.java | 25 |
3 files changed, 7 insertions, 66 deletions
diff --git a/src/com/android/providers/downloads/Constants.java b/src/com/android/providers/downloads/Constants.java index 5cf13531..7cfe6bcf 100644 --- a/src/com/android/providers/downloads/Constants.java +++ b/src/com/android/providers/downloads/Constants.java @@ -88,6 +88,9 @@ public class Constants { /** A magic filename that is allowed to exist within the system cache */ public static final String RECOVERY_DIRECTORY = "recovery"; + /** A magic filename that is allowed to exist within the system cache */ + public static final String DEX_CACHE_DIRECTORY = "dalvik-cache"; + /** The default user agent used for downloads */ public static final String DEFAULT_USER_AGENT = "AndroidDownloadManager"; diff --git a/src/com/android/providers/downloads/DownloadService.java b/src/com/android/providers/downloads/DownloadService.java index a246d29f..a022ffa7 100644 --- a/src/com/android/providers/downloads/DownloadService.java +++ b/src/com/android/providers/downloads/DownloadService.java @@ -482,10 +482,10 @@ public class DownloadService extends Service { } HashSet<String> fileSet = new HashSet(); for (int i = 0; i < files.length; i++) { - if (files[i].getName().equals(Constants.KNOWN_SPURIOUS_FILENAME)) { - continue; - } - if (files[i].getName().equalsIgnoreCase(Constants.RECOVERY_DIRECTORY)) { + String filename = files[i].getName(); + if (Constants.KNOWN_SPURIOUS_FILENAME.equals(filename) || + Constants.RECOVERY_DIRECTORY.equalsIgnoreCase(filename) || + Constants.DEX_CACHE_DIRECTORY.equalsIgnoreCase(filename)) { continue; } fileSet.add(files[i].getPath()); @@ -608,43 +608,6 @@ public class DownloadService extends Service { mDownloads.add(arrayPos, info); - if (info.mStatus == 0 - && (info.mDestination == Downloads.DESTINATION_EXTERNAL - || info.mDestination == Downloads.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.STATUS_NOT_ACCEPTABLE; - - Uri uri = ContentUris.withAppendedId(Downloads.CONTENT_URI, info.mId); - ContentValues values = new ContentValues(); - values.put(Downloads.COLUMN_STATUS, Downloads.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 d8f262c7..7451a07c 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.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.STATUS_NOT_ACCEPTABLE); - } - } } String filename = chooseFilename( url, hint, contentDisposition, contentLocation, destination); |