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

Commit 893f2410 authored by Ramya Manoharan's avatar Ramya Manoharan Committed by Jack Yu
Browse files

TP - Message reference for SMS SUBMIT type

Addition of the TP - Message reference in pdu for SMS-SUBMIT type
Test: Build
Bug: 228299168

Merged-In: I421db7ca022977ed5d76ce6f7cf0fb36b53482bb
Change-Id: I421db7ca022977ed5d76ce6f7cf0fb36b53482bb
parent 96952591
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -415,6 +415,21 @@ public class ImsSmsDispatcher extends SMSDispatcher {
                statusReportRequested);
    }

    @Override
    protected SmsMessageBase.SubmitPduBase getSubmitPdu(String scAddr, String destAddr,
            String message, boolean statusReportRequested, SmsHeader smsHeader, int priority,
            int validityPeriod, int messageRef) {
        return SMSDispatcherUtil.getSubmitPdu(isCdmaMo(), scAddr, destAddr, message,
                statusReportRequested, smsHeader, priority, validityPeriod, messageRef);
    }

    @Override
    protected SmsMessageBase.SubmitPduBase getSubmitPdu(String scAddr, String destAddr,
            int destPort, byte[] message, boolean statusReportRequested, int messageRef) {
        return SMSDispatcherUtil.getSubmitPdu(isCdmaMo(), scAddr, destAddr, destPort, message,
                statusReportRequested, messageRef);
    }

    @Override
    protected TextEncodingDetails calculateLength(CharSequence messageBody, boolean use7bitOnly) {
        return SMSDispatcherUtil.calculateLength(isCdmaMo(), messageBody, use7bitOnly);
+8 −0
Original line number Diff line number Diff line
@@ -1425,6 +1425,14 @@ public abstract class SMSDispatcher extends Handler {
    protected abstract SmsMessageBase.SubmitPduBase getSubmitPdu(String scAddr, String destAddr,
            int destPort, byte[] message, boolean statusReportRequested);

    protected abstract SmsMessageBase.SubmitPduBase getSubmitPdu(String scAddr, String destAddr,
            String message, boolean statusReportRequested, SmsHeader smsHeader,
            int priority, int validityPeriod, int messageRef);


    protected abstract SmsMessageBase.SubmitPduBase getSubmitPdu(String scAddr, String destAddr,
            int destPort, byte[] message, boolean statusReportRequested, int messageRef);

    /**
     * Calculate the number of septets needed to encode the message. This function should only be
     * called for individual segments of multipart message.
+15 −0
Original line number Diff line number Diff line
@@ -92,6 +92,21 @@ public class CdmaSMSDispatcher extends SMSDispatcher {
                statusReportRequested);
    }

    @Override
    protected SmsMessageBase.SubmitPduBase getSubmitPdu(String scAddr, String destAddr,
            String message, boolean statusReportRequested, SmsHeader smsHeader, int priority,
            int validityPeriod, int messageRef) {
        return SMSDispatcherUtil.getSubmitPduCdma(scAddr, destAddr, message,
                statusReportRequested, smsHeader, priority);
    }

    @Override
    protected SmsMessageBase.SubmitPduBase getSubmitPdu(String scAddr, String destAddr,
            int destPort, byte[] message, boolean statusReportRequested, int messageRef) {
        return SMSDispatcherUtil.getSubmitPduCdma(scAddr, destAddr, destPort, message,
                statusReportRequested);
    }

    @Override
    protected TextEncodingDetails calculateLength(CharSequence messageBody, boolean use7bitOnly) {
        return SMSDispatcherUtil.calculateLengthCdma(messageBody, use7bitOnly);
+15 −0
Original line number Diff line number Diff line
@@ -119,6 +119,21 @@ public final class GsmSMSDispatcher extends SMSDispatcher {
                statusReportRequested);
    }

    @Override
    protected SmsMessageBase.SubmitPduBase getSubmitPdu(String scAddr, String destAddr,
            String message, boolean statusReportRequested, SmsHeader smsHeader, int priority,
            int validityPeriod, int messageRef) {
        return SMSDispatcherUtil.getSubmitPduGsm(scAddr, destAddr, message, statusReportRequested,
                validityPeriod, messageRef);
    }

    @Override
    protected SmsMessageBase.SubmitPduBase getSubmitPdu(String scAddr, String destAddr,
            int destPort, byte[] message, boolean statusReportRequested, int messageRef) {
        return SMSDispatcherUtil.getSubmitPduGsm(scAddr, destAddr, destPort, message,
                statusReportRequested, messageRef);
    }

    @Override
    protected TextEncodingDetails calculateLength(CharSequence messageBody, boolean use7bitOnly) {
        return SMSDispatcherUtil.calculateLengthGsm(messageBody, use7bitOnly);
+104 −4
Original line number Diff line number Diff line
@@ -16,12 +16,11 @@

package com.android.internal.telephony.util;

import com.android.internal.telephony.ImsSmsDispatcher;
import com.android.internal.telephony.cdma.CdmaSMSDispatcher;
import com.android.internal.telephony.GsmAlphabet.TextEncodingDetails;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.SmsMessageBase;
import com.android.internal.telephony.ImsSmsDispatcher;
import com.android.internal.telephony.SmsHeader;
import com.android.internal.telephony.SmsMessageBase;
import com.android.internal.telephony.cdma.CdmaSMSDispatcher;
import com.android.internal.telephony.gsm.GsmSMSDispatcher;

/**
@@ -94,6 +93,46 @@ public final class SMSDispatcherUtil {
        }
    }

    /**
     * Trigger the proper implementation for getting submit pdu for text sms based on format.
     *
     * @param isCdma true if cdma format should be used.
     * @param scAddr is the service center address or null to use the current default SMSC
     * @param destAddr the address to send the message to
     * @param message the body of the message.
     * @param statusReportRequested whether or not a status report is requested.
     * @param smsHeader message header.
     * @param priority Priority level of the message
     *  Refer specification See 3GPP2 C.S0015-B, v2.0, table 4.5.9-1
     *  ---------------------------------
     *  PRIORITY      | Level of Priority
     *  ---------------------------------
     *      '00'      |     Normal
     *      '01'      |     Interactive
     *      '10'      |     Urgent
     *      '11'      |     Emergency
     *  ----------------------------------
     *  Any Other values included Negative considered as Invalid Priority Indicator of the message.
     * @param validityPeriod Validity Period of the message in mins.
     *  Refer specification 3GPP TS 23.040 V6.8.1 section 9.2.3.12.1.
     *  Validity Period(Minimum) -> 5 mins
     *  Validity Period(Maximum) -> 635040 mins(i.e.63 weeks).
     *  Any Other values included Negative considered as Invalid Validity Period of the message.
     * @param messageRef TP Message Reference number
     * @return the submit pdu.
     */
    public static SmsMessageBase.SubmitPduBase getSubmitPdu(boolean isCdma, String scAddr,
            String destAddr, String message, boolean statusReportRequested, SmsHeader smsHeader,
            int priority, int validityPeriod, int messageRef) {
        if (isCdma) {
            return getSubmitPduCdma(scAddr, destAddr, message, statusReportRequested, smsHeader,
                    priority);
        } else {
            return getSubmitPduGsm(scAddr, destAddr, message, statusReportRequested,
                    validityPeriod, messageRef);
        }
    }

    /**
     * Gsm implementation for
     * {@link #getSubmitPdu(boolean, String, String, String, boolean)}
@@ -131,6 +170,28 @@ public final class SMSDispatcherUtil {
                statusReportRequested, validityPeriod);
    }

    /**
     * Gsm implementation for
     * {@link #getSubmitPdu(boolean, String, String, String, boolean, int)}
     *
     * @param scAddr is the service center address or null to use the current default SMSC
     * @param destAddr the address to send the message to
     * @param message the body of the message.
     * @param statusReportRequested whether or not a status report is requested.
     * @param validityPeriod Validity Period of the message in mins.
     *  Refer specification 3GPP TS 23.040 V6.8.1 section 9.2.3.12.1.
     *  Validity Period(Minimum) -> 5 mins
     *  Validity Period(Maximum) -> 635040 mins(i.e.63 weeks).
     *  Any Other values included Negative considered as Invalid Validity Period of the message.
     * @param messageRef TP Message Reference number
     * @return the submit pdu.
     */
    public static SmsMessageBase.SubmitPduBase getSubmitPduGsm(String scAddr, String destAddr,
            String message, boolean statusReportRequested, int validityPeriod, int messageRef) {
        return com.android.internal.telephony.gsm.SmsMessage.getSubmitPdu(scAddr, destAddr, message,
                statusReportRequested, null, 0, 0, 0, validityPeriod, messageRef);
    }

    /**
     * Cdma implementation for
     * {@link #getSubmitPdu(boolean, String, String, String, boolean, SmsHeader)}
@@ -196,6 +257,29 @@ public final class SMSDispatcherUtil {
        }
    }

    /**
     * Trigger the proper implementation for getting submit pdu for data sms based on format.
     *
     * @param isCdma true if cdma format should be used.
     * @param destAddr the address to send the message to
     * @param scAddr is the service center address or null to use the current default SMSC
     * @param destPort the port to deliver the message to
     * @param message the body of the message to send
     * @param statusReportRequested whether or not a status report is requested.
     * @param messageRef TP Message Reference number
     * @return the submit pdu.
     */
    public static SmsMessageBase.SubmitPduBase getSubmitPdu(boolean isCdma, String scAddr,
            String destAddr, int destPort, byte[] message, boolean statusReportRequested,
            int messageRef) {
        if (isCdma) {
            return getSubmitPduCdma(scAddr, destAddr, destPort, message, statusReportRequested);
        } else {
            return getSubmitPduGsm(scAddr, destAddr, destPort, message, statusReportRequested,
                    messageRef);
        }
    }

    /**
     * Cdma implementation of {@link #getSubmitPdu(boolean, String, String, int, byte[], boolean)}

@@ -229,6 +313,22 @@ public final class SMSDispatcherUtil {

    }

    /**
     * Gsm implementation of {@link #getSubmitPdu(boolean, String, String, int, byte[], boolean)}
     *
     * @param destAddr the address to send the message to
     * @param scAddr is the service center address or null to use the current default SMSC
     * @param destPort the port to deliver the message to
     * @param message the body of the message to send
     * @param statusReportRequested whether or not a status report is requested.
     * @return the submit pdu.
     */
    public static SmsMessageBase.SubmitPduBase getSubmitPduGsm(String scAddr, String destAddr,
            int destPort, byte[] message, boolean statusReportRequested, int messageRef) {
        return com.android.internal.telephony.gsm.SmsMessage.getSubmitPdu(scAddr, destAddr,
                destPort, message, statusReportRequested, messageRef);
    }

    /**
     * Calculate the number of septets needed to encode the message. This function should only be
     * called for individual segments of multipart message.