diff options
author | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2013-01-16 15:04:57 -0800 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.cyanogenmod.com> | 2013-01-16 15:04:57 -0800 |
commit | ead9e62678a362c1223167f816da9d253da2b333 (patch) | |
tree | 815bfa76ccb3bdc3eef565a657e4b23bf6a98385 | |
parent | 0e4a5241f0a7140694c262f5d9e88ac5a525b2d6 (diff) | |
parent | 2d562bdced971349e1c34653dde64b115aa885af (diff) | |
download | frameworks_opt_telephony-ead9e62678a362c1223167f816da9d253da2b333.zip frameworks_opt_telephony-ead9e62678a362c1223167f816da9d253da2b333.tar.gz frameworks_opt_telephony-ead9e62678a362c1223167f816da9d253da2b333.tar.bz2 |
Merge "SMSDispatcher: Add option for sending pseudo-multipart SMSes" into cm-10.1
-rw-r--r-- | src/java/com/android/internal/telephony/SMSDispatcher.java | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/java/com/android/internal/telephony/SMSDispatcher.java b/src/java/com/android/internal/telephony/SMSDispatcher.java index 6740372..5d68c36 100644 --- a/src/java/com/android/internal/telephony/SMSDispatcher.java +++ b/src/java/com/android/internal/telephony/SMSDispatcher.java @@ -189,6 +189,7 @@ public abstract class SMSDispatcher extends Handler { protected boolean mSmsCapable = true; protected boolean mSmsReceiveDisabled; protected boolean mSmsSendDisabled; + private boolean mSmsPseudoMultipart; protected int mRemainingMessages = -1; @@ -225,6 +226,7 @@ public abstract class SMSDispatcher extends Handler { TelephonyProperties.PROPERTY_SMS_RECEIVE, mSmsCapable); mSmsSendDisabled = !SystemProperties.getBoolean( TelephonyProperties.PROPERTY_SMS_SEND, mSmsCapable); + mSmsPseudoMultipart = SystemProperties.getBoolean("telephony.sms.pseudo_multipart", false); Log.d(TAG, "SMSDispatcher: ctor mSmsCapable=" + mSmsCapable + " format=" + getFormat() + " mSmsReceiveDisabled=" + mSmsReceiveDisabled + " mSmsSendDisabled=" + mSmsSendDisabled); @@ -846,6 +848,12 @@ public abstract class SMSDispatcher extends Handler { protected void sendMultipartText(String destAddr, String scAddr, ArrayList<String> parts, ArrayList<PendingIntent> sentIntents, ArrayList<PendingIntent> deliveryIntents) { + if (mSmsPseudoMultipart) { + // Send as individual messages as the combination of device and + // carrier behavior may not process concatenated messages correctly. + sendPseudoMultipartText(destAddr, scAddr, parts, sentIntents, deliveryIntents); + return; + } int refNumber = getNextConcatenatedRef() & 0x00FF; int msgCount = parts.size(); @@ -902,6 +910,55 @@ public abstract class SMSDispatcher extends Handler { } /** + * Send a multi-part text based SMS as individual messages + * (i.e., without User Data Headers). + * + * @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 + * extended data ("pdu"). + */ + private void sendPseudoMultipartText(String destAddr, String scAddr, + ArrayList<String> parts, ArrayList<PendingIntent> sentIntents, + ArrayList<PendingIntent> deliveryIntents) { + int msgCount = parts.size(); + + mRemainingMessages = msgCount; + + for (int i = 0; i < msgCount; i++) { + PendingIntent sentIntent = null; + if (sentIntents != null && sentIntents.size() > i) { + sentIntent = sentIntents.get(i); + } + + PendingIntent deliveryIntent = null; + if (deliveryIntents != null && deliveryIntents.size() > i) { + deliveryIntent = deliveryIntents.get(i); + } + + sendText(destAddr, scAddr, parts.get(i), sentIntent, deliveryIntent); + } + } + + /** * Create a new SubmitPdu and send it. */ protected abstract void sendNewSubmitPdu(String destinationAddress, String scAddress, |