summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Taylor <tomtaylor@google.com>2012-08-01 16:51:18 -0700
committerTom Taylor <tomtaylor@google.com>2012-08-01 16:51:18 -0700
commit364d926784135e4889d74c570868db046a67cceb (patch)
tree6e9cdaf25dd94ed4f269c38807820edc54116ae2
parent5851c6bcdfc9d534514013918fb3f478ca427de6 (diff)
downloadMms-364d926784135e4889d74c570868db046a67cceb.tar.gz
SMS isn't converted to MMS even after 7 segments of messages
Bug 6903793 Resurrect the mms_config.xml setting "smsToMmsTextThreshold" to allow overlays to specify an sms->mms conversion after a certain number of sms segments have been created. Tested on mysid, yakju, and sojus. All three have different settings for this feature. Also tested bug fixed by https://googleplex-android-review.googlesource.com/#/c/103729/. Change-Id: Ibcfd235edbaa264fede6e48f84f04345d16368fa
-rw-r--r--res/xml/mms_config.xml10
-rwxr-xr-xsrc/com/android/mms/MmsConfig.java12
-rwxr-xr-xsrc/com/android/mms/data/WorkingMessage.java35
-rw-r--r--src/com/android/mms/ui/ComposeMessageActivity.java3
4 files changed, 37 insertions, 23 deletions
diff --git a/res/xml/mms_config.xml b/res/xml/mms_config.xml
index 988458b8..78567e26 100644
--- a/res/xml/mms_config.xml
+++ b/res/xml/mms_config.xml
@@ -57,15 +57,17 @@
to indicate no limit. -->
<int name="recipientLimit">-1</int>
- <!-- Maximum number of SMS message segments in a long text message before converting
- the SMS message to an MMS message. -->
- <int name="smsToMmsTextThreshold">4</int>
-
<!-- If true, The text message over 160 characters will be sent in multi part.
If false, The text message over 160 characters will be sent
via multi media message. -->
<bool name="enableMultipartSMS">true</bool>
+ <!-- If enableMultipartSMS is true and smsToMmsTextThreshold > 1, then multi-part SMS messages
+ will be converted into a single mms message. For example, if the mms_config.xml file
+ specifies <int name="smsToMmsTextThreshold">7</int>, then on the 8th sms segment, the
+ message will be converted to an mms. -->
+ <int name="smsToMmsTextThreshold">-1</int>
+
<!-- If true, The mms support slide duration.
If false, The mms does not support slide duration and we have to
set duration value. -->
diff --git a/src/com/android/mms/MmsConfig.java b/src/com/android/mms/MmsConfig.java
index ee4392b6..faab6304 100755
--- a/src/com/android/mms/MmsConfig.java
+++ b/src/com/android/mms/MmsConfig.java
@@ -70,6 +70,12 @@ public class MmsConfig {
// as an mms message. This feature exists for carriers that don't support multi-part sms's.
private static boolean mEnableMultipartSMS = true;
+ // If mEnableMultipartSMS is true and mSmsToMmsTextThreshold > 1, then multi-part SMS messages
+ // will be converted into a single mms message. For example, if the mms_config.xml file
+ // specifies <int name="smsToMmsTextThreshold">4</int>, then on the 5th sms segment, the
+ // message will be converted to an mms.
+ private static int mSmsToMmsTextThreshold = -1;
+
private static boolean mEnableSlideDuration = true;
private static boolean mEnableMMSReadReports = true; // key: "enableMMSReadReports"
private static boolean mEnableSMSDeliveryReports = true; // key: "enableSMSDeliveryReports"
@@ -100,6 +106,10 @@ public class MmsConfig {
loadMmsSettings(context);
}
+ public static int getSmsToMmsTextThreshold() {
+ return mSmsToMmsTextThreshold;
+ }
+
public static boolean getMmsEnabled() {
return mMmsEnabled == 1 ? true : false;
}
@@ -337,6 +347,8 @@ public class MmsConfig {
mAliasRuleMinChars = Integer.parseInt(text);
} else if ("aliasMaxChars".equalsIgnoreCase(value)) {
mAliasRuleMaxChars = Integer.parseInt(text);
+ } else if ("smsToMmsTextThreshold".equalsIgnoreCase(value)) {
+ mSmsToMmsTextThreshold = Integer.parseInt(text);
} else if ("maxMessageTextSize".equalsIgnoreCase(value)) {
mMaxTextLength = Integer.parseInt(text);
} else if ("maxSubjectLength".equalsIgnoreCase(value)) {
diff --git a/src/com/android/mms/data/WorkingMessage.java b/src/com/android/mms/data/WorkingMessage.java
index d6bd3b10..14dd7b4c 100755
--- a/src/com/android/mms/data/WorkingMessage.java
+++ b/src/com/android/mms/data/WorkingMessage.java
@@ -469,26 +469,23 @@ public class WorkingMessage {
mStatusListener.onAttachmentChanged(); // have to call whether succeeded or failed,
// because a replace that fails, removes the slide
- if (!MmsConfig.getMultipartSmsEnabled()) {
- if (!append && mAttachmentType == TEXT && type == TEXT) {
- int[] params = SmsMessage.calculateLength(getText(), false);
- /* SmsMessage.calculateLength returns an int[4] with:
- * int[0] being the number of SMS's required,
- * int[1] the number of code units used,
- * int[2] is the number of code units remaining until the next message.
- * int[3] is the encoding type that should be used for the message.
- */
- int msgCount = params[0];
-
- if (msgCount > 1) {
- // The provider doesn't support multi-part sms's so as soon as the user types
- // an sms longer than one segment, we have to turn the message into an mms.
- setLengthRequiresMms(true, false);
- } else {
- updateState(HAS_ATTACHMENT, hasAttachment(), true);
- }
+ if (!append && mAttachmentType == TEXT && type == TEXT) {
+ int[] params = SmsMessage.calculateLength(getText(), false);
+ /* SmsMessage.calculateLength returns an int[4] with:
+ * int[0] being the number of SMS's required,
+ * int[1] the number of code units used,
+ * int[2] is the number of code units remaining until the next message.
+ * int[3] is the encoding type that should be used for the message.
+ */
+ int smsSegmentCount = params[0];
+
+ if (!MmsConfig.getMultipartSmsEnabled()) {
+ // The provider doesn't support multi-part sms's so as soon as the user types
+ // an sms longer than one segment, we have to turn the message into an mms.
+ setLengthRequiresMms(smsSegmentCount > 1, false);
} else {
- updateState(HAS_ATTACHMENT, hasAttachment(), true);
+ int threshold = MmsConfig.getSmsToMmsTextThreshold();
+ setLengthRequiresMms(threshold > 0 && smsSegmentCount > threshold, false);
}
} else {
// Set HAS_ATTACHMENT if we need it.
diff --git a/src/com/android/mms/ui/ComposeMessageActivity.java b/src/com/android/mms/ui/ComposeMessageActivity.java
index 2ba2ef28..638c7bce 100644
--- a/src/com/android/mms/ui/ComposeMessageActivity.java
+++ b/src/com/android/mms/ui/ComposeMessageActivity.java
@@ -552,6 +552,9 @@ public class ComposeMessageActivity extends Activity
// The provider doesn't support multi-part sms's so as soon as the user types
// an sms longer than one segment, we have to turn the message into an mms.
mWorkingMessage.setLengthRequiresMms(msgCount > 1, true);
+ } else {
+ int threshold = MmsConfig.getSmsToMmsTextThreshold();
+ mWorkingMessage.setLengthRequiresMms(threshold > 0 && msgCount > threshold, true);
}
// Show the counter only if: