Merge "Only use single UpdateThread."
diff --git a/src/com/android/providers/downloads/DownloadService.java b/src/com/android/providers/downloads/DownloadService.java
index 66d3be9..20cf629 100644
--- a/src/com/android/providers/downloads/DownloadService.java
+++ b/src/com/android/providers/downloads/DownloadService.java
@@ -158,9 +158,11 @@
mAlarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
mStorageManager = new StorageManager(this);
- mUpdateThread = new HandlerThread(TAG + "-UpdateThread");
- mUpdateThread.start();
- mUpdateHandler = new Handler(mUpdateThread.getLooper(), mUpdateCallback);
+ if (mUpdateThread == null) {
+ mUpdateThread = new HandlerThread(TAG + "-UpdateThread");
+ mUpdateThread.start();
+ mUpdateHandler = new Handler(mUpdateThread.getLooper(), mUpdateCallback);
+ }
mScanner = new DownloadScanner(this);
@@ -185,7 +187,6 @@
@Override
public void onDestroy() {
- mUpdateThread.quit();
mScanner.shutdown();
getContentResolver().unregisterContentObserver(mObserver);
if (Constants.LOGVV) {