SmsProvider.java中的getSingleAddressId函数
if (candidates != null) {
for (int i = 0; i < candidates.size(); i++) {
addressValue = candidates.get(i);
if (addressValue.equals(refinedAddress)) {
retVal = addressesMap.get(addressValue);
break;
}
if (isPhoneNumber && (refinedAddress != null && refinedAddress.length() <= NORMAL_NUMBER_MAX_LENGTH)
&& (addressValue != null && addressValue.length() <= NORMAL_NUMBER_MAX_LENGTH)) {
boolean useStrictPhoneNumberComparation = getContext().getResources().getBoolean(
com.android.internal.R.bool.config_use_strict_phone_number_comparation);
if (PhoneNumberUtils.compare(refinedAddress, addressValue,
useStrictPhoneNumberComparation)) {
retVal = addressesMap.get(addressValue);
break;
}
//请修改如下,为新添加的
//addstart
else
{
String temp_refinedAddress = null;
String temp_addressValue = null;
// MmsLog.d(LOG_TAG, "refinedAddress2:"+refinedAddress);
// MmsLog.d(LOG_TAG, "addressValue2:"+addressValue);
if((refinedAddress.startsWith("+7"))&&(addressValue.startsWith("8"))&& (refinedAddress.length()== (addressValue.length()+1)))
{
temp_refinedAddress = refinedAddress.replace("+7", "8");
temp_addressValue = addressValue;
}
else if((addressValue.startsWith("+7"))&&(refinedAddress.startsWith("8"))&& (addressValue.length()== (refinedAddress.length()+1)))
{
temp_refinedAddress = refinedAddress;
temp_addressValue = addressValue.replace("+7", "8");
}
// MmsLog.d(LOG_TAG, "temp_refinedAddress2:"+temp_refinedAddress);
// MmsLog.d(LOG_TAG, "temp_addressValue2:"+temp_addressValue);
if (temp_refinedAddress != null&&temp_addressValue != null)
{
if (PhoneNumberUtils.compare(temp_refinedAddress, temp_addressValue, useStrictPhoneNumberComparation)
{
// MmsLog.d(LOG_TAG, "PhoneNumberUtils.compare return true");
retVal = addressesMap.get(addressValue);
MmsLog.d(LOG_TAG, "retVal:"+retVal);
break;
}
}
}
//add end
}
}
}