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

Commit 70cb78d9 authored by jt1134's avatar jt1134
Browse files

fascinate: fix parsing of incoming sms' messageId

Change-Id: Id46c31bf2114176d684a60be4b4d86d1da558b3c
parent a84cb3f1
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ import static android.telephony.SmsMessage.ENCODING_16BIT;
import static android.telephony.SmsMessage.MAX_USER_DATA_BYTES;
import static android.telephony.SmsMessage.MAX_USER_DATA_BYTES_WITH_HEADER;

import android.os.SystemProperties;

import android.util.Log;

import android.telephony.SmsMessage;
@@ -876,11 +878,20 @@ public final class BearerData {
            paramBits -= EXPECTED_PARAM_SIZE;
            decodeSuccess = true;
            bData.messageType = inStream.read(4);
            // Samsung Fascinate parses messageId differently than other devices
            // fix it here so that incoming sms works correctly
            if ("fascinatemtd".equals(SystemProperties.get("ro.product.device"))) {
                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") +