am 36cc9c18: Fix NPE in AttachmentDownloadServiceTests.testDownloadSet

* commit '36cc9c18edb7ee897d0d758788b6e338cb2ef126':
  Fix NPE in AttachmentDownloadServiceTests.testDownloadSet
This commit is contained in:
Makoto Onuki 2011-01-14 12:01:11 -08:00 committed by Android Git Automerger
commit 91551ae19b

View File

@ -90,7 +90,7 @@ public class AttachmentDownloadService extends Service implements Runnable {
/*package*/ static AttachmentDownloadService sRunningService = null;
/*package*/ Context mContext;
Preferences mPreferences;
private final Preferences mPreferences;
/*package*/ final DownloadSet mDownloadSet = new DownloadSet(new DownloadComparator());
private final HashMap<Long, Class<? extends Service>> mAccountServiceMap =
@ -521,7 +521,7 @@ public class AttachmentDownloadService extends Service implements Runnable {
}
// If we're an attachment on forwarded mail, and if we're not still blocked,
// try to send pending mail now (as mediated by MailService)
if ((req != null) &&
if ((req != null) &&
!Utility.hasUnloadedAttachments(mContext, attachment.mMessageKey)) {
if (Email.DEBUG) {
Log.d(TAG, "== Downloads finished for outgoing msg #" + req.messageId);
@ -547,6 +547,10 @@ public class AttachmentDownloadService extends Service implements Runnable {
}
}
public AttachmentDownloadService() {
mPreferences = Preferences.getPreferences(this);
}
/**
* Calculate the download priority of an Attachment. A priority of zero means that the
* attachment is not marked for download.
@ -786,7 +790,6 @@ public class AttachmentDownloadService extends Service implements Runnable {
public void run() {
mContext = this;
mAccountManagerStub = new AccountManagerStub(this);
mPreferences = Preferences.getPreferences(this);
// Run through all attachments in the database that require download and add them to
// the queue