summaryrefslogtreecommitdiffstats
path: root/src/com/android/providers/downloads/DownloadService.java
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2012-07-24 17:42:25 -0700
committerJeff Sharkey <jsharkey@android.com>2012-07-24 17:45:41 -0700
commit36612d27b67ff2e79ffff8eb12d95d2058abde02 (patch)
treeddfc011a999b8f16c6a39b69832e9efa956e9d98 /src/com/android/providers/downloads/DownloadService.java
parent8bf3f8c68bf2c617a07a63756481f73ec4d1d466 (diff)
downloadandroid_packages_providers_DownloadProvider-36612d27b67ff2e79ffff8eb12d95d2058abde02.tar.gz
android_packages_providers_DownloadProvider-36612d27b67ff2e79ffff8eb12d95d2058abde02.tar.bz2
android_packages_providers_DownloadProvider-36612d27b67ff2e79ffff8eb12d95d2058abde02.zip
Move notification tests to LittleMock.
Directly mock NotificationManager instead of using SystemFacade. Change-Id: If932d26e23816e8674469c275a828701cce5fc2d
Diffstat (limited to 'src/com/android/providers/downloads/DownloadService.java')
-rw-r--r--src/com/android/providers/downloads/DownloadService.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/com/android/providers/downloads/DownloadService.java b/src/com/android/providers/downloads/DownloadService.java
index 55efefcf..7030deae 100644
--- a/src/com/android/providers/downloads/DownloadService.java
+++ b/src/com/android/providers/downloads/DownloadService.java
@@ -19,6 +19,7 @@ package com.android.providers.downloads;
import static com.android.providers.downloads.Constants.TAG;
import android.app.AlarmManager;
+import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.ComponentName;
@@ -65,6 +66,7 @@ public class DownloadService extends Service {
/** Class to handle Notification Manager updates */
private DownloadNotification mNotifier;
+ private NotificationManager mNotifManager;
/**
* The Service's view of the list of downloads, mapping download IDs to the corresponding info
@@ -221,7 +223,9 @@ public class DownloadService extends Service {
mMediaScannerConnection = new MediaScannerConnection();
mNotifier = new DownloadNotification(this, mSystemFacade);
- mSystemFacade.cancelAllNotifications();
+ mNotifManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+ mNotifManager.cancelAll();
+
mStorageManager = StorageManager.getInstance(getApplicationContext());
updateFromProvider();
}
@@ -464,7 +468,7 @@ public class DownloadService extends Service {
!Downloads.Impl.isStatusCompleted(oldStatus)
&& Downloads.Impl.isStatusCompleted(info.mStatus);
if (lostVisibility || justCompleted) {
- mSystemFacade.cancelNotification(info.mId);
+ mNotifManager.cancel((int) info.mId);
}
info.startIfReady(now, mStorageManager);
@@ -487,7 +491,7 @@ public class DownloadService extends Service {
}
new File(info.mFileName).delete();
}
- mSystemFacade.cancelNotification(info.mId);
+ mNotifManager.cancel((int) info.mId);
mDownloads.remove(info.mId);
}