summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/providers/downloads/DownloadService.java1
-rw-r--r--src/com/android/providers/downloads/DownloadThread.java7
2 files changed, 6 insertions, 2 deletions
diff --git a/src/com/android/providers/downloads/DownloadService.java b/src/com/android/providers/downloads/DownloadService.java
index 34b1b495..66d3be96 100644
--- a/src/com/android/providers/downloads/DownloadService.java
+++ b/src/com/android/providers/downloads/DownloadService.java
@@ -185,6 +185,7 @@ public class DownloadService extends Service {
@Override
public void onDestroy() {
+ mUpdateThread.quit();
mScanner.shutdown();
getContentResolver().unregisterContentObserver(mObserver);
if (Constants.LOGVV) {
diff --git a/src/com/android/providers/downloads/DownloadThread.java b/src/com/android/providers/downloads/DownloadThread.java
index 95754a03..48eebfc0 100644
--- a/src/com/android/providers/downloads/DownloadThread.java
+++ b/src/com/android/providers/downloads/DownloadThread.java
@@ -540,10 +540,13 @@ public class DownloadThread implements Runnable {
state.mSpeed = ((state.mSpeed * 3) + sampleSpeed) / 4;
}
+ // Only notify once we have a full sample window
+ if (state.mSpeedSampleStart != 0) {
+ mNotifier.notifyDownloadSpeed(mInfo.mId, state.mSpeed);
+ }
+
state.mSpeedSampleStart = now;
state.mSpeedSampleBytes = state.mCurrentBytes;
-
- mNotifier.notifyDownloadSpeed(mInfo.mId, state.mSpeed);
}
if (state.mCurrentBytes - state.mBytesNotified > Constants.MIN_PROGRESS_STEP &&