Add logging to see why attachments fail to load
b/11436795 Now, if we ever insert or update an attachment to have a blank location, we'll log a warning with stack trace. Also, logging from ADS now uses the same log tag as everything else, so we'll be able to see it without needing to turn on some funny log tag. Change-Id: Ic566cd87e8893128d074b897d7594a01ae12bc8c
This commit is contained in:
parent
6ceae42b30
commit
5ed194434f
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 + "%");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue