Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d9669f07 authored by Brad Ebinger's avatar Brad Ebinger Committed by android-build-merger
Browse files

Merge "Mms: Add the retrieve conf type support in MMS PDU composer."

am: ece09a1e

Change-Id: I7867f900da5410600e0bcf3858dbc2b7b1d8f0f0
parents e5182a0c ece09a1e
Loading
Loading
Loading
Loading
+22 −6
Original line number Diff line number Diff line
@@ -155,7 +155,8 @@ public class PduComposer {
        /* make the message */
        switch (type) {
            case PduHeaders.MESSAGE_TYPE_SEND_REQ:
                if (makeSendReqPdu() != PDU_COMPOSE_SUCCESS) {
            case PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF:
                if (makeSendRetrievePdu(type) != PDU_COMPOSE_SUCCESS) {
                    return null;
                }
                break;
@@ -564,6 +565,7 @@ public class PduComposer {
            case PduHeaders.PRIORITY:
            case PduHeaders.DELIVERY_REPORT:
            case PduHeaders.READ_REPORT:
            case PduHeaders.RETRIEVE_STATUS:
                int octet = mPduHeader.getOctet(field);
                if (0 == octet) {
                    return PDU_COMPOSE_FIELD_NOT_SET;
@@ -584,6 +586,7 @@ public class PduComposer {
                break;

            case PduHeaders.SUBJECT:
            case PduHeaders.RETRIEVE_TEXT:
                EncodedStringValue enString =
                    mPduHeader.getEncodedStringValue(field);
                if (null == enString) {
@@ -757,7 +760,7 @@ public class PduComposer {
    /**
     * Make Send.req.
     */
    private int makeSendReqPdu() {
    private int makeSendRetrievePdu(int type) {
        if (mMessage == null) {
            mMessage = new ByteArrayOutputStream();
            mPosition = 0;
@@ -765,7 +768,7 @@ public class PduComposer {

        // X-Mms-Message-Type
        appendOctet(PduHeaders.MESSAGE_TYPE);
        appendOctet(PduHeaders.MESSAGE_TYPE_SEND_REQ);
        appendOctet(type);

        // X-Mms-Transaction-ID
        appendOctet(PduHeaders.TRANSACTION_ID);
@@ -831,17 +834,25 @@ public class PduComposer {
        // X-Mms-Read-Report Optional
        appendHeader(PduHeaders.READ_REPORT);

        if (type == PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF) {
            // X-Mms-Retrieve-Status Optional
            appendHeader(PduHeaders.RETRIEVE_STATUS);
            // X-Mms-Retrieve-Text Optional
            appendHeader(PduHeaders.RETRIEVE_TEXT);
        }


        //    Content-Type
        appendOctet(PduHeaders.CONTENT_TYPE);

        //  Message body
        return makeMessageBody();
        return makeMessageBody(type);
    }

    /**
     * Make message body.
     */
    private int makeMessageBody() {
    private int makeMessageBody(int type) {
        // 1. add body informations
        mStack.newbuf();  // Switching buffer because we need to

@@ -858,7 +869,12 @@ public class PduComposer {
        appendShortInteger(contentTypeIdentifier.intValue());

        // content-type parameter: start
        PduBody body = ((SendReq) mPdu).getBody();
        PduBody body;
        if (type == PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF) {
            body = ((RetrieveConf) mPdu).getBody();
        } else {
            body = ((SendReq) mPdu).getBody();
        }
        if (null == body || body.getPartsNum() == 0) {
            // empty message
            appendUintvarInteger(0);