diff options
author | Steve Kondik <shade@chemlab.org> | 2012-11-18 22:33:11 -0800 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2012-11-18 22:33:11 -0800 |
commit | 516f77f561e1388ae94fe1a26d2a31960074158a (patch) | |
tree | a01a9e9deb200f593008b0763f475471502b6728 /src/com/android/providers/downloads/DownloadService.java | |
parent | 59a409bbc018124a275fbedc9e7d0166e0e18cca (diff) | |
parent | 2fa007ef678b2283d47d007aa3dc91af683cc52c (diff) | |
download | android_packages_providers_DownloadProvider-516f77f561e1388ae94fe1a26d2a31960074158a.tar.gz android_packages_providers_DownloadProvider-516f77f561e1388ae94fe1a26d2a31960074158a.tar.bz2 android_packages_providers_DownloadProvider-516f77f561e1388ae94fe1a26d2a31960074158a.zip |
Merge branch 'jb-mr1-release' of https://android.googlesource.com/platform/packages/providers/DownloadProvider into HEADcm-10.1-M1
Diffstat (limited to 'src/com/android/providers/downloads/DownloadService.java')
-rw-r--r-- | src/com/android/providers/downloads/DownloadService.java | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/com/android/providers/downloads/DownloadService.java b/src/com/android/providers/downloads/DownloadService.java index 3b566f8e..8380830a 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; @@ -38,7 +39,6 @@ import android.os.RemoteException; import android.provider.Downloads; import android.text.TextUtils; import android.util.Log; -import android.util.Slog; import com.android.internal.util.IndentingPrintWriter; import com.google.android.collect.Maps; @@ -66,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 @@ -222,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(); } @@ -465,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); @@ -476,17 +479,16 @@ public class DownloadService extends Service { */ private void deleteDownloadLocked(long id) { DownloadInfo info = mDownloads.get(id); - if (info.shouldScanFile()) { - scanFile(info, false, false); - } if (info.mStatus == Downloads.Impl.STATUS_RUNNING) { info.mStatus = Downloads.Impl.STATUS_CANCELED; } if (info.mDestination != Downloads.Impl.DESTINATION_EXTERNAL && info.mFileName != null) { - Slog.d(TAG, "deleteDownloadLocked() deleting " + info.mFileName); + if (Constants.LOGVV) { + Log.d(TAG, "deleteDownloadLocked() deleting " + info.mFileName); + } new File(info.mFileName).delete(); } - mSystemFacade.cancelNotification(info.mId); + mNotifManager.cancel((int) info.mId); mDownloads.remove(info.mId); } @@ -559,7 +561,9 @@ public class DownloadService extends Service { private void deleteFileIfExists(String path) { try { if (!TextUtils.isEmpty(path)) { - Slog.d(TAG, "deleteFileIfExists() deleting " + path); + if (Constants.LOGVV) { + Log.d(TAG, "deleteFileIfExists() deleting " + path); + } File file = new File(path); file.delete(); } |