Merge "Add logging to see why attachments fail to load" into jb-ub-mail-ur10

This commit is contained in:
Martin Hibdon 2013-11-01 01:22:15 +00:00 committed by Android (Google) Code Review
commit c085911eee
2 changed files with 17 additions and 2 deletions

View File

@ -863,6 +863,9 @@ public class EmailProvider extends ContentProvider {
flags = values.getAsInteger(Attachment.FLAGS);
}
// Report all new attachments to the download service
if (TextUtils.isEmpty(values.getAsString(Attachment.LOCATION))) {
LogUtils.w(TAG, new Throwable(), "attachment with blank location");
}
mAttachmentService.attachmentChanged(getContext(), longId, flags);
break;
}
@ -1875,6 +1878,12 @@ public class EmailProvider extends ContentProvider {
case ACCOUNT:
case HOSTAUTH:
case POLICY:
if (match == ATTACHMENT) {
if (values.containsKey(AttachmentColumns.LOCATION) &&
TextUtils.isEmpty(values.getAsString(AttachmentColumns.LOCATION))) {
LogUtils.w(TAG, new Throwable(), "attachment with blank location");
}
}
result = db.update(tableName, values, selection, selectionArgs);
break;
@ -4700,6 +4709,12 @@ public class EmailProvider extends ContentProvider {
destinationValue == null ? 0 : destinationValue);
values.put(AttachmentColumns.FLAGS,
attachment.mFlags | Attachment.FLAG_DOWNLOAD_USER_REQUEST);
if (values.containsKey(AttachmentColumns.LOCATION) &&
TextUtils.isEmpty(values.getAsString(AttachmentColumns.LOCATION))) {
LogUtils.w(TAG, new Throwable(), "attachment with blank location");
}
attachment.update(context, values);
result = 1;
}

View File

@ -59,7 +59,7 @@ import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
public class AttachmentDownloadService extends Service implements Runnable {
public static final String TAG = "AttachmentService";
public static final String TAG = LogUtils.TAG;
// Minimum wait time before retrying a download that failed due to connection error
private static final long CONNECTION_ERROR_RETRY_MILLIS = 10 * DateUtils.SECOND_IN_MILLIS;
@ -714,7 +714,7 @@ public class AttachmentDownloadService extends Service implements Runnable {
}
if (statusCode != EmailServiceStatus.IN_PROGRESS) {
LogUtils.d(TAG, ">> Attachment " + attachmentId + ": " + code);
} else if (progress >= (req.lastProgress + 15)) {
} else if (progress >= (req.lastProgress + 10)) {
LogUtils.d(TAG, ">> Attachment " + attachmentId + ": " + progress + "%");
}
}