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

Commit 089a13f6 authored by kschulz's avatar kschulz Committed by Matthew Xie
Browse files

Fixed missing size of incoming MMS messages

The message size was set to 0 for incoming mms messages.
This makes some BT MAP clients behave faulty when fething
a list of messags from the device.

BUG: 17389452, 17311194
Change-Id: I89b2f2cf5e2dbbc389edb2275ad21a0174a3115e
parent d1f95a9e
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -157,6 +157,18 @@ public class PduPart {
         return byteArray;
     }

    /**
     * @return The length of the data, if this object have data, else 0.
     */
     public int getDataLength() {
         if(mPartData != null){
             return mPartData.length;
         } else {
             return 0;
         }
     }


     /**
      * Set data uri. The data are stored as Uri.
      *
+10 −1
Original line number Diff line number Diff line
@@ -1380,6 +1380,9 @@ public class PduPersister {
        // Figure out if this PDU is a text-only message
        boolean textOnly = true;

        // Sum up the total message size
        int messageSize = 0;

        // Get body if the PDU is a RetrieveConf or SendReq.
        if (pdu instanceof MultimediaMessagePdu) {
            body = ((MultimediaMessagePdu) pdu).getBody();
@@ -1395,6 +1398,7 @@ public class PduPersister {
                }
                for (int i = 0; i < partsNum; i++) {
                    PduPart part = body.getPart(i);
                    messageSize += part.getDataLength();
                    persistPart(part, dummyId, preOpenedFiles);

                    // If we've got anything besides text/plain or SMIL part, then we've got
@@ -1410,6 +1414,11 @@ public class PduPersister {
        // Record whether this mms message is a simple plain text or not. This is a hint for the
        // UI.
        values.put(Mms.TEXT_ONLY, textOnly ? 1 : 0);
        // The message-size might already have been inserted when parsing the
        // PDU header. If not, then we insert the message size as well.
        if (values.getAsInteger(Mms.MESSAGE_SIZE) == null) {
            values.put(Mms.MESSAGE_SIZE, messageSize);
        }

        Uri res = null;
        if (existingUri) {