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

Commit 5450feed authored by Steve Statia's avatar Steve Statia Committed by Android (Google) Code Review
Browse files

Merge "Add Taiwan country code to be formatted for local calls to remove the...

Merge "Add Taiwan country code to be formatted for local calls to remove the international prefix." into main
parents c3584f04 8491ca1e
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -19,6 +19,17 @@ flag {
  bug: "300142897"
}

# OWNER=stevestatia TARGET=24Q4
flag {
    name: "national_country_code_formatting_for_local_calls"
    namespace: "telephony"
    description: "Make requests and bug fixes for formatting local calls based on country codes easier with a more scalable solution."
    bug: "293993310"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

# OWNER=stevestatia TARGET=24Q4
flag {
    name: "remove_country_code_from_local_singapore_calls"
+37 −0
Original line number Diff line number Diff line
@@ -673,6 +673,43 @@ public class PhoneNumberUtilsTest {
        mSetFlagsRule.disableFlags(Flags.FLAG_REMOVE_COUNTRY_CODE_FROM_LOCAL_SINGAPORE_CALLS);
    }

    @SmallTest
    @Test
    public void testFormatTaiwanNational() {
        // Disable feature flag.
        mSetFlagsRule.disableFlags(Flags.FLAG_NATIONAL_COUNTRY_CODE_FORMATTING_FOR_LOCAL_CALLS);
        assertEquals("+886 2 8729 6000", PhoneNumberUtils.formatNumber("+886287296000", "TW"));
        assertEquals("+886 2 8729 6000", PhoneNumberUtils.formatNumber("+886287296000", "tw"));
        assertEquals("+886 988 102 544", PhoneNumberUtils.formatNumber("+886988102544", "TW"));
        assertEquals("+886 988 102 544", PhoneNumberUtils.formatNumber("+886988102544", "tw"));

        // Enable feature flag.
        mSetFlagsRule.enableFlags(Flags.FLAG_NATIONAL_COUNTRY_CODE_FORMATTING_FOR_LOCAL_CALLS);
        assertEquals("02 8729 6000", PhoneNumberUtils.formatNumber("+886287296000", "TW"));
        assertEquals("02 8729 6000", PhoneNumberUtils.formatNumber("+886287296000", "tw"));
        assertEquals("0988 102 544", PhoneNumberUtils.formatNumber("+886988102544", "TW"));
        assertEquals("0988 102 544", PhoneNumberUtils.formatNumber("+886988102544", "tw"));
        mSetFlagsRule.disableFlags(Flags.FLAG_NATIONAL_COUNTRY_CODE_FORMATTING_FOR_LOCAL_CALLS);
    }

    @SmallTest
    @Test
    public void testFormatTaiwanInternational() {
        // Disable feature flag.
        mSetFlagsRule.disableFlags(Flags.FLAG_NATIONAL_COUNTRY_CODE_FORMATTING_FOR_LOCAL_CALLS);
        assertEquals("+886 2 8729 6000", PhoneNumberUtils.formatNumber("+886287296000", "US"));
        assertEquals("+886 2 8729 6000", PhoneNumberUtils.formatNumber("+886287296000", "us"));
        assertEquals("+886 988 102 544", PhoneNumberUtils.formatNumber("+886988102544", "US"));
        assertEquals("+886 988 102 544", PhoneNumberUtils.formatNumber("+886988102544", "us"));

        mSetFlagsRule.enableFlags(Flags.FLAG_NATIONAL_COUNTRY_CODE_FORMATTING_FOR_LOCAL_CALLS);
        assertEquals("+886 2 8729 6000", PhoneNumberUtils.formatNumber("+886287296000", "US"));
        assertEquals("+886 2 8729 6000", PhoneNumberUtils.formatNumber("+886287296000", "us"));
        assertEquals("+886 988 102 544", PhoneNumberUtils.formatNumber("+886988102544", "US"));
        assertEquals("+886 988 102 544", PhoneNumberUtils.formatNumber("+886988102544", "us"));
        mSetFlagsRule.disableFlags(Flags.FLAG_NATIONAL_COUNTRY_CODE_FORMATTING_FOR_LOCAL_CALLS);
    }

    @SmallTest
    @Test
    public void testFormatNumber_LeadingStarAndHash() {