From ab4443c7e235e0feebca7eadf70ecd9bd2455b46 Mon Sep 17 00:00:00 2001 From: Brandon Maxwell Date: Mon, 2 Nov 2015 11:28:35 -0800 Subject: Changing method to public, static for use in InCallUi + Changed ContactInfoHelper.lookUpDisplayNameAlternative to public so it's usable in InCallUi + Changed ContactInfoHelper.lookUpDisplayNamealternative to static to cut down on object creation + Added tests for lookUpDisplayNameAlternative since it is public Change-Id: Iede746655a1ca773cb0cd8cf26df665e34ab47fc --- src/com/android/dialer/calllog/ContactInfoHelper.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/com/android/dialer/calllog/ContactInfoHelper.java b/src/com/android/dialer/calllog/ContactInfoHelper.java index 4b9d5532a..e760750b2 100644 --- a/src/com/android/dialer/calllog/ContactInfoHelper.java +++ b/src/com/android/dialer/calllog/ContactInfoHelper.java @@ -170,7 +170,7 @@ public class ContactInfoHelper { } String lookupKey = phoneLookupCursor.getString(PhoneQuery.LOOKUP_KEY); ContactInfo contactInfo = createPhoneLookupContactInfo(phoneLookupCursor, lookupKey); - contactInfo.nameAlternative = lookUpDisplayNameAlternative(lookupKey); + contactInfo.nameAlternative = lookUpDisplayNameAlternative(mContext, lookupKey); return contactInfo; } finally { phoneLookupCursor.close(); @@ -193,10 +193,14 @@ public class ContactInfoHelper { return info; } - private String lookUpDisplayNameAlternative(String lookupKey) { + public static String lookUpDisplayNameAlternative(Context context, String lookupKey) { + if (lookupKey == null) { + return null; + } + Uri uri = Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI, lookupKey); - Cursor cursor = mContext.getContentResolver().query(uri, + Cursor cursor = context.getContentResolver().query(uri, PhoneQuery.DISPLAY_NAME_ALTERNATIVE_PROJECTION, null, null, null); if (cursor == null) { -- cgit v1.2.3