Trim the database & check spurious files off the UI thread.
Brad Fitzpatrick [Tue, 28 Sep 2010 19:32:08 +0000 (12:32 -0700)]
Change-Id: I92180fc4344579b93361d5584243688a1cfdd091

src/com/android/providers/downloads/DownloadService.java

index 62598b7..c79ecc4 100644 (file)
@@ -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