Loading android/app/src/com/android/bluetooth/map/BluetoothMapContent.java +22 −2 Original line number Diff line number Diff line Loading @@ -3810,8 +3810,6 @@ public class BluetoothMapContent { * @param message the bMessage object to add the information to */ private void extractMmsParts(long id, BluetoothMapbMessageMime message) { /* Handling of filtering out non-text parts for exclude * attachments is handled within the bMessage object. */ final String[] projection = null; String selection = new String(Mms.Part.MSG_ID + "=" + id); String uriStr = new String(Mms.CONTENT_URI + "/" + id + "/part"); Loading Loading @@ -3847,6 +3845,28 @@ public class BluetoothMapContent { part.mContentLocation = cl; part.mContentDisposition = cdisp; // Filtering out non-text parts (e.g., an image) when attachments are to be // excluded is currently handled within the "message" object's encoding // function (c.f., BluetoothMapbMessageMime.encodeMime()), where the // attachment is replaced with a text string containing the part name or // filename. // However, replacing with text during encoding is too late, as charset // information does not get properly set and propagated. For example, if a MMS // consists only of a GIF, it's mimetype is "image/gif" and not "text", so // according to spec, "charset" should not be set. However, if the attachment // is replaced with a text string, the bMessage now contains text and should // have charset set to UTF-8 according to spec. if (!message.getIncludeAttachments()) { StringBuilder sb = new StringBuilder(); try { part.encodePlainText(sb); text = sb.toString(); part.mContentType = "text"; } catch (UnsupportedEncodingException e) { Log.d(TAG, "extractMmsParts", e); } } try { if (text != null) { part.mData = text.getBytes("UTF-8"); Loading Loading
android/app/src/com/android/bluetooth/map/BluetoothMapContent.java +22 −2 Original line number Diff line number Diff line Loading @@ -3810,8 +3810,6 @@ public class BluetoothMapContent { * @param message the bMessage object to add the information to */ private void extractMmsParts(long id, BluetoothMapbMessageMime message) { /* Handling of filtering out non-text parts for exclude * attachments is handled within the bMessage object. */ final String[] projection = null; String selection = new String(Mms.Part.MSG_ID + "=" + id); String uriStr = new String(Mms.CONTENT_URI + "/" + id + "/part"); Loading Loading @@ -3847,6 +3845,28 @@ public class BluetoothMapContent { part.mContentLocation = cl; part.mContentDisposition = cdisp; // Filtering out non-text parts (e.g., an image) when attachments are to be // excluded is currently handled within the "message" object's encoding // function (c.f., BluetoothMapbMessageMime.encodeMime()), where the // attachment is replaced with a text string containing the part name or // filename. // However, replacing with text during encoding is too late, as charset // information does not get properly set and propagated. For example, if a MMS // consists only of a GIF, it's mimetype is "image/gif" and not "text", so // according to spec, "charset" should not be set. However, if the attachment // is replaced with a text string, the bMessage now contains text and should // have charset set to UTF-8 according to spec. if (!message.getIncludeAttachments()) { StringBuilder sb = new StringBuilder(); try { part.encodePlainText(sb); text = sb.toString(); part.mContentType = "text"; } catch (UnsupportedEncodingException e) { Log.d(TAG, "extractMmsParts", e); } } try { if (text != null) { part.mData = text.getBytes("UTF-8"); Loading