Fix the previous downloads logic to not missing any downloads.

Bug: 21797386
Change-Id: Ic09698b28e31b4f16831898d7cb08853f4e5df4a
main
Mohammadinamul Sheik 2015-06-22 20:23:01 -07:00
parent 73aaf68337
commit bf7c0106b0
1 changed files with 5 additions and 7 deletions

View File

@ -122,13 +122,11 @@ public final class SystemBroadcastReceiver extends BroadcastReceiver {
| DownloadManager.STATUS_RUNNING);
final Cursor c = downloadManagerWrapper.query(q);
if (c != null) {
if (c.moveToFirst()) {
while (c.moveToNext()) {
final long downloadId = c
.getLong(c.getColumnIndex(DownloadManager.COLUMN_ID));
downloadManagerWrapper.remove(downloadId);
Log.i(TAG, "Removed the download with Id: " + downloadId);
}
for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) {
final long downloadId = c
.getLong(c.getColumnIndex(DownloadManager.COLUMN_ID));
downloadManagerWrapper.remove(downloadId);
Log.i(TAG, "Removed the download with Id: " + downloadId);
}
c.close();
}