diff options
author | Jeff Sharkey <jsharkey@android.com> | 2013-09-18 12:53:39 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2013-09-18 13:24:48 -0700 |
commit | 8ec87ea5a5c191554d6205d4c779768664b1724b (patch) | |
tree | 1652bb0c244513e65612d934c8dc0c1921aa09bf /ui/src/com/android/providers | |
parent | e00d56d349fff8a9c5dc86739448603986ba6cb5 (diff) | |
download | android_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 'ui/src/com/android/providers')
-rw-r--r-- | ui/src/com/android/providers/downloads/ui/DownloadList.java | 8 | ||||
-rw-r--r-- | ui/src/com/android/providers/downloads/ui/TrampolineActivity.java | 6 |
2 files changed, 6 insertions, 8 deletions
diff --git a/ui/src/com/android/providers/downloads/ui/DownloadList.java b/ui/src/com/android/providers/downloads/ui/DownloadList.java index 991d70b6..107940c0 100644 --- a/ui/src/com/android/providers/downloads/ui/DownloadList.java +++ b/ui/src/com/android/providers/downloads/ui/DownloadList.java @@ -19,7 +19,6 @@ package com.android.providers.downloads.ui; import android.app.Activity; import android.app.AlertDialog; import android.app.DownloadManager; -import android.content.ActivityNotFoundException; import android.content.ContentUris; import android.content.Context; import android.content.DialogInterface; @@ -530,11 +529,8 @@ public class DownloadList extends Activity { } final long id = cursor.getLong(cursor.getColumnIndexOrThrow(BaseColumns._ID)); - final Intent intent = OpenHelper.buildViewIntent(this, id); - try { - startActivity(intent); - } catch (ActivityNotFoundException ex) { - Toast.makeText(this, R.string.download_no_application_title, Toast.LENGTH_LONG).show(); + if (!OpenHelper.startViewIntent(this, id, 0)) { + Toast.makeText(this, R.string.download_no_application_title, Toast.LENGTH_SHORT).show(); } } diff --git a/ui/src/com/android/providers/downloads/ui/TrampolineActivity.java b/ui/src/com/android/providers/downloads/ui/TrampolineActivity.java index e9cc17ef..f96c04ee 100644 --- a/ui/src/com/android/providers/downloads/ui/TrampolineActivity.java +++ b/ui/src/com/android/providers/downloads/ui/TrampolineActivity.java @@ -92,8 +92,10 @@ public class TrampolineActivity extends Activity { break; case DownloadManager.STATUS_SUCCESSFUL: - final Intent intent = OpenHelper.buildViewIntent(this, id); - startActivity(intent); + if (!OpenHelper.startViewIntent(this, id, 0)) { + Toast.makeText(this, R.string.download_no_application_title, Toast.LENGTH_SHORT) + .show(); + } finish(); break; |