summaryrefslogtreecommitdiffstats
path: root/src/com/android/providers/contacts/DefaultCallLogInsertionHelper.java
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2014-06-30 19:57:44 -0700
committerTyler Gunn <tgunn@google.com>2014-06-30 19:57:44 -0700
commit778df2417da0c0186862b25519ce65ed633a9b6d (patch)
tree8ce37261ab90bf1f598d308f1b97079e8117159d /src/com/android/providers/contacts/DefaultCallLogInsertionHelper.java
parent90343852ba1309aa4471cead018d50761a13e131 (diff)
downloadpackages_providers_ContactsProvider-778df2417da0c0186862b25519ce65ed633a9b6d.zip
packages_providers_ContactsProvider-778df2417da0c0186862b25519ce65ed633a9b6d.tar.gz
packages_providers_ContactsProvider-778df2417da0c0186862b25519ce65ed633a9b6d.tar.bz2
Changing call log adapter to normalize phone number where possible.
Bug: 15616526 Change-Id: Id8fe981a622bdea786a48cbadf9ff08289ae3987
Diffstat (limited to 'src/com/android/providers/contacts/DefaultCallLogInsertionHelper.java')
-rw-r--r--src/com/android/providers/contacts/DefaultCallLogInsertionHelper.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/com/android/providers/contacts/DefaultCallLogInsertionHelper.java b/src/com/android/providers/contacts/DefaultCallLogInsertionHelper.java
index 9e90197..1e23275 100644
--- a/src/com/android/providers/contacts/DefaultCallLogInsertionHelper.java
+++ b/src/com/android/providers/contacts/DefaultCallLogInsertionHelper.java
@@ -19,6 +19,8 @@ package com.android.providers.contacts;
import android.content.ContentValues;
import android.content.Context;
import android.provider.CallLog.Calls;
+import android.telephony.PhoneNumberUtils;
+import android.text.TextUtils;
import com.android.i18n.phonenumbers.NumberParseException;
import com.android.i18n.phonenumbers.PhoneNumberUtil;
@@ -74,6 +76,15 @@ import java.util.Set;
values.put(Calls.NUMBER_PRESENTATION, Calls.PRESENTATION_UNKNOWN);
values.put(Calls.NUMBER, "");
}
+
+ // Check for a normalized number; if not present attempt to determine one now.
+ if (!values.containsKey(Calls.CACHED_NORMALIZED_NUMBER) &&
+ !TextUtils.isEmpty(number)) {
+ String normalizedNumber = PhoneNumberUtils.formatNumberToE164(number, countryIso);
+ if (!TextUtils.isEmpty(normalizedNumber)) {
+ values.put(Calls.CACHED_NORMALIZED_NUMBER, normalizedNumber);
+ }
+ }
}
private String getCurrentCountryIso() {