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

Commit a1c3fede authored by Ameer Ghouse's avatar Ameer Ghouse
Browse files

fix sms receiving for some Samsung CDMA phones

Change-Id: I4639b10e5d1c512135572807f9430e81b6b8869b
parent bcab1a93
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -653,6 +653,10 @@
         If false, Content-disposition fragments are ignored -->
    <bool name="config_mms_content_disposition_support">true</bool>

    <!-- If this value is true, we handle Samsung CDMA's message ID method -->
    <bool name="config_smsSamsungCdmaAlternateMessageIDEncoding">false</bool>


    <!-- National Language Identifier codes for the following two config items.
         (from 3GPP TS 23.038 V9.1.1 Table 6.2.1.2.4.1):
          0  - reserved
+15 −4
Original line number Diff line number Diff line
@@ -878,11 +878,22 @@ public final class BearerData {
            paramBits -= EXPECTED_PARAM_SIZE;
            decodeSuccess = true;
            bData.messageType = inStream.read(4);
            // Some Samsung CDMAphones parses messageId differently than other devices
            // fix it here so that incoming sms works correctly
            boolean hasSamsungCDMAAlternateMessageIDEncoding = Resources.getSystem()
                    .getBoolean(com.android.internal.R.bool.config_smsSamsungCdmaAlternateMessageIDEncoding);
            if (hasSamsungCDMAAlternateMessageIDEncoding) {
                inStream.skip(4);
                bData.messageId = inStream.read(8) << 8;
                bData.messageId |= inStream.read(8);
                bData.hasUserDataHeader = (inStream.read(8) == 1);
            } else {
                bData.messageId = inStream.read(8) << 8;
                bData.messageId |= inStream.read(8);
                bData.hasUserDataHeader = (inStream.read(1) == 1);
                inStream.skip(3);
            }
        }
        if ((! decodeSuccess) || (paramBits > 0)) {
            Log.d(LOG_TAG, "MESSAGE_IDENTIFIER decode " +
                      (decodeSuccess ? "succeeded" : "failed") +