Skip to content
Snippets Groups Projects
Commit d4d476e1 authored by Steve Statia's avatar Steve Statia Committed by Android (Google) Code Review
Browse files

Merge "Reformat local numbers that are placing calls in Singapore to not show...

Merge "Reformat local numbers that are placing calls in Singapore to not show the country code." into main
parents 74c4f561 f1525bed
No related branches found
No related tags found
No related merge requests found
......@@ -1283,6 +1283,8 @@ public class PhoneNumberUtils {
private static final String JAPAN_ISO_COUNTRY_CODE = "JP";
private static final String SINGAPORE_ISO_COUNTRY_CODE = "SG";
/**
* Breaks the given number down and formats it according to the rules
* for the country the number is from.
......@@ -1669,6 +1671,17 @@ public class PhoneNumberUtils {
* dialing format.
*/
result = util.format(pn, PhoneNumberUtil.PhoneNumberFormat.NATIONAL);
} else if (Flags.removeCountryCodeFromLocalSingaporeCalls() &&
(SINGAPORE_ISO_COUNTRY_CODE.equalsIgnoreCase(defaultCountryIso) &&
pn.getCountryCode() ==
util.getCountryCodeForRegion(SINGAPORE_ISO_COUNTRY_CODE) &&
(pn.getCountryCodeSource() ==
PhoneNumber.CountryCodeSource.FROM_NUMBER_WITH_PLUS_SIGN))) {
/*
* Need to reformat Singaporean phone numbers (when the user is in Singapore)
* with the country code (+65) removed to comply with Singaporean regulations.
*/
result = util.format(pn, PhoneNumberUtil.PhoneNumberFormat.NATIONAL);
} else {
result = util.formatInOriginalFormat(pn, defaultCountryIso);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment