From e4974d1f2a3bc69150aac21fccd8c3b78cb90891 Mon Sep 17 00:00:00 2001 From: Tom Taylor Date: Wed, 21 Jul 2010 11:22:05 -0700 Subject: [PATCH] Fix a merge problem with html mms Html mms message support was added back in Jan '10. At that time, we had moved the mms code out of the framework into the mms app. We decided to back out that change and leave the mms code in its original place. As a result, the changes to support html messages were lost. This handmerged CL restores those changes. I'll cherry-pick this into master as well. Bug 2858888 Change-Id: I2c2a72743de02b13033203fcbedb36a4b53ad1c9 --- core/java/com/google/android/mms/pdu/PduParser.java | 4 +++- core/java/com/google/android/mms/pdu/PduPersister.java | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/core/java/com/google/android/mms/pdu/PduParser.java b/core/java/com/google/android/mms/pdu/PduParser.java index 92d5cc42db6ea..8edfe52a5928a 100644 --- a/core/java/com/google/android/mms/pdu/PduParser.java +++ b/core/java/com/google/android/mms/pdu/PduParser.java @@ -157,9 +157,11 @@ public class PduParser { } String ctTypeStr = new String(contentType); if (ctTypeStr.equals(ContentType.MULTIPART_MIXED) - || ctTypeStr.equals(ContentType.MULTIPART_RELATED)) { + || ctTypeStr.equals(ContentType.MULTIPART_RELATED) + || ctTypeStr.equals(ContentType.MULTIPART_ALTERNATIVE)) { // The MMS content type must be "application/vnd.wap.multipart.mixed" // or "application/vnd.wap.multipart.related" + // or "application/vnd.wap.multipart.alternative" return retrieveConf; } else if (ctTypeStr.equals(ContentType.MULTIPART_ALTERNATIVE)) { // "application/vnd.wap.multipart.alternative" diff --git a/core/java/com/google/android/mms/pdu/PduPersister.java b/core/java/com/google/android/mms/pdu/PduPersister.java index d4ac24a62def1..9fdd20498cc3b 100644 --- a/core/java/com/google/android/mms/pdu/PduPersister.java +++ b/core/java/com/google/android/mms/pdu/PduPersister.java @@ -422,7 +422,8 @@ public class PduPersister { // Store simple string values directly in the database instead of an // external file. This makes the text searchable and retrieval slightly // faster. - if ("text/plain".equals(type) || "application/smil".equals(type)) { + if (ContentType.TEXT_PLAIN.equals(type) || ContentType.APP_SMIL.equals(type) + || ContentType.TEXT_HTML.equals(type)) { String text = c.getString(PART_COLUMN_TEXT); byte [] blob = new EncodedStringValue(text != null ? text : "") .getTextString(); @@ -736,7 +737,9 @@ public class PduPersister { try { byte[] data = part.getData(); - if ("text/plain".equals(contentType) || "application/smil".equals(contentType)) { + if (ContentType.TEXT_PLAIN.equals(contentType) + || ContentType.APP_SMIL.equals(contentType) + || ContentType.TEXT_HTML.equals(contentType)) { ContentValues cv = new ContentValues(); cv.put(Telephony.Mms.Part.TEXT, new EncodedStringValue(data).getString()); if (mContentResolver.update(uri, cv, null, null) != 1) {