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

Commit 5c7d9e81 authored by David Krause's avatar David Krause Committed by Wink Saville
Browse files

CDMA incoming MMS fixes

Need to correctly interpret WAP Datagram data. Specifically the
source and destination ports are only included in the 1st segment,
not subsequent segments but the original implementation was looking
for the ports for all segments.
parent 4a64bded
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -78,6 +78,7 @@ public abstract class SMSDispatcher extends Handler {
    protected static final String[] RAW_PROJECTION = new String[] {
    protected static final String[] RAW_PROJECTION = new String[] {
        "pdu",
        "pdu",
        "sequence",
        "sequence",
        "destination_port",
    };
    };


    static final int MAIL_SEND_SMS = 1;
    static final int MAIL_SEND_SMS = 1;
+15 −7
Original line number Original line Diff line number Diff line
@@ -168,8 +168,8 @@ final class CdmaSMSDispatcher extends SMSDispatcher {
        int index = 0;
        int index = 0;
        int msgType;
        int msgType;


        int sourcePort;
        int sourcePort = 0;
        int destinationPort;
        int destinationPort = 0;


        msgType = pdu[index++];
        msgType = pdu[index++];
        if (msgType != 0){
        if (msgType != 0){
@@ -179,11 +179,14 @@ final class CdmaSMSDispatcher extends SMSDispatcher {
        totalSegments = pdu[index++]; // >=1
        totalSegments = pdu[index++]; // >=1
        segment = pdu[index++]; // >=0
        segment = pdu[index++]; // >=0


        // Only the first segment contains sourcePort and destination Port
        if (segment == 0) {
            //process WDP segment
            //process WDP segment
            sourcePort = (0xFF & pdu[index++]) << 8;
            sourcePort = (0xFF & pdu[index++]) << 8;
            sourcePort |= 0xFF & pdu[index++];
            sourcePort |= 0xFF & pdu[index++];
            destinationPort = (0xFF & pdu[index++]) << 8;
            destinationPort = (0xFF & pdu[index++]) << 8;
            destinationPort |= 0xFF & pdu[index++];
            destinationPort |= 0xFF & pdu[index++];
        }


        // Lookup all other related parts
        // Lookup all other related parts
        StringBuilder where = new StringBuilder("reference_number =");
        StringBuilder where = new StringBuilder("reference_number =");
@@ -224,6 +227,11 @@ final class CdmaSMSDispatcher extends SMSDispatcher {
            for (int i = 0; i < cursorCount; i++) {
            for (int i = 0; i < cursorCount; i++) {
                cursor.moveToNext();
                cursor.moveToNext();
                int cursorSequence = (int)cursor.getLong(sequenceColumn);
                int cursorSequence = (int)cursor.getLong(sequenceColumn);
                // Read the destination port from the first segment
                if (cursorSequence == 0) {
                    int destinationPortColumn = cursor.getColumnIndex("destination_port");
                    destinationPort = (int)cursor.getLong(destinationPortColumn);
                }
                pdus[cursorSequence] = HexDump.hexStringToByteArray(
                pdus[cursorSequence] = HexDump.hexStringToByteArray(
                        cursor.getString(pduColumn));
                        cursor.getString(pduColumn));
            }
            }