summaryrefslogtreecommitdiffstats
path: root/src/com/android/providers/downloads/DownloadService.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/providers/downloads/DownloadService.java')
-rw-r--r--src/com/android/providers/downloads/DownloadService.java14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/com/android/providers/downloads/DownloadService.java b/src/com/android/providers/downloads/DownloadService.java
index 62598b7c..8fbcf4b4 100644
--- a/src/com/android/providers/downloads/DownloadService.java
+++ b/src/com/android/providers/downloads/DownloadService.java
@@ -196,8 +196,6 @@ public class DownloadService extends Service {
mNotifier = new DownloadNotification(this, mSystemFacade);
mSystemFacade.cancelAllNotifications();
- trimDatabase();
- removeSpuriousFiles();
updateFromProvider();
}
@@ -243,6 +241,9 @@ public class DownloadService extends Service {
public void run() {
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
+ trimDatabase();
+ removeSpuriousFiles();
+
boolean keepService = false;
// for each update from the database, remember which download is
// supposed to get restarted soonest in the future
@@ -438,10 +439,7 @@ public class DownloadService extends Service {
info.logVerboseInfo();
}
- if (info.isReadyToStart(now)) {
- info.start(now);
- }
-
+ info.startIfReady(now);
return info;
}
@@ -465,9 +463,7 @@ public class DownloadService extends Service {
mSystemFacade.cancelNotification(info.mId);
}
- if (info.isReadyToRestart(now)) {
- info.start(now);
- }
+ info.startIfReady(now);
}
/**