Move download cancel logic into helper

Bug: 3255707
Change-Id: I7f92bd1bb90a4430426123551075746ba9d4af85
This commit is contained in:
Marc Blank 2010-12-08 12:03:47 -08:00
parent 91431ca077
commit 69fc25244b

View File

@ -297,7 +297,7 @@ public class AttachmentDownloadService extends Service implements Runnable {
Log.d(TAG, "== , Download of " + req.attachmentId +
" timed out");
}
mDownloadsInProgress.remove(req);
cancelDownload(req);
// STOPSHIP Remove this before ship
} else if (Email.DEBUG) {
Log.d(TAG, "== , Download of " + req.attachmentId +
@ -373,12 +373,16 @@ public class AttachmentDownloadService extends Service implements Runnable {
} catch (RemoteException e) {
// TODO: Consider whether we need to do more in this case...
// For now, fix up our data to reflect the failure
mDownloadsInProgress.remove(req.attachmentId);
req.inProgress = false;
cancelDownload(req);
}
return true;
}
private void cancelDownload(DownloadRequest req) {
mDownloadsInProgress.remove(req.attachmentId);
req.inProgress = false;
}
/**
* Called when a download is finished; we get notified of this via our EmailServiceCallback
* @param attachmentId the id of the attachment whose download is finished