diff options
author | Steve Howard <showard@google.com> | 2010-07-23 20:32:21 -0700 |
---|---|---|
committer | Steve Howard <showard@google.com> | 2010-07-23 20:32:21 -0700 |
commit | 93155e1da7e89d4925e244f5afa94afb8ada7381 (patch) | |
tree | a5cafd34f505277bf760162711eda1d90d9e0d4a /src/com/android/providers/downloads/DownloadNotification.java | |
parent | 691fc58e9a61d99ab5018c5ddc8349ed413e4470 (diff) | |
download | android_packages_providers_DownloadProvider-93155e1da7e89d4925e244f5afa94afb8ada7381.tar.gz android_packages_providers_DownloadProvider-93155e1da7e89d4925e244f5afa94afb8ada7381.tar.bz2 android_packages_providers_DownloadProvider-93155e1da7e89d4925e244f5afa94afb8ada7381.zip |
Stub out and test system notifications.
This change abstracts NotificationManager interactions behind
SystemFacade and takes advantage of that to test notifications, to a
limited degree.
It also fixes a silly typo in AbstractDownloadManagerFunctionalTest,
and it introduces an extra sleep between tests to avoid some
flakiness. I'll look for a better solution to that problem after this
change goes in.
Change-Id: I3a0307f828955cd45b0e3581ad499da28cc0556e
Diffstat (limited to 'src/com/android/providers/downloads/DownloadNotification.java')
-rw-r--r-- | src/com/android/providers/downloads/DownloadNotification.java | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/com/android/providers/downloads/DownloadNotification.java b/src/com/android/providers/downloads/DownloadNotification.java index 3c0b7d9b..76bffbc6 100644 --- a/src/com/android/providers/downloads/DownloadNotification.java +++ b/src/com/android/providers/downloads/DownloadNotification.java @@ -17,7 +17,6 @@ package com.android.providers.downloads; import android.app.Notification; -import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; @@ -38,8 +37,8 @@ import java.util.HashMap; class DownloadNotification { Context mContext; - public NotificationManager mNotificationMgr; HashMap <String, NotificationItem> mNotifications; + private SystemFacade mSystemFacade; static final String LOGTAG = "DownloadNotification"; static final String WHERE_RUNNING = @@ -93,10 +92,9 @@ class DownloadNotification { * @param ctx The context to use to obtain access to the * Notification Service */ - DownloadNotification(Context ctx) { + DownloadNotification(Context ctx, SystemFacade systemFacade) { mContext = ctx; - mNotificationMgr = (NotificationManager) mContext - .getSystemService(Context.NOTIFICATION_SERVICE); + mSystemFacade = systemFacade; mNotifications = new HashMap<String, NotificationItem>(); } @@ -208,7 +206,7 @@ class DownloadNotification { n.contentIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0); - mNotificationMgr.notify(item.mId, n); + mSystemFacade.postNotification(item.mId, n); } } @@ -287,7 +285,7 @@ class DownloadNotification { intent.setData(contentUri); n.deleteIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0); - mNotificationMgr.notify(c.getInt(idColumn), n); + mSystemFacade.postNotification(c.getInt(idColumn), n); } c.close(); } |