Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -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);
            }