diff options
author | Steve Howard <showard@google.com> | 2010-09-15 12:29:50 -0700 |
---|---|---|
committer | Steve Howard <showard@google.com> | 2010-09-20 11:34:54 -0700 |
commit | 3398db8f3b195959faa2a7cf09918f364432ac28 (patch) | |
tree | b274d3f30d22bb3d56100cb18e3ade5a83c91b71 /src/com/android/providers/downloads/DownloadProvider.java | |
parent | 4bebe75b3e2361d7fb0aa966598c41c45ad9317f (diff) | |
download | android_packages_providers_DownloadProvider-3398db8f3b195959faa2a7cf09918f364432ac28.tar.gz android_packages_providers_DownloadProvider-3398db8f3b195959faa2a7cf09918f364432ac28.tar.bz2 android_packages_providers_DownloadProvider-3398db8f3b195959faa2a7cf09918f364432ac28.zip |
Fix notification bugs, cleanup DownloadService + DownloadReceiver
This change started out just fixing a few regressions related to
notifications:
* Browser downloads weren't picking up a title from the determined
filename. This was due to my change to default the title field to
"" instead of null.
* Notification click/hide events weren't being handled properly. This
was due to previous change to the URI structure of DownloadProvider.
DownloadReceiver needed to be changed to perform queries through
/all_downloads URIs, like all other parts of the download manager
code. I did some general refactoring of the DownloadReceiver code
while I was there.
* The code in DownloadNotification wasn't picking up some updates to
downloads properly. This was due to my change to make
DownloadNotification use the DownloadInfo objects rather than
querying the database directly, so that it could make use of info
provided by the DownloadThread that didn't go into the DB. Fixing
this didn't turn out to be all that complicated, but along the way
to figuring this out I made some substantial refactoring in
DownloadService which made it much cleaner anyway and eliminated a
lot of duplication. That's something that had to happen eventually,
so I'm leaving it all in.
Change-Id: I847ccf80e3d928c84e36bc24791b33204104e1b2
Diffstat (limited to 'src/com/android/providers/downloads/DownloadProvider.java')
-rw-r--r-- | src/com/android/providers/downloads/DownloadProvider.java | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/com/android/providers/downloads/DownloadProvider.java b/src/com/android/providers/downloads/DownloadProvider.java index edbfb783..df7ca71d 100644 --- a/src/com/android/providers/downloads/DownloadProvider.java +++ b/src/com/android/providers/downloads/DownloadProvider.java @@ -827,9 +827,8 @@ public final class DownloadProvider extends ContentProvider { if (filename != null) { Cursor c = query(uri, new String[] { Downloads.Impl.COLUMN_TITLE }, null, null, null); - if (!c.moveToFirst() || c.getString(0) == null) { - values.put(Downloads.Impl.COLUMN_TITLE, - new File(filename).getName()); + if (!c.moveToFirst() || c.getString(0).isEmpty()) { + values.put(Downloads.Impl.COLUMN_TITLE, new File(filename).getName()); } c.close(); } |