Replace the IDD with the '+' sign

It replaces the IDD in front of an address in 3GPP2 message with the '+'
to show as an international phone number format.

Test: Manual

Change-Id: I450b514bfd5d638ca886d8b64a6db45526f13fbf
Signed-off-by: Taesu Lee <taesu82.lee@samsung.com>
This commit is contained in:
Taesu Lee
2018-06-11 17:00:35 +09:00
parent 98e2663802
commit ee503e4c07

View File

@@ -16,6 +16,9 @@
package com.android.internal.telephony.cdma;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_OPERATOR_IDP_STRING;
import android.content.res.Resources;
import android.os.Parcel;
import android.os.SystemProperties;
import android.telephony.PhoneNumberUtils;
@@ -23,9 +26,8 @@ import android.telephony.SmsCbLocation;
import android.telephony.SmsCbMessage;
import android.telephony.cdma.CdmaSmsCbProgramData;
import android.telephony.Rlog;
import android.util.Log;
import android.text.TextUtils;
import android.content.res.Resources;
import android.util.Log;
import com.android.internal.telephony.GsmAlphabet.TextEncodingDetails;
import com.android.internal.telephony.SmsAddress;
@@ -750,8 +752,16 @@ public class SmsMessage extends SmsMessageBase {
}
private void decodeSmsDisplayAddress(SmsAddress addr) {
// PCD(Plus Code Dialing)
// 1) Replaces IDD(International Direct Dialing) with the '+' if address starts with it.
// TODO: Skip it for EF SMS(SUBMIT and DELIVER) because the IDD depends on current network?
// 2) Adds the '+' prefix if TON is International
// 3) Keeps the '+' if address starts with the '+'
String idd = SystemProperties.get(PROPERTY_OPERATOR_IDP_STRING, null);
addr.address = new String(addr.origBytes);
if (addr.ton == CdmaSmsAddress.TON_INTERNATIONAL_OR_IP) {
if (!TextUtils.isEmpty(idd) && addr.address.startsWith(idd)) {
addr.address = "+" + addr.address.substring(idd.length());
} else if (addr.ton == CdmaSmsAddress.TON_INTERNATIONAL_OR_IP) {
if (addr.address.charAt(0) != '+') {
addr.address = "+" + addr.address;
}