Loading src/java/com/android/internal/telephony/IccSmsInterfaceManager.java +167 −14 Original line number Diff line number Diff line Loading @@ -78,6 +78,8 @@ public class IccSmsInterfaceManager { protected static final int EVENT_SET_BROADCAST_CONFIG_DONE = 4; private static final int SMS_CB_CODE_SCHEME_MIN = 0; private static final int SMS_CB_CODE_SCHEME_MAX = 255; public static final int SMS_MESSAGE_PRIORITY_NOT_SPECIFIED = -1; public static final int SMS_MESSAGE_PERIOD_NOT_SPECIFIED = -1; protected Phone mPhone; final protected Context mContext; Loading Loading @@ -394,7 +396,8 @@ public class IccSmsInterfaceManager { Manifest.permission.SEND_SMS, "Sending SMS message"); sendTextInternal(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent, persistMessageForNonDefaultSmsApp); persistMessageForNonDefaultSmsApp, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /* expectMore */, SMS_MESSAGE_PERIOD_NOT_SPECIFIED); } /** Loading @@ -408,7 +411,8 @@ public class IccSmsInterfaceManager { Manifest.permission.SEND_SMS, "Sending SMS message"); sendTextInternal(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent, persistMessage); persistMessage, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /* expectMore */, SMS_MESSAGE_PERIOD_NOT_SPECIFIED); } /** Loading @@ -434,15 +438,39 @@ public class IccSmsInterfaceManager { * @param deliveryIntent if not NULL this <code>PendingIntent</code> is * broadcast when the message is delivered to the recipient. The * raw pdu of the status report is in the extended data ("pdu"). * @param persistMessageForNonDefaultSmsApp whether the sent message should * be automatically persisted in the SMS db. It only affects messages sent * by a non-default SMS app. Currently only the carrier app can set this * parameter to false to skip auto message persistence. * @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 including negative considered as Invalid Priority Indicator of the message. * @param expectMore is a boolean to indicate the sending messages through same link or not. * @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 including negative considered as Invalid Validity Period of the message. */ private void sendTextInternal(String callingPackage, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessageForNonDefaultSmsApp) { boolean persistMessageForNonDefaultSmsApp, int priority, boolean expectMore, int validityPeriod) { if (Rlog.isLoggable("SMS", Log.VERBOSE)) { log("sendText: destAddr=" + destAddr + " scAddr=" + scAddr + " text='"+ text + "' sentIntent=" + sentIntent + " deliveryIntent=" + deliveryIntent); sentIntent + " deliveryIntent=" + deliveryIntent + " priority=" + priority + " expectMore=" + expectMore + " validityPeriod=" + validityPeriod); } if (mAppOps.noteOp(AppOpsManager.OP_SEND_SMS, Binder.getCallingUid(), callingPackage) != AppOpsManager.MODE_ALLOWED) { Loading @@ -453,7 +481,65 @@ public class IccSmsInterfaceManager { } destAddr = filterDestAddress(destAddr); mDispatchersController.sendText(destAddr, scAddr, text, sentIntent, deliveryIntent, null/*messageUri*/, callingPackage, persistMessageForNonDefaultSmsApp); null/*messageUri*/, callingPackage, persistMessageForNonDefaultSmsApp, priority, expectMore, validityPeriod); } /** * Send a text based SMS with Messaging Options. * * @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 text the body of the message to send * @param sentIntent if not NULL this <code>PendingIntent</code> is * broadcast when the message is successfully sent, or failed. * The result code will be <code>Activity.RESULT_OK<code> for success, * or one of these errors:<br> * <code>RESULT_ERROR_GENERIC_FAILURE</code><br> * <code>RESULT_ERROR_RADIO_OFF</code><br> * <code>RESULT_ERROR_NULL_PDU</code><br> * For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include * the extra "errorCode" containing a radio technology specific value, * generally only useful for troubleshooting.<br> * The per-application based SMS control checks sentIntent. If sentIntent * is NULL the caller will be checked against all unknown applications, * which cause smaller number of SMS to be sent in checking period. * @param deliveryIntent if not NULL this <code>PendingIntent</code> is * broadcast when the message is delivered to the recipient. The * raw pdu of the status report is in the extended data ("pdu"). * @param persistMessageForNonDefaultSmsApp whether the sent message should * be automatically persisted in the SMS db. It only affects messages sent * by a non-default SMS app. Currently only the carrier app can set this * parameter to false to skip auto message persistence. * @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 including negative considered as Invalid Priority Indicator of the message. * @param expectMore is a boolean to indicate the sending messages through same link or not. * @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 including negative considered as Invalid Validity Period of the message. */ public void sendTextWithOptions(String callingPackage, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessageForNonDefaultSmsApp, int priority, boolean expectMore, int validityPeriod) { mPhone.getContext().enforceCallingOrSelfPermission( Manifest.permission.SEND_SMS, "Sending SMS message"); sendTextInternal(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent, persistMessageForNonDefaultSmsApp, priority, expectMore, validityPeriod); } /** Loading Loading @@ -515,6 +601,63 @@ public class IccSmsInterfaceManager { public void sendMultipartText(String callingPackage, String destAddr, String scAddr, List<String> parts, List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents, boolean persistMessageForNonDefaultSmsApp) { sendMultipartTextWithOptions(callingPackage, destAddr, scAddr, parts, sentIntents, deliveryIntents, persistMessageForNonDefaultSmsApp, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /* expectMore */, SMS_MESSAGE_PERIOD_NOT_SPECIFIED); } /** * Send a multi-part text based SMS with Messaging Options. * * @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 parts an <code>ArrayList</code> of strings that, in order, * comprise the original message * @param sentIntents if not null, an <code>ArrayList</code> of * <code>PendingIntent</code>s (one for each message part) that is * broadcast when the corresponding message part has been sent. * The result code will be <code>Activity.RESULT_OK<code> for success, * or one of these errors: * <code>RESULT_ERROR_GENERIC_FAILURE</code> * <code>RESULT_ERROR_RADIO_OFF</code> * <code>RESULT_ERROR_NULL_PDU</code>. * The per-application based SMS control checks sentIntent. If sentIntent * is NULL the caller will be checked against all unknown applications, * which cause smaller number of SMS to be sent in checking period. * @param deliveryIntents if not null, an <code>ArrayList</code> of * <code>PendingIntent</code>s (one for each message part) that is * broadcast when the corresponding message part has been delivered * to the recipient. The raw pdu of the status report is in the * extended data ("pdu"). * @param persistMessageForNonDefaultSmsApp whether the sent message should * be automatically persisted in the SMS db. It only affects messages sent * by a non-default SMS app. Currently only the carrier app can set this * parameter to false to skip auto message persistence. * @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 including negative considered as Invalid Priority Indicator of the message. * @param expectMore is a boolean to indicate the sending messages through same link or not. * @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 including negative considered as Invalid Validity Period of the message. */ public void sendMultipartTextWithOptions(String callingPackage, String destAddr, String scAddr, List<String> parts, List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents, boolean persistMessageForNonDefaultSmsApp, int priority, boolean expectMore, int validityPeriod) { mPhone.getContext().enforceCallingPermission( Manifest.permission.SEND_SMS, "Sending SMS message"); Loading @@ -525,7 +668,7 @@ public class IccSmsInterfaceManager { if (Rlog.isLoggable("SMS", Log.VERBOSE)) { int i = 0; for (String part : parts) { log("sendMultipartText: destAddr=" + destAddr + ", srAddr=" + scAddr + log("sendMultipartTextWithOptions: destAddr=" + destAddr + ", srAddr=" + scAddr + ", part[" + (i++) + "]=" + part); } } Loading Loading @@ -560,17 +703,21 @@ public class IccSmsInterfaceManager { mDispatchersController.sendText(destAddr, scAddr, singlePart, singleSentIntent, singleDeliveryIntent, null/*messageUri*/, callingPackage, persistMessageForNonDefaultSmsApp); persistMessageForNonDefaultSmsApp, priority, expectMore, validityPeriod); } return; } mDispatchersController.sendMultipartText(destAddr, scAddr, (ArrayList<String>) parts, (ArrayList<PendingIntent>) sentIntents, (ArrayList<PendingIntent>) deliveryIntents, null/*messageUri*/, callingPackage, persistMessageForNonDefaultSmsApp); mDispatchersController.sendMultipartText(destAddr, scAddr, (ArrayList<String>) parts, (ArrayList<PendingIntent>) sentIntents, (ArrayList<PendingIntent>) deliveryIntents, null, callingPackage, persistMessageForNonDefaultSmsApp, priority, expectMore, validityPeriod); } public int getPremiumSmsPermission(String packageName) { return mDispatchersController.getPremiumSmsPermission(packageName); } Loading Loading @@ -964,7 +1111,8 @@ public class IccSmsInterfaceManager { textAndAddress[1] = filterDestAddress(textAndAddress[1]); mDispatchersController.sendText(textAndAddress[1], scAddress, textAndAddress[0], sentIntent, deliveryIntent, messageUri, callingPkg, true /* persistMessageForNonDefaultSmsApp */); true /* persistMessageForNonDefaultSmsApp */, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /* expectMore */, SMS_MESSAGE_PERIOD_NOT_SPECIFIED); } public void sendStoredMultipartText(String callingPkg, Uri messageUri, String scAddress, Loading Loading @@ -1020,7 +1168,9 @@ public class IccSmsInterfaceManager { mDispatchersController.sendText(textAndAddress[1], scAddress, singlePart, singleSentIntent, singleDeliveryIntent, messageUri, callingPkg, true /* persistMessageForNonDefaultSmsApp */); true /* persistMessageForNonDefaultSmsApp */, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /* expectMore */, SMS_MESSAGE_PERIOD_NOT_SPECIFIED); } return; } Loading @@ -1033,7 +1183,10 @@ public class IccSmsInterfaceManager { (ArrayList<PendingIntent>) deliveryIntents, messageUri, callingPkg, true /* persistMessageForNonDefaultSmsApp */); true /* persistMessageForNonDefaultSmsApp */, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /* expectMore */, SMS_MESSAGE_PERIOD_NOT_SPECIFIED); } private boolean isFailedOrDraft(ContentResolver resolver, Uri messageUri) { Loading src/java/com/android/internal/telephony/ImsSmsDispatcher.java +3 −2 Original line number Diff line number Diff line Loading @@ -231,9 +231,10 @@ public class ImsSmsDispatcher extends SMSDispatcher { @Override protected SmsMessageBase.SubmitPduBase getSubmitPdu(String scAddr, String destAddr, String message, boolean statusReportRequested, SmsHeader smsHeader) { String message, boolean statusReportRequested, SmsHeader smsHeader, int priority, int validityPeriod) { return SMSDispatcherUtil.getSubmitPdu(isCdmaMo(), scAddr, destAddr, message, statusReportRequested, smsHeader); statusReportRequested, smsHeader, priority, validityPeriod); } @Override Loading src/java/com/android/internal/telephony/SMSDispatcher.java +83 −26 File changed.Preview size limit exceeded, changes collapsed. Show changes src/java/com/android/internal/telephony/SmsDispatchersController.java +127 −8 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.internal.telephony; import static com.android.internal.telephony.IccSmsInterfaceManager.SMS_MESSAGE_PERIOD_NOT_SPECIFIED; import static com.android.internal.telephony.IccSmsInterfaceManager.SMS_MESSAGE_PRIORITY_NOT_SPECIFIED; import android.app.Activity; import android.app.PendingIntent; import android.app.PendingIntent.CanceledException; Loading Loading @@ -412,13 +415,69 @@ public class SmsDispatchersController extends Handler { String callingPkg, boolean persistMessage) { if (mImsSmsDispatcher.isAvailable()) { mImsSmsDispatcher.sendText(destAddr, scAddr, text, sentIntent, deliveryIntent, messageUri, callingPkg, persistMessage); } else if (isCdmaMo()) { messageUri, callingPkg, persistMessage, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /*expectMore*/, SMS_MESSAGE_PERIOD_NOT_SPECIFIED); } else { sendText(destAddr, scAddr, text, sentIntent, deliveryIntent, messageUri, callingPkg, persistMessage, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /*expectMore*/, SMS_MESSAGE_PERIOD_NOT_SPECIFIED); } } /** * Send a text based SMS. * @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 text the body of the message to send * @param sentIntent if not NULL this <code>PendingIntent</code> is * broadcast when the message is successfully sent, or failed. * The result code will be <code>Activity.RESULT_OK<code> for success, * or one of these errors:<br> * <code>RESULT_ERROR_GENERIC_FAILURE</code><br> * <code>RESULT_ERROR_RADIO_OFF</code><br> * <code>RESULT_ERROR_NULL_PDU</code><br> * <code>RESULT_ERROR_NO_SERVICE</code><br>. * For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include * the extra "errorCode" containing a radio technology specific value, * generally only useful for troubleshooting.<br> * The per-application based SMS control checks sentIntent. If sentIntent * is NULL the caller will be checked against all unknown applications, * which cause smaller number of SMS to be sent in checking period. * @param deliveryIntent if not NULL this <code>PendingIntent</code> is * broadcast when the message is delivered to the recipient. The * @param messageUri optional URI of the message if it is already stored in the system * @param callingPkg the calling package name * @param persistMessage whether to save the sent message into SMS DB for a * non-default SMS app. * @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 expectMore is a boolean to indicate the sending messages through same link or not. * @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. */ public void sendText(String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, Uri messageUri, String callingPkg, boolean persistMessage, int priority, boolean expectMore, int validityPeriod) { if (isCdmaMo()) { mCdmaDispatcher.sendText(destAddr, scAddr, text, sentIntent, deliveryIntent, messageUri, callingPkg, persistMessage); callingPkg, persistMessage, priority, expectMore, validityPeriod); } else { mGsmDispatcher.sendText(destAddr, scAddr, text, sentIntent, deliveryIntent, messageUri, callingPkg, persistMessage); callingPkg, persistMessage, priority, expectMore, validityPeriod); } } Loading Loading @@ -456,13 +515,73 @@ public class SmsDispatchersController extends Handler { boolean persistMessage) { if (mImsSmsDispatcher.isAvailable()) { mImsSmsDispatcher.sendMultipartText(destAddr, scAddr, parts, sentIntents, deliveryIntents, messageUri, callingPkg, persistMessage); } else if (isCdmaMo()) { deliveryIntents, messageUri, callingPkg, persistMessage, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /*expectMore*/, SMS_MESSAGE_PERIOD_NOT_SPECIFIED); } else { sendMultipartText(destAddr, scAddr, parts, sentIntents, deliveryIntents, messageUri, callingPkg, persistMessage, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /*expectMore*/, SMS_MESSAGE_PERIOD_NOT_SPECIFIED); } } /** * Send a multi-part text based SMS. * @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 parts an <code>ArrayList</code> of strings that, in order, * comprise the original message * @param sentIntents if not null, an <code>ArrayList</code> of * <code>PendingIntent</code>s (one for each message part) that is * broadcast when the corresponding message part has been sent. * The result code will be <code>Activity.RESULT_OK<code> for success, * or one of these errors: * <code>RESULT_ERROR_GENERIC_FAILURE</code> * <code>RESULT_ERROR_RADIO_OFF</code> * <code>RESULT_ERROR_NULL_PDU</code> * <code>RESULT_ERROR_NO_SERVICE</code>. * The per-application based SMS control checks sentIntent. If sentIntent * is NULL the caller will be checked against all unknown applications, * which cause smaller number of SMS to be sent in checking period. * @param deliveryIntents if not null, an <code>ArrayList</code> of * <code>PendingIntent</code>s (one for each message part) that is * broadcast when the corresponding message part has been delivered * to the recipient. The raw pdu of the status report is in the * @param messageUri optional URI of the message if it is already stored in the system * @param callingPkg the calling package name * @param persistMessage whether to save the sent message into SMS DB for a * non-default SMS app. * @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 expectMore is a boolean to indicate the sending messages through same link or not. * @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. */ protected void sendMultipartText(String destAddr, String scAddr, ArrayList<String> parts, ArrayList<PendingIntent> sentIntents, ArrayList<PendingIntent> deliveryIntents, Uri messageUri, String callingPkg, boolean persistMessage, int priority, boolean expectMore, int validityPeriod) { if (isCdmaMo()) { mCdmaDispatcher.sendMultipartText(destAddr, scAddr, parts, sentIntents, deliveryIntents, messageUri, callingPkg, persistMessage); messageUri, callingPkg, persistMessage, priority, expectMore, validityPeriod); } else { mGsmDispatcher.sendMultipartText(destAddr, scAddr, parts, sentIntents, deliveryIntents, messageUri, callingPkg, persistMessage); messageUri, callingPkg, persistMessage, priority, expectMore, validityPeriod); } } Loading src/java/com/android/internal/telephony/UiccSmsController.java 100755 → 100644 +31 −0 Original line number Diff line number Diff line Loading @@ -159,6 +159,21 @@ public class UiccSmsController extends ISms.Stub { } } @Override public void sendTextForSubscriberWithOptions(int subId, String callingPackage, String destAddr, String scAddr, String parts, PendingIntent sentIntents, PendingIntent deliveryIntents, boolean persistMessage, int priority, boolean expectMore, int validityPeriod) { IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null ) { iccSmsIntMgr.sendTextWithOptions(callingPackage, destAddr, scAddr, parts, sentIntents, deliveryIntents, persistMessage, priority, expectMore, validityPeriod); } else { Rlog.e(LOG_TAG,"sendTextWithOptions iccSmsIntMgr is null for" + " Subscription: " + subId); } } public void sendMultipartText(String callingPackage, String destAddr, String scAddr, List<String> parts, List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents) throws android.os.RemoteException { Loading @@ -183,6 +198,22 @@ public class UiccSmsController extends ISms.Stub { } } @Override public void sendMultipartTextForSubscriberWithOptions(int subId, String callingPackage, String destAddr, String scAddr, List<String> parts, List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents, boolean persistMessage, int priority, boolean expectMore, int validityPeriod) { IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null ) { iccSmsIntMgr.sendMultipartTextWithOptions(callingPackage, destAddr, scAddr, parts, sentIntents, deliveryIntents, persistMessage, priority, expectMore, validityPeriod); } else { Rlog.e(LOG_TAG,"sendMultipartTextWithOptions iccSmsIntMgr is null for" + " Subscription: " + subId); } } @Override public boolean enableCellBroadcastForSubscriber(int subId, int messageIdentifier, int ranType) throws android.os.RemoteException { Loading Loading
src/java/com/android/internal/telephony/IccSmsInterfaceManager.java +167 −14 Original line number Diff line number Diff line Loading @@ -78,6 +78,8 @@ public class IccSmsInterfaceManager { protected static final int EVENT_SET_BROADCAST_CONFIG_DONE = 4; private static final int SMS_CB_CODE_SCHEME_MIN = 0; private static final int SMS_CB_CODE_SCHEME_MAX = 255; public static final int SMS_MESSAGE_PRIORITY_NOT_SPECIFIED = -1; public static final int SMS_MESSAGE_PERIOD_NOT_SPECIFIED = -1; protected Phone mPhone; final protected Context mContext; Loading Loading @@ -394,7 +396,8 @@ public class IccSmsInterfaceManager { Manifest.permission.SEND_SMS, "Sending SMS message"); sendTextInternal(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent, persistMessageForNonDefaultSmsApp); persistMessageForNonDefaultSmsApp, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /* expectMore */, SMS_MESSAGE_PERIOD_NOT_SPECIFIED); } /** Loading @@ -408,7 +411,8 @@ public class IccSmsInterfaceManager { Manifest.permission.SEND_SMS, "Sending SMS message"); sendTextInternal(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent, persistMessage); persistMessage, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /* expectMore */, SMS_MESSAGE_PERIOD_NOT_SPECIFIED); } /** Loading @@ -434,15 +438,39 @@ public class IccSmsInterfaceManager { * @param deliveryIntent if not NULL this <code>PendingIntent</code> is * broadcast when the message is delivered to the recipient. The * raw pdu of the status report is in the extended data ("pdu"). * @param persistMessageForNonDefaultSmsApp whether the sent message should * be automatically persisted in the SMS db. It only affects messages sent * by a non-default SMS app. Currently only the carrier app can set this * parameter to false to skip auto message persistence. * @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 including negative considered as Invalid Priority Indicator of the message. * @param expectMore is a boolean to indicate the sending messages through same link or not. * @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 including negative considered as Invalid Validity Period of the message. */ private void sendTextInternal(String callingPackage, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessageForNonDefaultSmsApp) { boolean persistMessageForNonDefaultSmsApp, int priority, boolean expectMore, int validityPeriod) { if (Rlog.isLoggable("SMS", Log.VERBOSE)) { log("sendText: destAddr=" + destAddr + " scAddr=" + scAddr + " text='"+ text + "' sentIntent=" + sentIntent + " deliveryIntent=" + deliveryIntent); sentIntent + " deliveryIntent=" + deliveryIntent + " priority=" + priority + " expectMore=" + expectMore + " validityPeriod=" + validityPeriod); } if (mAppOps.noteOp(AppOpsManager.OP_SEND_SMS, Binder.getCallingUid(), callingPackage) != AppOpsManager.MODE_ALLOWED) { Loading @@ -453,7 +481,65 @@ public class IccSmsInterfaceManager { } destAddr = filterDestAddress(destAddr); mDispatchersController.sendText(destAddr, scAddr, text, sentIntent, deliveryIntent, null/*messageUri*/, callingPackage, persistMessageForNonDefaultSmsApp); null/*messageUri*/, callingPackage, persistMessageForNonDefaultSmsApp, priority, expectMore, validityPeriod); } /** * Send a text based SMS with Messaging Options. * * @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 text the body of the message to send * @param sentIntent if not NULL this <code>PendingIntent</code> is * broadcast when the message is successfully sent, or failed. * The result code will be <code>Activity.RESULT_OK<code> for success, * or one of these errors:<br> * <code>RESULT_ERROR_GENERIC_FAILURE</code><br> * <code>RESULT_ERROR_RADIO_OFF</code><br> * <code>RESULT_ERROR_NULL_PDU</code><br> * For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include * the extra "errorCode" containing a radio technology specific value, * generally only useful for troubleshooting.<br> * The per-application based SMS control checks sentIntent. If sentIntent * is NULL the caller will be checked against all unknown applications, * which cause smaller number of SMS to be sent in checking period. * @param deliveryIntent if not NULL this <code>PendingIntent</code> is * broadcast when the message is delivered to the recipient. The * raw pdu of the status report is in the extended data ("pdu"). * @param persistMessageForNonDefaultSmsApp whether the sent message should * be automatically persisted in the SMS db. It only affects messages sent * by a non-default SMS app. Currently only the carrier app can set this * parameter to false to skip auto message persistence. * @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 including negative considered as Invalid Priority Indicator of the message. * @param expectMore is a boolean to indicate the sending messages through same link or not. * @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 including negative considered as Invalid Validity Period of the message. */ public void sendTextWithOptions(String callingPackage, String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessageForNonDefaultSmsApp, int priority, boolean expectMore, int validityPeriod) { mPhone.getContext().enforceCallingOrSelfPermission( Manifest.permission.SEND_SMS, "Sending SMS message"); sendTextInternal(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent, persistMessageForNonDefaultSmsApp, priority, expectMore, validityPeriod); } /** Loading Loading @@ -515,6 +601,63 @@ public class IccSmsInterfaceManager { public void sendMultipartText(String callingPackage, String destAddr, String scAddr, List<String> parts, List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents, boolean persistMessageForNonDefaultSmsApp) { sendMultipartTextWithOptions(callingPackage, destAddr, scAddr, parts, sentIntents, deliveryIntents, persistMessageForNonDefaultSmsApp, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /* expectMore */, SMS_MESSAGE_PERIOD_NOT_SPECIFIED); } /** * Send a multi-part text based SMS with Messaging Options. * * @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 parts an <code>ArrayList</code> of strings that, in order, * comprise the original message * @param sentIntents if not null, an <code>ArrayList</code> of * <code>PendingIntent</code>s (one for each message part) that is * broadcast when the corresponding message part has been sent. * The result code will be <code>Activity.RESULT_OK<code> for success, * or one of these errors: * <code>RESULT_ERROR_GENERIC_FAILURE</code> * <code>RESULT_ERROR_RADIO_OFF</code> * <code>RESULT_ERROR_NULL_PDU</code>. * The per-application based SMS control checks sentIntent. If sentIntent * is NULL the caller will be checked against all unknown applications, * which cause smaller number of SMS to be sent in checking period. * @param deliveryIntents if not null, an <code>ArrayList</code> of * <code>PendingIntent</code>s (one for each message part) that is * broadcast when the corresponding message part has been delivered * to the recipient. The raw pdu of the status report is in the * extended data ("pdu"). * @param persistMessageForNonDefaultSmsApp whether the sent message should * be automatically persisted in the SMS db. It only affects messages sent * by a non-default SMS app. Currently only the carrier app can set this * parameter to false to skip auto message persistence. * @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 including negative considered as Invalid Priority Indicator of the message. * @param expectMore is a boolean to indicate the sending messages through same link or not. * @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 including negative considered as Invalid Validity Period of the message. */ public void sendMultipartTextWithOptions(String callingPackage, String destAddr, String scAddr, List<String> parts, List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents, boolean persistMessageForNonDefaultSmsApp, int priority, boolean expectMore, int validityPeriod) { mPhone.getContext().enforceCallingPermission( Manifest.permission.SEND_SMS, "Sending SMS message"); Loading @@ -525,7 +668,7 @@ public class IccSmsInterfaceManager { if (Rlog.isLoggable("SMS", Log.VERBOSE)) { int i = 0; for (String part : parts) { log("sendMultipartText: destAddr=" + destAddr + ", srAddr=" + scAddr + log("sendMultipartTextWithOptions: destAddr=" + destAddr + ", srAddr=" + scAddr + ", part[" + (i++) + "]=" + part); } } Loading Loading @@ -560,17 +703,21 @@ public class IccSmsInterfaceManager { mDispatchersController.sendText(destAddr, scAddr, singlePart, singleSentIntent, singleDeliveryIntent, null/*messageUri*/, callingPackage, persistMessageForNonDefaultSmsApp); persistMessageForNonDefaultSmsApp, priority, expectMore, validityPeriod); } return; } mDispatchersController.sendMultipartText(destAddr, scAddr, (ArrayList<String>) parts, (ArrayList<PendingIntent>) sentIntents, (ArrayList<PendingIntent>) deliveryIntents, null/*messageUri*/, callingPackage, persistMessageForNonDefaultSmsApp); mDispatchersController.sendMultipartText(destAddr, scAddr, (ArrayList<String>) parts, (ArrayList<PendingIntent>) sentIntents, (ArrayList<PendingIntent>) deliveryIntents, null, callingPackage, persistMessageForNonDefaultSmsApp, priority, expectMore, validityPeriod); } public int getPremiumSmsPermission(String packageName) { return mDispatchersController.getPremiumSmsPermission(packageName); } Loading Loading @@ -964,7 +1111,8 @@ public class IccSmsInterfaceManager { textAndAddress[1] = filterDestAddress(textAndAddress[1]); mDispatchersController.sendText(textAndAddress[1], scAddress, textAndAddress[0], sentIntent, deliveryIntent, messageUri, callingPkg, true /* persistMessageForNonDefaultSmsApp */); true /* persistMessageForNonDefaultSmsApp */, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /* expectMore */, SMS_MESSAGE_PERIOD_NOT_SPECIFIED); } public void sendStoredMultipartText(String callingPkg, Uri messageUri, String scAddress, Loading Loading @@ -1020,7 +1168,9 @@ public class IccSmsInterfaceManager { mDispatchersController.sendText(textAndAddress[1], scAddress, singlePart, singleSentIntent, singleDeliveryIntent, messageUri, callingPkg, true /* persistMessageForNonDefaultSmsApp */); true /* persistMessageForNonDefaultSmsApp */, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /* expectMore */, SMS_MESSAGE_PERIOD_NOT_SPECIFIED); } return; } Loading @@ -1033,7 +1183,10 @@ public class IccSmsInterfaceManager { (ArrayList<PendingIntent>) deliveryIntents, messageUri, callingPkg, true /* persistMessageForNonDefaultSmsApp */); true /* persistMessageForNonDefaultSmsApp */, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /* expectMore */, SMS_MESSAGE_PERIOD_NOT_SPECIFIED); } private boolean isFailedOrDraft(ContentResolver resolver, Uri messageUri) { Loading
src/java/com/android/internal/telephony/ImsSmsDispatcher.java +3 −2 Original line number Diff line number Diff line Loading @@ -231,9 +231,10 @@ public class ImsSmsDispatcher extends SMSDispatcher { @Override protected SmsMessageBase.SubmitPduBase getSubmitPdu(String scAddr, String destAddr, String message, boolean statusReportRequested, SmsHeader smsHeader) { String message, boolean statusReportRequested, SmsHeader smsHeader, int priority, int validityPeriod) { return SMSDispatcherUtil.getSubmitPdu(isCdmaMo(), scAddr, destAddr, message, statusReportRequested, smsHeader); statusReportRequested, smsHeader, priority, validityPeriod); } @Override Loading
src/java/com/android/internal/telephony/SMSDispatcher.java +83 −26 File changed.Preview size limit exceeded, changes collapsed. Show changes
src/java/com/android/internal/telephony/SmsDispatchersController.java +127 −8 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.internal.telephony; import static com.android.internal.telephony.IccSmsInterfaceManager.SMS_MESSAGE_PERIOD_NOT_SPECIFIED; import static com.android.internal.telephony.IccSmsInterfaceManager.SMS_MESSAGE_PRIORITY_NOT_SPECIFIED; import android.app.Activity; import android.app.PendingIntent; import android.app.PendingIntent.CanceledException; Loading Loading @@ -412,13 +415,69 @@ public class SmsDispatchersController extends Handler { String callingPkg, boolean persistMessage) { if (mImsSmsDispatcher.isAvailable()) { mImsSmsDispatcher.sendText(destAddr, scAddr, text, sentIntent, deliveryIntent, messageUri, callingPkg, persistMessage); } else if (isCdmaMo()) { messageUri, callingPkg, persistMessage, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /*expectMore*/, SMS_MESSAGE_PERIOD_NOT_SPECIFIED); } else { sendText(destAddr, scAddr, text, sentIntent, deliveryIntent, messageUri, callingPkg, persistMessage, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /*expectMore*/, SMS_MESSAGE_PERIOD_NOT_SPECIFIED); } } /** * Send a text based SMS. * @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 text the body of the message to send * @param sentIntent if not NULL this <code>PendingIntent</code> is * broadcast when the message is successfully sent, or failed. * The result code will be <code>Activity.RESULT_OK<code> for success, * or one of these errors:<br> * <code>RESULT_ERROR_GENERIC_FAILURE</code><br> * <code>RESULT_ERROR_RADIO_OFF</code><br> * <code>RESULT_ERROR_NULL_PDU</code><br> * <code>RESULT_ERROR_NO_SERVICE</code><br>. * For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include * the extra "errorCode" containing a radio technology specific value, * generally only useful for troubleshooting.<br> * The per-application based SMS control checks sentIntent. If sentIntent * is NULL the caller will be checked against all unknown applications, * which cause smaller number of SMS to be sent in checking period. * @param deliveryIntent if not NULL this <code>PendingIntent</code> is * broadcast when the message is delivered to the recipient. The * @param messageUri optional URI of the message if it is already stored in the system * @param callingPkg the calling package name * @param persistMessage whether to save the sent message into SMS DB for a * non-default SMS app. * @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 expectMore is a boolean to indicate the sending messages through same link or not. * @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. */ public void sendText(String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, Uri messageUri, String callingPkg, boolean persistMessage, int priority, boolean expectMore, int validityPeriod) { if (isCdmaMo()) { mCdmaDispatcher.sendText(destAddr, scAddr, text, sentIntent, deliveryIntent, messageUri, callingPkg, persistMessage); callingPkg, persistMessage, priority, expectMore, validityPeriod); } else { mGsmDispatcher.sendText(destAddr, scAddr, text, sentIntent, deliveryIntent, messageUri, callingPkg, persistMessage); callingPkg, persistMessage, priority, expectMore, validityPeriod); } } Loading Loading @@ -456,13 +515,73 @@ public class SmsDispatchersController extends Handler { boolean persistMessage) { if (mImsSmsDispatcher.isAvailable()) { mImsSmsDispatcher.sendMultipartText(destAddr, scAddr, parts, sentIntents, deliveryIntents, messageUri, callingPkg, persistMessage); } else if (isCdmaMo()) { deliveryIntents, messageUri, callingPkg, persistMessage, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /*expectMore*/, SMS_MESSAGE_PERIOD_NOT_SPECIFIED); } else { sendMultipartText(destAddr, scAddr, parts, sentIntents, deliveryIntents, messageUri, callingPkg, persistMessage, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /*expectMore*/, SMS_MESSAGE_PERIOD_NOT_SPECIFIED); } } /** * Send a multi-part text based SMS. * @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 parts an <code>ArrayList</code> of strings that, in order, * comprise the original message * @param sentIntents if not null, an <code>ArrayList</code> of * <code>PendingIntent</code>s (one for each message part) that is * broadcast when the corresponding message part has been sent. * The result code will be <code>Activity.RESULT_OK<code> for success, * or one of these errors: * <code>RESULT_ERROR_GENERIC_FAILURE</code> * <code>RESULT_ERROR_RADIO_OFF</code> * <code>RESULT_ERROR_NULL_PDU</code> * <code>RESULT_ERROR_NO_SERVICE</code>. * The per-application based SMS control checks sentIntent. If sentIntent * is NULL the caller will be checked against all unknown applications, * which cause smaller number of SMS to be sent in checking period. * @param deliveryIntents if not null, an <code>ArrayList</code> of * <code>PendingIntent</code>s (one for each message part) that is * broadcast when the corresponding message part has been delivered * to the recipient. The raw pdu of the status report is in the * @param messageUri optional URI of the message if it is already stored in the system * @param callingPkg the calling package name * @param persistMessage whether to save the sent message into SMS DB for a * non-default SMS app. * @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 expectMore is a boolean to indicate the sending messages through same link or not. * @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. */ protected void sendMultipartText(String destAddr, String scAddr, ArrayList<String> parts, ArrayList<PendingIntent> sentIntents, ArrayList<PendingIntent> deliveryIntents, Uri messageUri, String callingPkg, boolean persistMessage, int priority, boolean expectMore, int validityPeriod) { if (isCdmaMo()) { mCdmaDispatcher.sendMultipartText(destAddr, scAddr, parts, sentIntents, deliveryIntents, messageUri, callingPkg, persistMessage); messageUri, callingPkg, persistMessage, priority, expectMore, validityPeriod); } else { mGsmDispatcher.sendMultipartText(destAddr, scAddr, parts, sentIntents, deliveryIntents, messageUri, callingPkg, persistMessage); messageUri, callingPkg, persistMessage, priority, expectMore, validityPeriod); } } Loading
src/java/com/android/internal/telephony/UiccSmsController.java 100755 → 100644 +31 −0 Original line number Diff line number Diff line Loading @@ -159,6 +159,21 @@ public class UiccSmsController extends ISms.Stub { } } @Override public void sendTextForSubscriberWithOptions(int subId, String callingPackage, String destAddr, String scAddr, String parts, PendingIntent sentIntents, PendingIntent deliveryIntents, boolean persistMessage, int priority, boolean expectMore, int validityPeriod) { IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null ) { iccSmsIntMgr.sendTextWithOptions(callingPackage, destAddr, scAddr, parts, sentIntents, deliveryIntents, persistMessage, priority, expectMore, validityPeriod); } else { Rlog.e(LOG_TAG,"sendTextWithOptions iccSmsIntMgr is null for" + " Subscription: " + subId); } } public void sendMultipartText(String callingPackage, String destAddr, String scAddr, List<String> parts, List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents) throws android.os.RemoteException { Loading @@ -183,6 +198,22 @@ public class UiccSmsController extends ISms.Stub { } } @Override public void sendMultipartTextForSubscriberWithOptions(int subId, String callingPackage, String destAddr, String scAddr, List<String> parts, List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents, boolean persistMessage, int priority, boolean expectMore, int validityPeriod) { IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null ) { iccSmsIntMgr.sendMultipartTextWithOptions(callingPackage, destAddr, scAddr, parts, sentIntents, deliveryIntents, persistMessage, priority, expectMore, validityPeriod); } else { Rlog.e(LOG_TAG,"sendMultipartTextWithOptions iccSmsIntMgr is null for" + " Subscription: " + subId); } } @Override public boolean enableCellBroadcastForSubscriber(int subId, int messageIdentifier, int ranType) throws android.os.RemoteException { Loading