From 0f2f63932bd8d963764d37527b3237d219fdaa4d Mon Sep 17 00:00:00 2001 From: Fabrice Di Meglio Date: Tue, 26 Mar 2013 03:12:57 +0000 Subject: Revert "Avoid sending messages after HandlerThread.quit()." This reverts commit 97d507d95f9885ceb12f2ce2483361b5ed265f9f Change-Id: I20374301561b3a1c79c2d986292af50049de2aac --- .../android/providers/downloads/DownloadService.java | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/com/android/providers/downloads/DownloadService.java b/src/com/android/providers/downloads/DownloadService.java index c519faaf..6c61193c 100644 --- a/src/com/android/providers/downloads/DownloadService.java +++ b/src/com/android/providers/downloads/DownloadService.java @@ -189,7 +189,6 @@ public class DownloadService extends Service { getContentResolver().unregisterContentObserver(mObserver); mScanner.shutdown(); mUpdateThread.quit(); - mUpdateThread = null; if (Constants.LOGVV) { Log.v(Constants.TAG, "Service onDestroy"); } @@ -200,10 +199,8 @@ public class DownloadService extends Service { * Enqueue an {@link #updateLocked()} pass to occur in future. */ private void enqueueUpdate() { - if (mUpdateThread != null) { - mUpdateHandler.removeMessages(MSG_UPDATE); - mUpdateHandler.obtainMessage(MSG_UPDATE, mLastStartId, -1).sendToTarget(); - } + mUpdateHandler.removeMessages(MSG_UPDATE); + mUpdateHandler.obtainMessage(MSG_UPDATE, mLastStartId, -1).sendToTarget(); } /** @@ -211,12 +208,10 @@ public class DownloadService extends Service { * catch any finished operations that didn't trigger an update pass. */ private void enqueueFinalUpdate() { - if (mUpdateThread != null) { - mUpdateHandler.removeMessages(MSG_FINAL_UPDATE); - mUpdateHandler.sendMessageDelayed( - mUpdateHandler.obtainMessage(MSG_FINAL_UPDATE, mLastStartId, -1), - 5 * MINUTE_IN_MILLIS); - } + mUpdateHandler.removeMessages(MSG_FINAL_UPDATE); + mUpdateHandler.sendMessageDelayed( + mUpdateHandler.obtainMessage(MSG_FINAL_UPDATE, mLastStartId, -1), + 5 * MINUTE_IN_MILLIS); } private static final int MSG_UPDATE = 1; @@ -274,7 +269,6 @@ public class DownloadService extends Service { if (stopSelfResult(startId)) { if (DEBUG_LIFECYCLE) Log.v(TAG, "Nothing left; stopped"); mUpdateThread.quit(); - mUpdateThread = null; } } -- cgit v1.2.3