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

Commit 2955c7f7 authored by Sridhar Dubbaka's avatar Sridhar Dubbaka Committed by Gerrit - the friendly Code Review server
Browse files

Validity Period support for MO SMS in 3gpp

Add Telephony framework support for Validity Period in 3gpp
for MO SMS

Change-Id: I7770875a0838d992b87b6602ad2c817ef800acc0
CRs-Fixed: 627981
parent 8f92f958
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -128,6 +128,7 @@ public class MSimSmsManager {
     *  raw pdu of the status report is in the extended data ("pdu").
     * @param priority Priority level of the message
     * @param subscription on which the SMS has to be sent.
     * @param validityPeriod Validity Period of the message in Minutes.
     *
     * @throws IllegalArgumentException if destinationAddress or text are empty
     *
@@ -136,7 +137,7 @@ public class MSimSmsManager {
    public void sendTextMessage(
            String destinationAddress, String scAddress, String text,
            PendingIntent sentIntent, PendingIntent deliveryIntent, int priority,
            boolean isExpectMore, int subscription) {
            boolean isExpectMore, int validityPeriod, int subscription) {
        if (TextUtils.isEmpty(destinationAddress)) {
            throw new IllegalArgumentException("Invalid destinationAddress");
        }
@@ -150,7 +151,7 @@ public class MSimSmsManager {
            if (iccISms != null) {
                iccISms.sendTextWithOptions(ActivityThread.currentPackageName(),
                        destinationAddress, scAddress, text, sentIntent, deliveryIntent,
                        priority, isExpectMore, subscription);
                        priority, isExpectMore, validityPeriod, subscription);
            }
        } catch (RemoteException ex) {
            // ignore it
@@ -274,13 +275,14 @@ public class MSimSmsManager {
     *   extended data ("pdu").
     * @param priority Priority level of the message
     * @param subscription on which the SMS has to be sent.
     * @param validityPeriod Validity Period of the message in Minutes.
     *
     * @throws IllegalArgumentException if destinationAddress or data are empty
     */
    public void sendMultipartTextMessage(String destinationAddress, String scAddress,
            ArrayList<String> parts, ArrayList<PendingIntent> sentIntents,
            ArrayList<PendingIntent> deliveryIntents, int priority, boolean isExpectMore,
            int subscription) {
            int validityPeriod, int subscription) {
        if (TextUtils.isEmpty(destinationAddress)) {
            throw new IllegalArgumentException("Invalid destinationAddress");
        }
@@ -295,7 +297,7 @@ public class MSimSmsManager {
                if (iccISms != null) {
                    iccISms.sendMultipartTextWithOptions(ActivityThread.currentPackageName(),
                            destinationAddress, scAddress, parts, sentIntents, deliveryIntents,
                            priority, isExpectMore, subscription);
                            priority, isExpectMore, validityPeriod, subscription);
                }
            } catch (RemoteException ex) {
                // ignore it
@@ -310,7 +312,8 @@ public class MSimSmsManager {
                deliveryIntent = deliveryIntents.get(0);
            }
            sendTextMessage(destinationAddress, scAddress, parts.get(0),
                    sentIntent, deliveryIntent, priority, isExpectMore, subscription);
                    sentIntent, deliveryIntent, priority, isExpectMore, validityPeriod,
                    subscription);
        }
    }

+8 −5
Original line number Diff line number Diff line
@@ -142,6 +142,7 @@ public final class SmsManager {
     *  broadcast when the message is delivered to the recipient.  The
     *  raw pdu of the status report is in the extended data ("pdu").
     * @param priority Priority level of the message
     * @param validityPeriod Validity Period of the message in Minutes.
     *
     * @throws IllegalArgumentException if destinationAddress or text are empty
     * {@hide}
@@ -149,7 +150,7 @@ public final class SmsManager {
    public void sendTextMessage(
            String destinationAddress, String scAddress, String text,
            PendingIntent sentIntent, PendingIntent deliveryIntent, int priority,
            boolean isExpectMore) {
            boolean isExpectMore, int validityPeriod) {
        if (TextUtils.isEmpty(destinationAddress)) {
            throw new IllegalArgumentException("Invalid destinationAddress");
        }
@@ -163,7 +164,7 @@ public final class SmsManager {
            if (iccISms != null) {
                iccISms.sendTextWithOptions(ActivityThread.currentPackageName(),
                        destinationAddress, scAddress, text, sentIntent, deliveryIntent,
                        priority, isExpectMore);
                        priority, isExpectMore, validityPeriod);
            }
        } catch (RemoteException ex) {
            // ignore it
@@ -302,6 +303,7 @@ public final class SmsManager {
     *   to the recipient.  The raw pdu of the status report is in the
     *   extended data ("pdu").
     * @param priority Priority level of the message
     * @param validityPeriod Validity Period of the message in Minutes.
     *
     * @throws IllegalArgumentException if destinationAddress or data are empty
     * {@hide}
@@ -309,7 +311,7 @@ public final class SmsManager {
    public void sendMultipartTextMessage(
            String destinationAddress, String scAddress, ArrayList<String> parts,
            ArrayList<PendingIntent> sentIntents, ArrayList<PendingIntent> deliveryIntents,
            int priority, boolean isExpectMore) {
            int priority, boolean isExpectMore, int validityPeriod) {
        if (TextUtils.isEmpty(destinationAddress)) {
            throw new IllegalArgumentException("Invalid destinationAddress");
        }
@@ -323,7 +325,8 @@ public final class SmsManager {
                if (iccISms != null) {
                    iccISms.sendMultipartTextWithOptions(ActivityThread.currentPackageName(),
                            destinationAddress, scAddress, parts,
                            sentIntents, deliveryIntents, priority, isExpectMore);
                            sentIntents, deliveryIntents, priority, isExpectMore,
                            validityPeriod);
                }
            } catch (RemoteException ex) {
                // ignore it
@@ -338,7 +341,7 @@ public final class SmsManager {
                deliveryIntent = deliveryIntents.get(0);
            }
            sendTextMessage(destinationAddress, scAddress, parts.get(0),
                    sentIntent, deliveryIntent, priority, isExpectMore);
                    sentIntent, deliveryIntent, priority, isExpectMore, validityPeriod);
        }
    }

+11 −7
Original line number Diff line number Diff line
@@ -397,7 +397,7 @@ public class IccSmsInterfaceManager extends ISms.Stub {
                callingPackage) != AppOpsManager.MODE_ALLOWED) {
            return;
        }
        mDispatcher.sendText(destAddr, scAddr, text, sentIntent, deliveryIntent, -1, false);
        mDispatcher.sendText(destAddr, scAddr, text, sentIntent, deliveryIntent, -1, false, -1);
    }

    /**
@@ -424,25 +424,27 @@ public class IccSmsInterfaceManager extends ISms.Stub {
     *  broadcast when the message is delivered to the recipient.  The
     *  raw pdu of the status report is in the extended data ("pdu").
     * @param priority Priority level of the message
     * @param validityPeriod Validity Period of the message in Minutes.
     */
    @Override
    public void sendTextWithOptions(String callingPackage, String destAddr, String scAddr,
            String text, PendingIntent sentIntent, PendingIntent deliveryIntent,
            int priority, boolean isExpectMore) {
            int priority, boolean isExpectMore, int validityPeriod) {
        mPhone.getContext().enforceCallingPermission(
                Manifest.permission.SEND_SMS,
                "Sending SMS message");
        if (Rlog.isLoggable("SMS", Log.VERBOSE)) {
            log("sendText: destAddr=" + destAddr + " scAddr=" + scAddr +
                " text='"+ text + "' sentIntent=" +
                sentIntent + " deliveryIntent=" + deliveryIntent);
                sentIntent + " deliveryIntent=" + deliveryIntent +
                "validityPeriod" + validityPeriod);
        }
        if (mAppOps.noteOp(AppOpsManager.OP_SEND_SMS, Binder.getCallingUid(),
                callingPackage) != AppOpsManager.MODE_ALLOWED) {
            return;
        }
        mDispatcher.sendText(destAddr, scAddr, text, sentIntent, deliveryIntent, priority,
                isExpectMore);
                isExpectMore, validityPeriod);
    }

    /**
@@ -490,7 +492,7 @@ public class IccSmsInterfaceManager extends ISms.Stub {
        }
        mDispatcher.sendMultipartText(destAddr, scAddr, (ArrayList<String>) parts,
                (ArrayList<PendingIntent>) sentIntents, (ArrayList<PendingIntent>) deliveryIntents,
                -1, false);
                -1, false, -1);
    }

    /**
@@ -518,11 +520,13 @@ public class IccSmsInterfaceManager extends ISms.Stub {
     *   to the recipient.  The raw pdu of the status report is in the
     *   extended data ("pdu").
     * @param priority Priority level of the message
     * @param validityPeriod Validity Period of the message in Minutes.
     */
    @Override
    public void sendMultipartTextWithOptions(String callingPackage, String destAddr,
            String scAddr, List<String> parts, List<PendingIntent> sentIntents,
            List<PendingIntent> deliveryIntents, int priority, boolean isExpectMore) {
            List<PendingIntent> deliveryIntents, int priority, boolean isExpectMore,
            int validityPeriod) {
        mPhone.getContext().enforceCallingPermission(
                Manifest.permission.SEND_SMS,
                "Sending SMS message");
@@ -539,7 +543,7 @@ public class IccSmsInterfaceManager extends ISms.Stub {
        }
        mDispatcher.sendMultipartText(destAddr, scAddr, (ArrayList<String>) parts,
                (ArrayList<PendingIntent>) sentIntents, (ArrayList<PendingIntent>) deliveryIntents,
                priority, isExpectMore);
                priority, isExpectMore, validityPeriod);
    }

    @Override
