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

Commit 31202b1a authored by Jake Hamby's avatar Jake Hamby Committed by Android Git Automerger
Browse files

am 3f442ece: Merge "Fix character count bug and Javadoc typos in SMS (with...

am 3f442ece: Merge "Fix character count bug and Javadoc typos in SMS (with test cases)" into gingerbread

Merge commit '3f442ece' into gingerbread-plus-aosp

* commit '3f442ece':
  Fix character count bug and Javadoc typos in SMS (with test cases)
parents d22a1e89 3f442ece
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -304,9 +304,9 @@ public class SmsMessage {
            int septets = GsmAlphabet.countGsmSeptets(messageBody, !use7bitOnly);
            ret[1] = septets;
            if (septets > MAX_USER_DATA_SEPTETS) {
                ret[0] = (septets / MAX_USER_DATA_SEPTETS_WITH_HEADER) + 1;
                ret[2] = MAX_USER_DATA_SEPTETS_WITH_HEADER
                            - (septets % MAX_USER_DATA_SEPTETS_WITH_HEADER);
                ret[0] = (septets + (MAX_USER_DATA_SEPTETS_WITH_HEADER - 1)) /
                            MAX_USER_DATA_SEPTETS_WITH_HEADER;
                ret[2] = (ret[0] * MAX_USER_DATA_SEPTETS_WITH_HEADER) - septets;
            } else {
                ret[0] = 1;
                ret[2] = MAX_USER_DATA_SEPTETS - septets;
@@ -318,9 +318,9 @@ public class SmsMessage {
            ret[1] = messageBody.length();
            if (octets > MAX_USER_DATA_BYTES) {
                // 6 is the size of the user data header
                ret[0] = (octets / MAX_USER_DATA_BYTES_WITH_HEADER) + 1;
                ret[2] = (MAX_USER_DATA_BYTES_WITH_HEADER
                            - (octets % MAX_USER_DATA_BYTES_WITH_HEADER))/2;
                ret[0] = (octets + (MAX_USER_DATA_BYTES_WITH_HEADER - 1)) /
                            MAX_USER_DATA_BYTES_WITH_HEADER;
                ret[2] = ((ret[0] * MAX_USER_DATA_BYTES_WITH_HEADER) - octets) / 2;
            } else {
                ret[0] = 1;
                ret[2] = (MAX_USER_DATA_BYTES - octets)/2;
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ import android.util.Log;

/**
 * This class implements the character set mapping between
 * the GSM SMS 7-bit alphabet specifed in TS 23.038 6.2.1
 * the GSM SMS 7-bit alphabet specified in TS 23.038 6.2.1
 * and UTF-16
 *
 * {@hide}
+3 −3
Original line number Diff line number Diff line
@@ -287,7 +287,7 @@ public class SmsMessage extends SmsMessageBase {
     * @param destAddr              Address of the recipient.
     * @param message               String representation of the message payload.
     * @param statusReportRequested Indicates whether a report is requested for this message.
     * @param headerData            Array containing the data for the User Data Header, preceded
     * @param smsHeader             Array containing the data for the User Data Header, preceded
     *                              by the Element Identifiers.
     * @return a <code>SubmitPdu</code> containing the encoded SC
     *         address, if applicable, and the encoded message.
@@ -355,7 +355,7 @@ public class SmsMessage extends SmsMessageBase {
     * Get an SMS-SUBMIT PDU for a data message to a destination address &amp; port
     *
     * @param destAddr the address of the destination for the message
     * @param userDara the data for the message
     * @param userData the data for the message
     * @param statusReportRequested Indicates whether a report is requested for this message.
     * @return a <code>SubmitPdu</code> containing the encoded SC
     *         address, if applicable, and the encoded message.
@@ -446,7 +446,7 @@ public class SmsMessage extends SmsMessageBase {
     */
    public static TextEncodingDetails calculateLength(CharSequence messageBody,
            boolean use7bitOnly) {
        return BearerData.calcTextEncodingDetails(messageBody.toString(), use7bitOnly);
        return BearerData.calcTextEncodingDetails(messageBody, use7bitOnly);
    }

    /**
+8 −7
Original line number Diff line number Diff line
@@ -405,7 +405,8 @@ public final class BearerData {
    /**
     * Calculate the message text encoding length, fragmentation, and other details.
     *
     * @param force ignore (but still count) illegal characters if true
     * @param msg message text
     * @param force7BitEncoding ignore (but still count) illegal characters if true
     * @return septet count, or -1 on failure
     */
    public static TextEncodingDetails calcTextEncodingDetails(CharSequence msg,
@@ -427,9 +428,10 @@ public final class BearerData {
                ted.codeUnitCount = msg.length();
                int octets = ted.codeUnitCount * 2;
                if (octets > MAX_USER_DATA_BYTES) {
                    ted.msgCount = (octets / MAX_USER_DATA_BYTES_WITH_HEADER) + 1;
                    ted.codeUnitsRemaining = (MAX_USER_DATA_BYTES_WITH_HEADER
                              - (octets % MAX_USER_DATA_BYTES_WITH_HEADER))/2;
                    ted.msgCount = (octets + (MAX_USER_DATA_BYTES_WITH_HEADER - 1)) /
                            MAX_USER_DATA_BYTES_WITH_HEADER;
                    ted.codeUnitsRemaining = ((ted.msgCount *
                            MAX_USER_DATA_BYTES_WITH_HEADER) - octets) / 2;
                } else {
                    ted.msgCount = 1;
                    ted.codeUnitsRemaining = (MAX_USER_DATA_BYTES - octets)/2;
@@ -802,9 +804,8 @@ public final class BearerData {
     * Create serialized representation for BearerData object.
     * (See 3GPP2 C.R1001-F, v1.0, section 4.5 for layout details)
     *
     * @param bearerData an instance of BearerData.
     *
     * @return data byta array of raw encoded SMS bearer data.
     * @param bData an instance of BearerData.
     * @return byte array of raw encoded SMS bearer data.
     */
    public static byte[] encode(BearerData bData) {
        bData.hasUserDataHeader = ((bData.userData != null) &&
+8 −6
Original line number Diff line number Diff line
@@ -800,9 +800,10 @@ public class SmsMessage extends SmsMessageBase{
            int septets = GsmAlphabet.countGsmSeptets(msgBody, !use7bitOnly);
            ted.codeUnitCount = septets;
            if (septets > MAX_USER_DATA_SEPTETS) {
                ted.msgCount = (septets / MAX_USER_DATA_SEPTETS_WITH_HEADER) + 1;
                ted.codeUnitsRemaining = MAX_USER_DATA_SEPTETS_WITH_HEADER
                    - (septets % MAX_USER_DATA_SEPTETS_WITH_HEADER);
                ted.msgCount = (septets + (MAX_USER_DATA_SEPTETS_WITH_HEADER - 1)) /
                        MAX_USER_DATA_SEPTETS_WITH_HEADER;
                ted.codeUnitsRemaining = (ted.msgCount *
                        MAX_USER_DATA_SEPTETS_WITH_HEADER) - septets;
            } else {
                ted.msgCount = 1;
                ted.codeUnitsRemaining = MAX_USER_DATA_SEPTETS - septets;
@@ -812,9 +813,10 @@ public class SmsMessage extends SmsMessageBase{
            int octets = msgBody.length() * 2;
            ted.codeUnitCount = msgBody.length();
            if (octets > MAX_USER_DATA_BYTES) {
                ted.msgCount = (octets / MAX_USER_DATA_BYTES_WITH_HEADER) + 1;
                ted.codeUnitsRemaining = (MAX_USER_DATA_BYTES_WITH_HEADER
                          - (octets % MAX_USER_DATA_BYTES_WITH_HEADER))/2;
                ted.msgCount = (octets + (MAX_USER_DATA_BYTES_WITH_HEADER - 1)) /
                        MAX_USER_DATA_BYTES_WITH_HEADER;
                ted.codeUnitsRemaining = ((ted.msgCount *
                        MAX_USER_DATA_BYTES_WITH_HEADER) - octets) / 2;
            } else {
                ted.msgCount = 1;
                ted.codeUnitsRemaining = (MAX_USER_DATA_BYTES - octets)/2;
Loading