From a240266106bf99780a48d86883499dbebd20fbda Mon Sep 17 00:00:00 2001 From: zachh Date: Fri, 12 Jan 2018 15:19:00 -0800 Subject: Cleaned up wording around "valid" and "formattable". We don't actually parition by "formattable", we parition by "valid". An invalid number like 456-7890 can be formatted to E164 ("+14567890") but what ParitionedNumbers actually does is parition by valid/invalid (and then converts the valid numbers to E164). Also added a new sharded test suite for phonenumberproto tests which had occasionally been timing out on TAP. Test: existing PiperOrigin-RevId: 181800443 Change-Id: Id64fc32c893025b0115dd350dd87e3277607f21c --- java/com/android/dialer/telecom/TelecomCallUtil.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'java/com/android/dialer/telecom') diff --git a/java/com/android/dialer/telecom/TelecomCallUtil.java b/java/com/android/dialer/telecom/TelecomCallUtil.java index 7d71b4b90..3ae952357 100644 --- a/java/com/android/dialer/telecom/TelecomCallUtil.java +++ b/java/com/android/dialer/telecom/TelecomCallUtil.java @@ -82,9 +82,9 @@ public class TelecomCallUtil { public static Optional getNormalizedNumber(Context appContext, Call call) { Assert.isWorkerThread(); - Optional e164 = getE164Number(appContext, call); - if (e164.isPresent()) { - return e164; + Optional validE164 = getValidE164Number(appContext, call); + if (validE164.isPresent()) { + return validE164; } String rawNumber = getNumber(call); if (TextUtils.isEmpty(rawNumber)) { @@ -94,14 +94,14 @@ public class TelecomCallUtil { } /** - * Formats the number of the {@code call} to E.164. The country of the SIM associated with the - * call is used to determine the country. + * Formats the number of the {@code call} to E.164 if it is valid. The country of the SIM + * associated with the call is used to determine the country. * - *

If the number cannot be formatted (because for example the country cannot be determined), - * returns {@link Optional#absent()}. + *

If the number cannot be formatted (because for example it is invalid or the country cannot + * be determined), returns {@link Optional#absent()}. */ @WorkerThread - public static Optional getE164Number(Context appContext, Call call) { + public static Optional getValidE164Number(Context appContext, Call call) { Assert.isWorkerThread(); String rawNumber = getNumber(call); if (TextUtils.isEmpty(rawNumber)) { @@ -109,7 +109,7 @@ public class TelecomCallUtil { } Optional countryCode = getCountryCode(appContext, call); if (!countryCode.isPresent()) { - LogUtil.w("TelecomCallUtil.getE164Number", "couldn't find a country code for call"); + LogUtil.w("TelecomCallUtil.getValidE164Number", "couldn't find a country code for call"); return Optional.absent(); } return Optional.fromNullable(PhoneNumberUtils.formatNumberToE164(rawNumber, countryCode.get())); -- cgit v1.2.3