diff options
author | Leon Scroggins <scroggo@google.com> | 2010-01-21 13:09:54 -0500 |
---|---|---|
committer | Leon Scroggins <scroggo@google.com> | 2010-01-21 14:57:08 -0500 |
commit | 0f1aae327a9e4c68044d767e9bafbac747b6d985 (patch) | |
tree | f57e0b91c9a2a21865208639f9c09978a1ead64a /src/com/android/providers/downloads/DownloadNotification.java | |
parent | 7dd92fa94df0a13b4592ee636b7aa2b605f6b473 (diff) | |
download | android_packages_providers_DownloadProvider-0f1aae327a9e4c68044d767e9bafbac747b6d985.tar.gz android_packages_providers_DownloadProvider-0f1aae327a9e4c68044d767e9bafbac747b6d985.tar.bz2 android_packages_providers_DownloadProvider-0f1aae327a9e4c68044d767e9bafbac747b6d985.zip |
Download files even if there is no activity to launch them.
Fixes http://b/issue?id=2367247
Diffstat (limited to 'src/com/android/providers/downloads/DownloadNotification.java')
-rw-r--r-- | src/com/android/providers/downloads/DownloadNotification.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/com/android/providers/downloads/DownloadNotification.java b/src/com/android/providers/downloads/DownloadNotification.java index a9362e8d..fd62e6f8 100644 --- a/src/com/android/providers/downloads/DownloadNotification.java +++ b/src/com/android/providers/downloads/DownloadNotification.java @@ -21,6 +21,7 @@ import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; +import android.content.pm.PackageManager; import android.database.Cursor; import android.net.Uri; import android.provider.Downloads; @@ -227,7 +228,8 @@ class DownloadNotification { Downloads.Impl.COLUMN_STATUS, Downloads.Impl._DATA, Downloads.Impl.COLUMN_LAST_MODIFICATION, - Downloads.Impl.COLUMN_DESTINATION + Downloads.Impl.COLUMN_DESTINATION, + Downloads.Impl.COLUMN_MIME_TYPE }, WHERE_COMPLETED, null, Downloads.Impl._ID); @@ -247,6 +249,7 @@ class DownloadNotification { final int filenameColumnId = 8; final int lastModColumnId = 9; final int destinationColumnId = 10; + final int mimeTypeColumnId = 11; for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) { // Add the notifications @@ -268,7 +271,13 @@ class DownloadNotification { } else { caption = mContext.getResources() .getString(R.string.notification_download_complete); - if (c.getInt(destinationColumnId) == Downloads.Impl.DESTINATION_EXTERNAL) { + if (c.getInt(destinationColumnId) == Downloads.Impl.DESTINATION_EXTERNAL + // If there is no Activity to view the file, show the + // list + && null != mContext.getPackageManager().resolveActivity( + new Intent().setDataAndType(Uri.fromParts("file", "", + null), c.getString(mimeTypeColumnId)), + PackageManager.MATCH_DEFAULT_ONLY)) { intent = new Intent(Constants.ACTION_OPEN); } else { intent = new Intent(Constants.ACTION_LIST); |