From 034a2b329e469bf6888fbbcf91992f974015c2a8 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Mon, 26 Aug 2013 15:46:10 -0700 Subject: Use contacts cache in call log adapter Bug: 10490038 Change-Id: I4c7fc5094f76dfaaa321bc69d595f37bb72f87ad --- src/com/android/dialer/calllog/ContactInfoHelper.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/com/android/dialer/calllog/ContactInfoHelper.java') 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; } -- cgit v1.2.3