summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2010-01-21 16:21:46 -0500
committerLeon Scroggins <scroggo@google.com>2010-01-21 16:27:16 -0500
commit4d3a380d338b1f6ee120fb9de2001f138be398ff (patch)
tree827e1577c212cce16d2d80559a630636a0da2f0c
parent0f1aae327a9e4c68044d767e9bafbac747b6d985 (diff)
downloadandroid_packages_providers_DownloadProvider-4d3a380d338b1f6ee120fb9de2001f138be398ff.tar.gz
android_packages_providers_DownloadProvider-4d3a380d338b1f6ee120fb9de2001f138be398ff.tar.bz2
android_packages_providers_DownloadProvider-4d3a380d338b1f6ee120fb9de2001f138be398ff.zip
Update the title of the download based on the filename.
Now that the downloads page is not necessarily opened when a download starts, we need to provide a name even if the downloads page isn't shown. So when we create a notification, provide the title. Depends on a change to frameworks/base
-rw-r--r--src/com/android/providers/downloads/DownloadNotification.java26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/com/android/providers/downloads/DownloadNotification.java b/src/com/android/providers/downloads/DownloadNotification.java
index fd62e6f8..4c7cec4e 100644
--- a/src/com/android/providers/downloads/DownloadNotification.java
+++ b/src/com/android/providers/downloads/DownloadNotification.java
@@ -145,16 +145,23 @@ class DownloadNotification {
String packageName = c.getString(ownerColumn);
int max = c.getInt(totalBytesColumn);
int progress = c.getInt(currentBytesColumn);
+ long id = c.getLong(idColumn);
String title = c.getString(titleColumn);
if (title == null || title.length() == 0) {
- title = mContext.getResources().getString(
- R.string.download_unknown_title);
+ String filename = c.getString(filenameColumnId);
+ if (filename == null) {
+ title = mContext.getResources().getString(
+ R.string.download_unknown_title);
+ } else {
+ title = Downloads.Impl.createTitleFromFilename(mContext,
+ filename, id);
+ }
}
if (mNotifications.containsKey(packageName)) {
mNotifications.get(packageName).addItem(title, progress, max);
} else {
NotificationItem item = new NotificationItem();
- item.mId = c.getInt(idColumn);
+ item.mId = (int) id;
item.mPackageName = packageName;
item.mDescription = c.getString(descColumn);
String className = c.getString(classOwnerColumn);
@@ -256,12 +263,19 @@ class DownloadNotification {
Notification n = new Notification();
n.icon = android.R.drawable.stat_sys_download_done;
+ long id = c.getLong(idColumn);
String title = c.getString(titleColumn);
if (title == null || title.length() == 0) {
- title = mContext.getResources().getString(
- R.string.download_unknown_title);
+ String filename = c.getString(filenameColumnId);
+ if (filename == null) {
+ title = mContext.getResources().getString(
+ R.string.download_unknown_title);
+ } else {
+ title = Downloads.Impl.createTitleFromFilename(mContext,
+ filename, id);
+ }
}
- Uri contentUri = Uri.parse(Downloads.Impl.CONTENT_URI + "/" + c.getInt(idColumn));
+ Uri contentUri = Uri.parse(Downloads.Impl.CONTENT_URI + "/" + id);
String caption;
Intent intent;
if (Downloads.Impl.isStatusError(c.getInt(statusColumn))) {