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

Commit 47ee129a authored by Aishwarya Mallampati's avatar Aishwarya Mallampati
Browse files

Use getNationalSignificantNumber to get phone number in national format

with correct number of leading zeros.

Bug: 301207616
Test: atest FdnUtilsTest,
      Manually enabled FDN and tested if the fix is working properly.
FLAG: EXEMPT bugfix
Change-Id: Ib5eaea34c136127d95e30136c44b979381bc8cfb
parent b6e87b41
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -121,7 +121,8 @@ public class FdnUtils {
        try {
            PhoneNumber phoneNumber = phoneNumberUtil.parse(dialStr, defaultCountryIso);
            dialStrE164 = phoneNumberUtil.format(phoneNumber, PhoneNumberFormat.E164);
            dialStrNational = String.valueOf(phoneNumber.getNationalNumber());
            dialStrNational = String.valueOf(
                    phoneNumberUtil.getNationalSignificantNumber(phoneNumber));
        } catch (NumberParseException ignored) {
            Rlog.w(LOG_TAG, "isFDN: could not parse dialStr");
            dialStr = extractSMSC(dialStr);
+9 −0
Original line number Diff line number Diff line
@@ -181,4 +181,13 @@ public class FdnUtilsTest {

        assertTrue(FdnUtils.isFDN("1234560000@ims.mnc.org", "US", fdnList));
    }

    @Test
    public void dialStrInNationalFormat_returnsTrue() {
        ArrayList<AdnRecord> fdnList = initializeFdnList();
        AdnRecord adnRecord = new AdnRecord(null, "0469887529");
        fdnList.add(8, adnRecord);

        assertTrue(FdnUtils.isFDN("0469887529", "US", fdnList));
    }
}
 No newline at end of file