mms/res/values/config.xml
mms/res/xml/mms_config.xml
packages/apps/Mms/src/com/android/mms/ui/
ComposeMessageActivity.java
updateCounter(){
int[] params = SmsMessage.calculateLength(text, false);
Log.d("xxxx","calculateLength:params[0]="+params[0]+" ,params[1]="+params[1]+" ,params[2]="+params[2]+" ,params[3]="+params[3]);
/* 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];
int remainingInCurrentMessage = params[2];
if (!mIsRcsEnabled) {
if (!MmsConfig.getMultipartSmsEnabled()) {//enableMultipartSMS //R.xml.mms_config
// 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(ComposeMessageActivity.this);//smsToMmsTextThreshold//R.integer.config_max_smstomms
mWorkingMessage.setLengthRequiresMms(threshold > 0 && msgCount > threshold, true);
}
}
// Show the counter only if:
// - We are not in MMS mode
// - We are going to send more than one message OR we are getting close
boolean showCounter = false;
if (!workingMessage.requiresMms() &&
(msgCount > 1 ||
remainingInCurrentMessage <= CHARS_REMAINING_BEFORE_COUNTER_SHOWN)) {
showCounter = true;
}
}
ret[0] = ted.msgCount;
ret[1] = ted.codeUnitCount;
ret[2] = ted.codeUnitsRemaining;
ret[3] = ted.codeUnitSize;
frameworks/opt/telephony/src/java/android/telephony
SmsMessage.java
calculateLength(){
// this function is for MO SMS
TextEncodingDetails ted = (useCdmaFormatForMoSms()) ?
com.android.internal.telephony.cdma.SmsMessage.calculateLength(msgBody, use7bitOnly,
true) :
com.android.internal.telephony.gsm.SmsMessage.calculateLength(msgBody, use7bitOnly);
int ret[] = new int[4];
ret[0] = ted.msgCount;
ret[1] = ted.codeUnitCount;
ret[2] = ted.codeUnitsRemaining;
ret[3] = ted.codeUnitSize;
}
frameworks/opt/telephony/src/java/android/telephony/gsm
SmsMessage.java
calculateLength(){
GsmAlphabet.TextEncodingDetails ted =
com.android.internal.telephony.gsm.SmsMessage
.calculateLength(messageBody, use7bitOnly);
int ret[] = new int[4];
}
frameworks/opt/telephony/src/java/com/android/internal/telephony/gsm
SmsMessage.java
calculateLength(){
TextEncodingDetails ted = GsmAlphabet.countGsmSeptets(newMsgBody, use7bitOnly);
}
* This class implements the character set mapping between
* the GSM SMS 7-bit alphabet specified in TS 23.038 6.2.1
* and UTF-16
GsmAlphabet.jafva
countGsmSeptets(){
int septets = GsmAlphabet.countGsmSeptetsUsingTables(s, use7bitOnly, 0, 0);
if (septets == -1) {
return null;
}
Rlog.d("xxx", "septets="+septets);
ted.codeUnitSize = SmsConstants.ENCODING_7BIT;
ted.codeUnitCount = septets;
if (septets > SmsConstants.MAX_USER_DATA_SEPTETS) {
ted.msgCount = (septets + (SmsConstants.MAX_USER_DATA_SEPTETS_WITH_HEADER - 1)) /
SmsConstants.MAX_USER_DATA_SEPTETS_WITH_HEADER;
ted.codeUnitsRemaining = (ted.msgCount *
SmsConstants.MAX_USER_DATA_SEPTETS_WITH_HEADER) - septets;
} else {
ted.msgCount = 1;
ted.codeUnitsRemaining = SmsConstants.MAX_USER_DATA_SEPTETS - septets;
}
ted.codeUnitSize = SmsConstants.ENCODING_7BIT;
}
//计算总共多少个字符
countGsmSeptetsUsingTables(){
}