summaryrefslogtreecommitdiff
path: root/src/com/android/dialer/calllog/ContactInfoHelper.java
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2013-08-26 15:46:10 -0700
committerYorke Lee <yorkelee@google.com>2013-08-28 10:02:45 -0700
commit034a2b329e469bf6888fbbcf91992f974015c2a8 (patch)
tree98b175320a6b1e3ce21aaae21a0e37def986407d /src/com/android/dialer/calllog/ContactInfoHelper.java
parent0baa98b5163f83a715b37e3cffe1488ac88ab049 (diff)
Use contacts cache in call log adapter
Bug: 10490038 Change-Id: I4c7fc5094f76dfaaa321bc69d595f37bb72f87ad
Diffstat (limited to 'src/com/android/dialer/calllog/ContactInfoHelper.java')
-rw-r--r--src/com/android/dialer/calllog/ContactInfoHelper.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/com/android/dialer/calllog/ContactInfoHelper.java b/src/com/android/dialer/calllog/ContactInfoHelper.java
index abe4a069d..10412814d 100644
--- a/src/com/android/dialer/calllog/ContactInfoHelper.java
+++ b/src/com/android/dialer/calllog/ContactInfoHelper.java
@@ -25,6 +25,8 @@ import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import com.android.contacts.common.util.UriUtils;
+import com.android.dialer.service.CachedNumberLookupService;
+import com.android.dialerbind.ServiceFactory;
/**
* Utility class to look up the contact information for a given number.
@@ -33,6 +35,9 @@ public class ContactInfoHelper {
private final Context mContext;
private final String mCurrentCountryIso;
+ private static final CachedNumberLookupService mCachedNumberLookupService =
+ ServiceFactory.newCachedNumberLookupService();
+
public ContactInfoHelper(Context context, String currentCountryIso) {
mContext = context;
mCurrentCountryIso = currentCountryIso;
@@ -183,6 +188,8 @@ public class ContactInfoHelper {
ContactInfo info = lookupContactFromUri(uri);
if (info != null && info != ContactInfo.EMPTY) {
info.formattedNumber = formatPhoneNumber(number, null, countryIso);
+ } else if (mCachedNumberLookupService != null) {
+ info = mCachedNumberLookupService.lookupCachedContactFromNumber(mContext, number);
}
return info;
}