summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/telecom
diff options
context:
space:
mode:
authorzachh <zachh@google.com>2018-01-12 15:19:00 -0800
committerCopybara-Service <copybara-piper@google.com>2018-01-12 15:20:18 -0800
commita240266106bf99780a48d86883499dbebd20fbda (patch)
tree67a670fcc3ffa1c0461e3e675f03ea4d33782e5f /java/com/android/dialer/telecom
parentf8eb6798d116165971702a698b3e3e6c495abec6 (diff)
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
Diffstat (limited to 'java/com/android/dialer/telecom')
-rw-r--r--java/com/android/dialer/telecom/TelecomCallUtil.java18
1 files changed, 9 insertions, 9 deletions
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<String> getNormalizedNumber(Context appContext, Call call) {
Assert.isWorkerThread();
- Optional<String> e164 = getE164Number(appContext, call);
- if (e164.isPresent()) {
- return e164;
+ Optional<String> 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.
*
- * <p>If the number cannot be formatted (because for example the country cannot be determined),
- * returns {@link Optional#absent()}.
+ * <p>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<String> getE164Number(Context appContext, Call call) {
+ public static Optional<String> getValidE164Number(Context appContext, Call call) {
Assert.isWorkerThread();
String rawNumber = getNumber(call);
if (TextUtils.isEmpty(rawNumber)) {
@@ -109,7 +109,7 @@ public class TelecomCallUtil {
}
Optional<String> 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()));