diff options
-rw-r--r-- | src/com/android/providers/downloads/DownloadService.java | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/com/android/providers/downloads/DownloadService.java b/src/com/android/providers/downloads/DownloadService.java index 20cf6294..c8e55d7d 100644 --- a/src/com/android/providers/downloads/DownloadService.java +++ b/src/com/android/providers/downloads/DownloadService.java @@ -158,11 +158,9 @@ public class DownloadService extends Service { mAlarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); mStorageManager = new StorageManager(this); - if (mUpdateThread == null) { - mUpdateThread = new HandlerThread(TAG + "-UpdateThread"); - mUpdateThread.start(); - mUpdateHandler = new Handler(mUpdateThread.getLooper(), mUpdateCallback); - } + mUpdateThread = new HandlerThread(TAG + "-UpdateThread"); + mUpdateThread.start(); + mUpdateHandler = new Handler(mUpdateThread.getLooper(), mUpdateCallback); mScanner = new DownloadScanner(this); @@ -187,8 +185,9 @@ public class DownloadService extends Service { @Override public void onDestroy() { - mScanner.shutdown(); getContentResolver().unregisterContentObserver(mObserver); + mScanner.shutdown(); + mUpdateThread.quit(); if (Constants.LOGVV) { Log.v(Constants.TAG, "Service onDestroy"); } @@ -257,8 +256,7 @@ public class DownloadService extends Service { if (stopSelfResult(startId)) { if (DEBUG_LIFECYCLE) Log.v(TAG, "Nothing left; stopped"); - mUpdateHandler.removeMessages(MSG_UPDATE); - mUpdateHandler.removeMessages(MSG_FINAL_UPDATE); + mUpdateThread.quit(); } } |