+9 −7
Original line number Diff line number Diff line
@@ -187,13 +187,14 @@ public class ImsSMSDispatcher extends SMSDispatcher {
    @Override
    protected void sendMultipartText(String destAddr, String scAddr,
            ArrayList<String> parts, ArrayList<PendingIntent> sentIntents,
            ArrayList<PendingIntent> deliveryIntents, int priority, boolean isExpectMore) {
            ArrayList<PendingIntent> deliveryIntents, int priority, boolean isExpectMore,
            int validityPeriod) {
        if (isCdmaMo()) {
            mCdmaDispatcher.sendMultipartText(destAddr, scAddr,
                    parts, sentIntents, deliveryIntents, priority, isExpectMore);
                    parts, sentIntents, deliveryIntents, priority, isExpectMore, validityPeriod);
        } else {
            mGsmDispatcher.sendMultipartText(destAddr, scAddr,
                    parts, sentIntents, deliveryIntents, priority, isExpectMore);
                    parts, sentIntents, deliveryIntents, priority, isExpectMore, validityPeriod);
        }
    }

@@ -207,14 +208,14 @@ public class ImsSMSDispatcher extends SMSDispatcher {
    @Override
    protected void sendText(String destAddr, String scAddr, String text,
            PendingIntent sentIntent, PendingIntent deliveryIntent, int priority,
            boolean isExpectMore) {
            boolean isExpectMore, int validityPeriod) {
        Rlog.d(TAG, "sendText");
        if (isCdmaMo()) {
            mCdmaDispatcher.sendText(destAddr, scAddr,
                    text, sentIntent, deliveryIntent, priority, isExpectMore);
                    text, sentIntent, deliveryIntent, priority, isExpectMore, validityPeriod);
        } else {
            mGsmDispatcher.sendText(destAddr, scAddr,
                    text, sentIntent, deliveryIntent, priority, isExpectMore);
                    text, sentIntent, deliveryIntent, priority, isExpectMore, validityPeriod);
        }
    }

