summaryrefslogtreecommitdiffstats
path: root/src/com/android/providers/downloads/DownloadReceiver.java
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2013-09-18 12:53:39 -0700
committerJeff Sharkey <jsharkey@android.com>2013-09-18 13:24:48 -0700
commit8ec87ea5a5c191554d6205d4c779768664b1724b (patch)
tree1652bb0c244513e65612d934c8dc0c1921aa09bf /src/com/android/providers/downloads/DownloadReceiver.java
parente00d56d349fff8a9c5dc86739448603986ba6cb5 (diff)
downloadandroid_packages_providers_DownloadProvider-8ec87ea5a5c191554d6205d4c779768664b1724b.tar.gz
android_packages_providers_DownloadProvider-8ec87ea5a5c191554d6205d4c779768664b1724b.tar.bz2
android_packages_providers_DownloadProvider-8ec87ea5a5c191554d6205d4c779768664b1724b.zip
Unified handling of errors around opening.
Handle both missing downloads and missing activities. Bug: 10799449, 10713636 Change-Id: I592b07fc5cf530526803379d7f7a99e8a6b207c4
Diffstat (limited to 'src/com/android/providers/downloads/DownloadReceiver.java')
-rw-r--r--src/com/android/providers/downloads/DownloadReceiver.java10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/com/android/providers/downloads/DownloadReceiver.java b/src/com/android/providers/downloads/DownloadReceiver.java
index 42f029a3..f3d23766 100644
--- a/src/com/android/providers/downloads/DownloadReceiver.java
+++ b/src/com/android/providers/downloads/DownloadReceiver.java
@@ -20,7 +20,6 @@ import static android.app.DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMP
import static android.app.DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION;
import android.app.DownloadManager;
-import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.ContentUris;
import android.content.ContentValues;
@@ -162,13 +161,8 @@ public class DownloadReceiver extends BroadcastReceiver {
* {@link DownloadManager#COLUMN_ID}.
*/
private void openDownload(Context context, long id) {
- final Intent intent = OpenHelper.buildViewIntent(context, id);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- try {
- context.startActivity(intent);
- } catch (ActivityNotFoundException ex) {
- Log.d(Constants.TAG, "no activity for " + intent, ex);
- Toast.makeText(context, R.string.download_no_application_title, Toast.LENGTH_LONG)
+ if (!OpenHelper.startViewIntent(context, id, Intent.FLAG_ACTIVITY_NEW_TASK)) {
+ Toast.makeText(context, R.string.download_no_application_title, Toast.LENGTH_SHORT)
.show();
}
}