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

Commit 84d043eb authored by Thomas Nguyen's avatar Thomas Nguyen Committed by Android (Google) Code Review
Browse files

Merge "Fix for GSM-8bit encoding error" into tm-qpr-dev

parents c35b5aeb 470f0294
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1019,6 +1019,17 @@ public class SmsMessage {
        return mWrappedSmsMessage.isReplyPathPresent();
    }

    /**
     * Return the encoding type of a received SMS message, which is specified using ENCODING_*
     * GSM: defined in android.telephony.SmsConstants
     * CDMA: defined in android.telephony.cdma.UserData
     *
     * @hide
     */
    public int getReceivedEncodingType() {
        return mWrappedSmsMessage.getReceivedEncodingType();
    }

    /**
     * Determines whether or not to use CDMA format for MO SMS.
     * If SMS over IMS is supported, then format is based on IMS SMS format,
+15 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.internal.telephony;

import static com.android.internal.telephony.SmsConstants.ENCODING_UNKNOWN;

import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
import android.telephony.SmsMessage;
@@ -93,6 +95,15 @@ public abstract class SmsMessageBase {
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    protected boolean mMwiDontStore;

    /**
     * The encoding type of a received SMS message, which is specified using ENCODING_*
     * GSM: defined in android.telephony.SmsConstants
     * CDMA: defined in android.telephony.cdma.UserData
     *
     * @hide
     */
    protected int mReceivedEncodingType = ENCODING_UNKNOWN;

    /**
     * Indicates status for messages stored on the ICC.
     */
@@ -512,4 +523,8 @@ public abstract class SmsMessageBase {

        return mRecipientAddress.getAddressString();
    }

    public int getReceivedEncodingType() {
        return mReceivedEncodingType;
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -780,6 +780,7 @@ public class SmsMessage extends SmsMessageBase {
            mUserData = mBearerData.userData.payload;
            mUserDataHeader = mBearerData.userData.userDataHeader;
            mMessageBody = mBearerData.userData.payloadStr;
            mReceivedEncodingType = mBearerData.userData.msgEncoding;
        }

        if (mOriginatingAddress != null) {
@@ -860,6 +861,9 @@ public class SmsMessage extends SmsMessageBase {
            Rlog.w(LOG_TAG, "BearerData.decode() returned null");
            return null;
        }
        if (bData.userData != null) {
            mReceivedEncodingType = bData.userData.msgEncoding;
        }

        if (Rlog.isLoggable(LOGGABLE_TAG, Log.VERBOSE)) {
            Rlog.d(LOG_TAG, "MT raw BearerData = " + HexDump.toHexString(mEnvelope.bearerData));
+17 −16
Original line number Diff line number Diff line
@@ -1404,10 +1404,10 @@ public class SmsMessage extends SmsMessageBase {
                        break;

                case 1: // 8 bit data
                    //Support decoding the user data payload as pack GSM 8-bit (a GSM alphabet string
                    //that's stored in 8-bit unpacked format) characters.
                    if (r.getBoolean(com.android.internal.
                            R.bool.config_sms_decode_gsm_8bit_data)) {
                        // Support decoding the user data payload as pack GSM 8-bit (a GSM alphabet
                        // string that's stored in 8-bit unpacked format) characters.
                        if (r.getBoolean(com.android.internal
                                .R.bool.config_sms_decode_gsm_8bit_data)) {
                            encodingType = ENCODING_8BIT;
                            break;
                        }
@@ -1492,6 +1492,7 @@ public class SmsMessage extends SmsMessageBase {
                encodingType == ENCODING_7BIT);
        this.mUserData = p.getUserData();
        this.mUserDataHeader = p.getUserDataHeader();
        this.mReceivedEncodingType = encodingType;

        /*
         * Look for voice mail indication in TP_UDH TS23.040 9.2.3.24