@@ -325,7 +326,8 @@ public class ImsSMSDispatcher extends SMSDispatcher {
    @Override
    protected void sendNewSubmitPdu(String destinationAddress, String scAddress, String message,
            SmsHeader smsHeader, int format, PendingIntent sentIntent,
            PendingIntent deliveryIntent, boolean lastPart, int priority, boolean isExpectMore) {
            PendingIntent deliveryIntent, boolean lastPart, int priority, boolean isExpectMore,
            int validityPeriod) {
        Rlog.e(TAG, "Error! Not implemented for IMS.");
    }

+9 −5
Original line number Diff line number Diff line
@@ -513,10 +513,11 @@ public abstract class SMSDispatcher extends Handler {
     *  broadcast when the message is delivered to the recipient.  The
     *  raw pdu of the status report is in the extended data ("pdu").
     * @param priority Priority level of the message
     * @param validityPeriod Validity Period of the message in Minutes.
     */
    protected abstract void sendText(String destAddr, String scAddr,
            String text, PendingIntent sentIntent, PendingIntent deliveryIntent,
            int priority, boolean isExpectMore);
            int priority, boolean isExpectMore, int validityPeriod);

    /**
     * Calculate the number of septets needed to encode the message.
@@ -554,10 +555,12 @@ public abstract class SMSDispatcher extends Handler {
     *   to the recipient.  The raw pdu of the status report is in the
     *   extended data ("pdu").
     * @param priority Priority level of the message
     * @param validityPeriod Validity Period of the message in Minutes.
     */
    protected void sendMultipartText(String destAddr, String scAddr,
            ArrayList<String> parts, ArrayList<PendingIntent> sentIntents,
            ArrayList<PendingIntent> deliveryIntents, int priority, boolean isExpectMore) {
            ArrayList<PendingIntent> deliveryIntents, int priority, boolean isExpectMore,
            int validityPeriod) {

        int refNumber = getNextConcatenatedRef() & 0x00FF;
        int msgCount = parts.size();
@@ -608,7 +611,8 @@ public abstract class SMSDispatcher extends Handler {
            }

            sendNewSubmitPdu(destAddr, scAddr, parts.get(i), smsHeader, encoding,
                    sentIntent, deliveryIntent, (i == (msgCount - 1)), priority, isExpectMore);
                    sentIntent, deliveryIntent, (i == (msgCount - 1)), priority, isExpectMore,
                    validityPeriod);
        }

    }
@@ -619,7 +623,7 @@ public abstract class SMSDispatcher extends Handler {
    protected abstract void sendNewSubmitPdu(String destinationAddress, String scAddress,
            String message, SmsHeader smsHeader, int encoding,
            PendingIntent sentIntent, PendingIntent deliveryIntent, boolean lastPart,
            int priority, boolean isExpectMore);
            int priority, boolean isExpectMore, int validityPeriod);

    /**
     * Send a SMS
@@ -998,7 +1002,7 @@ public abstract class SMSDispatcher extends Handler {
        }

        sendMultipartText(destinationAddress, scAddress, parts, sentIntents, deliveryIntents, -1,
                tracker.mExpectMore);
                tracker.mExpectMore, -1);
    }

    /**
Loading