From 3398db8f3b195959faa2a7cf09918f364432ac28 Mon Sep 17 00:00:00 2001 From: Steve Howard Date: Wed, 15 Sep 2010 12:29:50 -0700 Subject: 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 --- tests/src/com/android/providers/downloads/FakeSystemFacade.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/src/com/android/providers') diff --git a/tests/src/com/android/providers/downloads/FakeSystemFacade.java b/tests/src/com/android/providers/downloads/FakeSystemFacade.java index 40b2a900..d80bd4ad 100644 --- a/tests/src/com/android/providers/downloads/FakeSystemFacade.java +++ b/tests/src/com/android/providers/downloads/FakeSystemFacade.java @@ -19,7 +19,7 @@ public class FakeSystemFacade implements SystemFacade { boolean mIsRoaming = false; Long mMaxBytesOverMobile = null; List mBroadcastsSent = new ArrayList(); - Map mActiveNotifications = new HashMap(); + Map mActiveNotifications = new HashMap(); List mCanceledNotifications = new ArrayList(); Queue mStartedThreads = new LinkedList(); @@ -54,7 +54,7 @@ public class FakeSystemFacade implements SystemFacade { } @Override - public void postNotification(int id, Notification notification) { + public void postNotification(long id, Notification notification) { if (notification == null) { throw new AssertionFailedError("Posting null notification"); } @@ -62,7 +62,7 @@ public class FakeSystemFacade implements SystemFacade { } @Override - public void cancelNotification(int id) { + public void cancelNotification(long id) { Notification notification = mActiveNotifications.remove(id); if (notification != null) { mCanceledNotifications.add(notification); @@ -71,7 +71,7 @@ public class FakeSystemFacade implements SystemFacade { @Override public void cancelAllNotifications() { - for (int id : mActiveNotifications.keySet()) { + for (long id : mActiveNotifications.keySet()) { cancelNotification(id); } } -- cgit v1.2.3