diff options
author | Soojung Shin <sj46.shin@samsung.com> | 2011-03-04 17:16:49 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-03-04 17:16:49 -0800 |
commit | fa680a18f617de202912b8a9fe3fc0890a9fe09e (patch) | |
tree | dfd36cbb1a103b9f060fc89ab051461c6f8a38b1 /core/java | |
parent | 362da509897a497848860ea8b9944ab192ad1e4c (diff) | |
parent | ff5a09904fb05f2776f1bbf1dd3915f38031190c (diff) | |
download | frameworks_base-fa680a18f617de202912b8a9fe3fc0890a9fe09e.zip frameworks_base-fa680a18f617de202912b8a9fe3fc0890a9fe09e.tar.gz frameworks_base-fa680a18f617de202912b8a9fe3fc0890a9fe09e.tar.bz2 |
am ff5a0990: Added to check for supporting mms content-disposition, utf8 decoding.
* commit 'ff5a09904fb05f2776f1bbf1dd3915f38031190c':
Added to check for supporting mms content-disposition, utf8 decoding.
Diffstat (limited to 'core/java')
-rwxr-xr-x[-rw-r--r--] | core/java/com/google/android/mms/pdu/PduParser.java | 74 |
1 files changed, 44 insertions, 30 deletions
diff --git a/core/java/com/google/android/mms/pdu/PduParser.java b/core/java/com/google/android/mms/pdu/PduParser.java index 8edfe52..3f185aa 100644..100755 --- a/core/java/com/google/android/mms/pdu/PduParser.java +++ b/core/java/com/google/android/mms/pdu/PduParser.java @@ -29,6 +29,8 @@ import java.io.UnsupportedEncodingException; import java.util.Arrays; import java.util.HashMap; +import android.content.res.Resources; + public class PduParser { /** * The next are WAP values defined in WSP specification. @@ -1557,43 +1559,55 @@ public class PduParser { * Attachment = <Octet 129> * Inline = <Octet 130> */ - int len = parseValueLength(pduDataStream); - pduDataStream.mark(1); - int thisStartPos = pduDataStream.available(); - int thisEndPos = 0; - int value = pduDataStream.read(); - - if (value == PduPart.P_DISPOSITION_FROM_DATA ) { - part.setContentDisposition(PduPart.DISPOSITION_FROM_DATA); - } else if (value == PduPart.P_DISPOSITION_ATTACHMENT) { - part.setContentDisposition(PduPart.DISPOSITION_ATTACHMENT); - } else if (value == PduPart.P_DISPOSITION_INLINE) { - part.setContentDisposition(PduPart.DISPOSITION_INLINE); - } else { - pduDataStream.reset(); - /* Token-text */ - part.setContentDisposition(parseWapString(pduDataStream, TYPE_TEXT_STRING)); - } - /* get filename parameter and skip other parameters */ - thisEndPos = pduDataStream.available(); - if (thisStartPos - thisEndPos < len) { - value = pduDataStream.read(); - if (value == PduPart.P_FILENAME) { //filename is text-string - part.setFilename(parseWapString(pduDataStream, TYPE_TEXT_STRING)); + /* + * some carrier mmsc servers do not support content_disposition + * field correctly + */ + boolean contentDisposition = Resources.getSystem().getBoolean(com + .android.internal.R.bool.config_mms_content_disposition_support); + + if (contentDisposition) { + int len = parseValueLength(pduDataStream); + pduDataStream.mark(1); + int thisStartPos = pduDataStream.available(); + int thisEndPos = 0; + int value = pduDataStream.read(); + + if (value == PduPart.P_DISPOSITION_FROM_DATA ) { + part.setContentDisposition(PduPart.DISPOSITION_FROM_DATA); + } else if (value == PduPart.P_DISPOSITION_ATTACHMENT) { + part.setContentDisposition(PduPart.DISPOSITION_ATTACHMENT); + } else if (value == PduPart.P_DISPOSITION_INLINE) { + part.setContentDisposition(PduPart.DISPOSITION_INLINE); + } else { + pduDataStream.reset(); + /* Token-text */ + part.setContentDisposition(parseWapString(pduDataStream + , TYPE_TEXT_STRING)); } - /* skip other parameters */ + /* get filename parameter and skip other parameters */ thisEndPos = pduDataStream.available(); if (thisStartPos - thisEndPos < len) { - int last = len - (thisStartPos - thisEndPos); - byte[] temp = new byte[last]; - pduDataStream.read(temp, 0, last); + value = pduDataStream.read(); + if (value == PduPart.P_FILENAME) { //filename is text-string + part.setFilename(parseWapString(pduDataStream + , TYPE_TEXT_STRING)); + } + + /* skip other parameters */ + thisEndPos = pduDataStream.available(); + if (thisStartPos - thisEndPos < len) { + int last = len - (thisStartPos - thisEndPos); + byte[] temp = new byte[last]; + pduDataStream.read(temp, 0, last); + } } - } - tempPos = pduDataStream.available(); - lastLen = length - (startPos - tempPos); + tempPos = pduDataStream.available(); + lastLen = length - (startPos - tempPos); + } break; default: if (LOCAL_LOGV) { |