Merge "More whack-a-mole in AttachmentDownloadService"

This commit is contained in:
Marc Blank 2011-08-03 14:55:26 -07:00 committed by Android (Google) Code Review
commit 4418596f9b

View File

@ -336,9 +336,11 @@ public class AttachmentDownloadService extends Service implements Runnable {
}
// Don't prefetch if background downloading is disallowed
if (!mConnectivityManager.isBackgroundDataAllowed()) return;
EmailConnectivityManager ecm = mConnectivityManager;
if (ecm == null) return;
if (!ecm.isBackgroundDataAllowed()) return;
// Don't prefetch unless we're on a WiFi network
if (mConnectivityManager.getActiveNetworkType() != ConnectivityManager.TYPE_WIFI) {
if (ecm.getActiveNetworkType() != ConnectivityManager.TYPE_WIFI) {
return;
}
// Then, try opportunistic download of appropriate attachments