diff options
author | Steve Howard <showard@google.com> | 2010-07-20 12:45:18 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-07-20 12:45:18 -0700 |
commit | b607c31e50fdd08258a489b881b2ad5ff5f75d0d (patch) | |
tree | 10f656f3c68a849a6ec1a666adb2415e075e9ef2 /src/com/android/providers/downloads | |
parent | 7d4a4bc1f4bf92906598ede0160ff234d1179dd4 (diff) | |
parent | 5180de23e77139dd6971dfd48269242e3e3562d9 (diff) | |
download | android_packages_providers_DownloadProvider-b607c31e50fdd08258a489b881b2ad5ff5f75d0d.tar.gz android_packages_providers_DownloadProvider-b607c31e50fdd08258a489b881b2ad5ff5f75d0d.tar.bz2 android_packages_providers_DownloadProvider-b607c31e50fdd08258a489b881b2ad5ff5f75d0d.zip |
am 5180de23: Fix bug with deciding when to restart a download.
Merge commit '5180de23e77139dd6971dfd48269242e3e3562d9' into gingerbread-plus-aosp
* commit '5180de23e77139dd6971dfd48269242e3e3562d9':
Fix bug with deciding when to restart a download.
Diffstat (limited to 'src/com/android/providers/downloads')
-rw-r--r-- | src/com/android/providers/downloads/DownloadInfo.java | 36 | ||||
-rw-r--r-- | src/com/android/providers/downloads/DownloadService.java | 8 |
2 files changed, 23 insertions, 21 deletions
diff --git a/src/com/android/providers/downloads/DownloadInfo.java b/src/com/android/providers/downloads/DownloadInfo.java index 5cd50c92..153e0454 100644 --- a/src/com/android/providers/downloads/DownloadInfo.java +++ b/src/com/android/providers/downloads/DownloadInfo.java @@ -289,25 +289,23 @@ public class DownloadInfo { return mTotalBytes <= maxBytesOverMobile; } - void startIfReady(long now) { - if (isReadyToStart(now)) { - if (Constants.LOGV) { - Log.v(Constants.TAG, "Service spawning thread to handle download " + mId); - } - if (mHasActiveThread) { - throw new IllegalStateException("Multiple threads on same download"); - } - if (mStatus != Impl.STATUS_RUNNING) { - mStatus = Impl.STATUS_RUNNING; - ContentValues values = new ContentValues(); - values.put(Impl.COLUMN_STATUS, mStatus); - mContext.getContentResolver().update( - ContentUris.withAppendedId(Impl.CONTENT_URI, mId), - values, null, null); - } - DownloadThread downloader = new DownloadThread(mContext, mSystemFacade, this); - mHasActiveThread = true; - downloader.start(); + void start(long now) { + if (Constants.LOGV) { + Log.v(Constants.TAG, "Service spawning thread to handle download " + mId); + } + if (mHasActiveThread) { + throw new IllegalStateException("Multiple threads on same download"); + } + if (mStatus != Impl.STATUS_RUNNING) { + mStatus = Impl.STATUS_RUNNING; + ContentValues values = new ContentValues(); + values.put(Impl.COLUMN_STATUS, mStatus); + mContext.getContentResolver().update( + ContentUris.withAppendedId(Impl.CONTENT_URI, mId), + values, null, null); } + DownloadThread downloader = new DownloadThread(mContext, mSystemFacade, this); + mHasActiveThread = true; + downloader.start(); } } diff --git a/src/com/android/providers/downloads/DownloadService.java b/src/com/android/providers/downloads/DownloadService.java index e474d4d7..f870954b 100644 --- a/src/com/android/providers/downloads/DownloadService.java +++ b/src/com/android/providers/downloads/DownloadService.java @@ -614,7 +614,9 @@ public class DownloadService extends Service { } } - info.startIfReady(now); + if (info.isReadyToStart(now)) { + info.start(now); + } } /** @@ -674,7 +676,9 @@ public class DownloadService extends Service { info.mMediaScanned = cursor.getInt(cursor.getColumnIndexOrThrow(Constants.MEDIA_SCANNED)) == 1; - info.startIfReady(now); + if (info.isReadyToRestart(now)) { + info.start(now); + } } /** |