Purge unused/obsolete body fields
Change-Id: Idafa09b58f5753e4cb3cad754c861cc8e3d80c34
This commit is contained in:
parent
0e26184ac7
commit
fd69e5b036
@ -465,19 +465,6 @@ public abstract class EmailContent {
|
|||||||
CONTENT_URI = Uri.parse(EmailContent.CONTENT_URI + "/body");
|
CONTENT_URI = Uri.parse(EmailContent.CONTENT_URI + "/body");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final int CONTENT_ID_COLUMN = 0;
|
|
||||||
public static final int CONTENT_MESSAGE_KEY_COLUMN = 1;
|
|
||||||
public static final int CONTENT_HTML_CONTENT_COLUMN = 2;
|
|
||||||
public static final int CONTENT_TEXT_CONTENT_COLUMN = 3;
|
|
||||||
@Deprecated
|
|
||||||
public static final int CONTENT_HTML_REPLY_COLUMN = 4;
|
|
||||||
@Deprecated
|
|
||||||
public static final int CONTENT_TEXT_REPLY_COLUMN = 5;
|
|
||||||
public static final int CONTENT_SOURCE_KEY_COLUMN = 6;
|
|
||||||
@Deprecated
|
|
||||||
public static final int CONTENT_INTRO_TEXT_COLUMN = 7;
|
|
||||||
public static final int CONTENT_QUOTED_TEXT_START_POS_COLUMN = 8;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Following values are for EmailMessageCursor
|
* Following values are for EmailMessageCursor
|
||||||
*/
|
*/
|
||||||
@ -493,34 +480,23 @@ public abstract class EmailContent {
|
|||||||
BodyColumns.MESSAGE_KEY,
|
BodyColumns.MESSAGE_KEY,
|
||||||
BodyColumns.HTML_CONTENT,
|
BodyColumns.HTML_CONTENT,
|
||||||
BodyColumns.TEXT_CONTENT,
|
BodyColumns.TEXT_CONTENT,
|
||||||
BodyColumns.HTML_REPLY,
|
|
||||||
BodyColumns.TEXT_REPLY,
|
|
||||||
BodyColumns.SOURCE_MESSAGE_KEY,
|
BodyColumns.SOURCE_MESSAGE_KEY,
|
||||||
BodyColumns.INTRO_TEXT,
|
|
||||||
BodyColumns.QUOTED_TEXT_START_POS
|
BodyColumns.QUOTED_TEXT_START_POS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static final int CONTENT_ID_COLUMN = 0;
|
||||||
|
public static final int CONTENT_MESSAGE_KEY_COLUMN = 1;
|
||||||
|
public static final int CONTENT_HTML_CONTENT_COLUMN = 2;
|
||||||
|
public static final int CONTENT_TEXT_CONTENT_COLUMN = 3;
|
||||||
|
public static final int CONTENT_SOURCE_KEY_COLUMN = 4;
|
||||||
|
public static final int CONTENT_QUOTED_TEXT_START_POS_COLUMN = 5;
|
||||||
|
|
||||||
public static final String[] COMMON_PROJECTION_TEXT = new String[] {
|
public static final String[] COMMON_PROJECTION_TEXT = new String[] {
|
||||||
BodyColumns._ID, BodyColumns.TEXT_CONTENT
|
BodyColumns._ID, BodyColumns.TEXT_CONTENT
|
||||||
};
|
};
|
||||||
public static final String[] COMMON_PROJECTION_HTML = new String[] {
|
public static final String[] COMMON_PROJECTION_HTML = new String[] {
|
||||||
BodyColumns._ID, BodyColumns.HTML_CONTENT
|
BodyColumns._ID, BodyColumns.HTML_CONTENT
|
||||||
};
|
};
|
||||||
@Deprecated
|
|
||||||
private static final String[] COMMON_PROJECTION_REPLY_TEXT = new String[] {
|
|
||||||
BodyColumns._ID, BodyColumns.TEXT_REPLY
|
|
||||||
};
|
|
||||||
@Deprecated
|
|
||||||
private static final String[] COMMON_PROJECTION_REPLY_HTML = new String[] {
|
|
||||||
BodyColumns._ID, BodyColumns.HTML_REPLY
|
|
||||||
};
|
|
||||||
@Deprecated
|
|
||||||
private static final String[] COMMON_PROJECTION_INTRO = new String[] {
|
|
||||||
BodyColumns._ID, BodyColumns.INTRO_TEXT
|
|
||||||
};
|
|
||||||
public static final String[] COMMON_PROJECTION_SOURCE = new String[] {
|
|
||||||
BodyColumns._ID, BodyColumns.SOURCE_MESSAGE_KEY
|
|
||||||
};
|
|
||||||
public static final int COMMON_PROJECTION_COLUMN_TEXT = 1;
|
public static final int COMMON_PROJECTION_COLUMN_TEXT = 1;
|
||||||
|
|
||||||
private static final String[] PROJECTION_SOURCE_KEY =
|
private static final String[] PROJECTION_SOURCE_KEY =
|
||||||
@ -529,18 +505,12 @@ public abstract class EmailContent {
|
|||||||
public long mMessageKey;
|
public long mMessageKey;
|
||||||
public String mHtmlContent;
|
public String mHtmlContent;
|
||||||
public String mTextContent;
|
public String mTextContent;
|
||||||
@Deprecated
|
|
||||||
public String mHtmlReply;
|
|
||||||
@Deprecated
|
|
||||||
public String mTextReply;
|
|
||||||
public int mQuotedTextStartPos;
|
public int mQuotedTextStartPos;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Points to the ID of the message being replied to or forwarded. Will always be set.
|
* Points to the ID of the message being replied to or forwarded. Will always be set.
|
||||||
*/
|
*/
|
||||||
public long mSourceKey;
|
public long mSourceKey;
|
||||||
@Deprecated
|
|
||||||
public String mIntroText;
|
|
||||||
|
|
||||||
public Body() {
|
public Body() {
|
||||||
mBaseUri = CONTENT_URI;
|
mBaseUri = CONTENT_URI;
|
||||||
@ -554,10 +524,7 @@ public abstract class EmailContent {
|
|||||||
values.put(BodyColumns.MESSAGE_KEY, mMessageKey);
|
values.put(BodyColumns.MESSAGE_KEY, mMessageKey);
|
||||||
values.put(BodyColumns.HTML_CONTENT, mHtmlContent);
|
values.put(BodyColumns.HTML_CONTENT, mHtmlContent);
|
||||||
values.put(BodyColumns.TEXT_CONTENT, mTextContent);
|
values.put(BodyColumns.TEXT_CONTENT, mTextContent);
|
||||||
values.put(BodyColumns.HTML_REPLY, mHtmlReply);
|
|
||||||
values.put(BodyColumns.TEXT_REPLY, mTextReply);
|
|
||||||
values.put(BodyColumns.SOURCE_MESSAGE_KEY, mSourceKey);
|
values.put(BodyColumns.SOURCE_MESSAGE_KEY, mSourceKey);
|
||||||
values.put(BodyColumns.INTRO_TEXT, mIntroText);
|
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -653,21 +620,6 @@ public abstract class EmailContent {
|
|||||||
return restoreTextWithMessageId(context, messageId, Body.COMMON_PROJECTION_HTML);
|
return restoreTextWithMessageId(context, messageId, Body.COMMON_PROJECTION_HTML);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static String restoreReplyTextWithMessageId(Context context, long messageId) {
|
|
||||||
return restoreTextWithMessageId(context, messageId, Body.COMMON_PROJECTION_REPLY_TEXT);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static String restoreReplyHtmlWithMessageId(Context context, long messageId) {
|
|
||||||
return restoreTextWithMessageId(context, messageId, Body.COMMON_PROJECTION_REPLY_HTML);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static String restoreIntroTextWithMessageId(Context context, long messageId) {
|
|
||||||
return restoreTextWithMessageId(context, messageId, Body.COMMON_PROJECTION_INTRO);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String readBodyFromPipe(ParcelFileDescriptor d) {
|
private static String readBodyFromPipe(ParcelFileDescriptor d) {
|
||||||
final AutoCloseInputStream htmlInput = new AutoCloseInputStream(d);
|
final AutoCloseInputStream htmlInput = new AutoCloseInputStream(d);
|
||||||
String content = null;
|
String content = null;
|
||||||
@ -710,10 +662,7 @@ public abstract class EmailContent {
|
|||||||
if (textDescriptor != null) {
|
if (textDescriptor != null) {
|
||||||
mTextContent = readBodyFromPipe(textDescriptor);
|
mTextContent = readBodyFromPipe(textDescriptor);
|
||||||
}
|
}
|
||||||
mHtmlReply = cursor.getString(CONTENT_HTML_REPLY_COLUMN);
|
|
||||||
mTextReply = cursor.getString(CONTENT_TEXT_REPLY_COLUMN);
|
|
||||||
mSourceKey = cursor.getLong(CONTENT_SOURCE_KEY_COLUMN);
|
mSourceKey = cursor.getLong(CONTENT_SOURCE_KEY_COLUMN);
|
||||||
mIntroText = cursor.getString(CONTENT_INTRO_TEXT_COLUMN);
|
|
||||||
mQuotedTextStartPos = cursor.getInt(CONTENT_QUOTED_TEXT_START_POS_COLUMN);
|
mQuotedTextStartPos = cursor.getInt(CONTENT_QUOTED_TEXT_START_POS_COLUMN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,8 +235,7 @@ public class LegacyConversions {
|
|||||||
|
|
||||||
// Run the mime type through inferMimeType in case we have something generic and can do
|
// Run the mime type through inferMimeType in case we have something generic and can do
|
||||||
// better using the filename extension
|
// better using the filename extension
|
||||||
String mimeType = AttachmentUtilities.inferMimeType(name, part.getMimeType());
|
localAttachment.mMimeType = AttachmentUtilities.inferMimeType(name, part.getMimeType());
|
||||||
localAttachment.mMimeType = mimeType;
|
|
||||||
localAttachment.mFileName = name;
|
localAttachment.mFileName = name;
|
||||||
localAttachment.mSize = size; // May be reset below if file handled
|
localAttachment.mSize = size; // May be reset below if file handled
|
||||||
localAttachment.mContentId = part.getContentId();
|
localAttachment.mContentId = part.getContentId();
|
||||||
@ -394,36 +393,6 @@ public class LegacyConversions {
|
|||||||
LogUtils.d(Logging.LOG_TAG, "Exception while reading text body " + rte.toString());
|
LogUtils.d(Logging.LOG_TAG, "Exception while reading text body " + rte.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isReply = (localMessage.mFlags & EmailContent.Message.FLAG_TYPE_REPLY) != 0;
|
|
||||||
boolean isForward = (localMessage.mFlags & EmailContent.Message.FLAG_TYPE_FORWARD) != 0;
|
|
||||||
|
|
||||||
// If there is a quoted part (forwarding or reply), add the intro first, and then the
|
|
||||||
// rest of it. If it is opened in some other viewer, it will (hopefully) be displayed in
|
|
||||||
// the same order as we've just set up the blocks: composed text, intro, replied text
|
|
||||||
if (isReply || isForward) {
|
|
||||||
try {
|
|
||||||
addTextBodyPart(mp, "text/plain", BODY_QUOTED_PART_INTRO,
|
|
||||||
EmailContent.Body.restoreIntroTextWithMessageId(context, localMessage.mId));
|
|
||||||
} catch (RuntimeException rte) {
|
|
||||||
LogUtils.d(Logging.LOG_TAG, "Exception while reading text reply " + rte.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
String replyTag = isReply ? BODY_QUOTED_PART_REPLY : BODY_QUOTED_PART_FORWARD;
|
|
||||||
try {
|
|
||||||
addTextBodyPart(mp, "text/html", replyTag,
|
|
||||||
EmailContent.Body.restoreReplyHtmlWithMessageId(context, localMessage.mId));
|
|
||||||
} catch (RuntimeException rte) {
|
|
||||||
LogUtils.d(Logging.LOG_TAG, "Exception while reading html reply " + rte.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
addTextBodyPart(mp, "text/plain", replyTag,
|
|
||||||
EmailContent.Body.restoreReplyTextWithMessageId(context, localMessage.mId));
|
|
||||||
} catch (RuntimeException rte) {
|
|
||||||
LogUtils.d(Logging.LOG_TAG, "Exception while reading text reply " + rte.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Attachments
|
// Attachments
|
||||||
Uri uri = ContentUris.withAppendedId(Attachment.MESSAGE_ID_URI, localMessage.mId);
|
Uri uri = ContentUris.withAppendedId(Attachment.MESSAGE_ID_URI, localMessage.mId);
|
||||||
Cursor attachments = context.getContentResolver().query(uri, Attachment.CONTENT_PROJECTION,
|
Cursor attachments = context.getContentResolver().query(uri, Attachment.CONTENT_PROJECTION,
|
||||||
|
@ -123,9 +123,6 @@ public class Utilities {
|
|||||||
localMessage.mSnippet = data.snippet;
|
localMessage.mSnippet = data.snippet;
|
||||||
body.mTextContent = data.textContent;
|
body.mTextContent = data.textContent;
|
||||||
body.mHtmlContent = data.htmlContent;
|
body.mHtmlContent = data.htmlContent;
|
||||||
body.mHtmlReply = data.htmlReply;
|
|
||||||
body.mTextReply = data.textReply;
|
|
||||||
body.mIntroText = data.introText;
|
|
||||||
|
|
||||||
// Commit the message & body to the local store immediately
|
// Commit the message & body to the local store immediately
|
||||||
saveOrUpdate(localMessage, context);
|
saveOrUpdate(localMessage, context);
|
||||||
|
Loading…
Reference in New Issue
Block a user