Skip to content
Browse files

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
  • Loading branch information...
1 parent 8f14a05 commit ead27598737791a1ce1f1171c1ff9e99b380438f Tom Taylor committed with The Android Automerger Aug 1, 2012
View
10 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. -->
View
12 src/com/android/mms/MmsConfig.java
@@ -70,6 +70,12 @@
// 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 static void init(Context context) {
loadMmsSettings(context);
}
+ public static int getSmsToMmsTextThreshold() {
+ return mSmsToMmsTextThreshold;
+ }
+
public static boolean getMmsEnabled() {
return mMmsEnabled == 1 ? true : false;
}
@@ -337,6 +347,8 @@ private static void loadMmsSettings(Context context) {
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)) {
View
35 src/com/android/mms/data/WorkingMessage.java
@@ -469,26 +469,23 @@ public int setAttachment(int type, Uri dataUri, boolean append) {
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.
View
3 src/com/android/mms/ui/ComposeMessageActivity.java
@@ -552,6 +552,9 @@ private void updateCounter(CharSequence text, int start, int before, int count)
// 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:

0 comments on commit ead2759

Please sign in to comment.
Something went wrong with that request. Please try again.