From dede7e703541f81af4533ce4a53f18f327090568 Mon Sep 17 00:00:00 2001 From: calderwoodra Date: Thu, 31 Aug 2017 02:01:35 -0700 Subject: NewSearchFragment contact photos now properly open quick contact cards. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There was an issue where businesses' and remote contacts' contact photos wouldn't open contact cards correctly. The issue was rooted in the incorrect contact uri being assigned to the quick contact badge. from the bugbash: 16. Tap on business icon from search results says “ no application found” instead of opening the business info 17. Same as #16 but with contact from Directory Google.com - “The contact doesn’t exist” when tapping contact icon Bug: 64902476 Test: existing PiperOrigin-RevId: 167111016 Change-Id: I4b6f7ca812d2fc4dc220951e8c05db2c8b8d6114 --- .../dialer/searchfragment/remote/RemoteContactViewHolder.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'java/com/android/dialer/searchfragment/remote/RemoteContactViewHolder.java') diff --git a/java/com/android/dialer/searchfragment/remote/RemoteContactViewHolder.java b/java/com/android/dialer/searchfragment/remote/RemoteContactViewHolder.java index 5fb12d349..df3eacc5b 100644 --- a/java/com/android/dialer/searchfragment/remote/RemoteContactViewHolder.java +++ b/java/com/android/dialer/searchfragment/remote/RemoteContactViewHolder.java @@ -22,6 +22,7 @@ import android.database.Cursor; import android.net.Uri; import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Phone; +import android.provider.ContactsContract.Contacts; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.view.View; @@ -119,10 +120,14 @@ public final class RemoteContactViewHolder extends RecyclerView.ViewHolder return (String) Phone.getTypeLabel(resources, numberType, numberLabel); } - private static Uri getContactUri(Cursor cursor) { + private static Uri getContactUri(SearchCursor cursor) { long contactId = cursor.getLong(Projections.PHONE_ID); String lookupKey = cursor.getString(Projections.PHONE_LOOKUP_KEY); - return ContactsContract.Contacts.getLookupUri(contactId, lookupKey); + return Contacts.getLookupUri(contactId, lookupKey) + .buildUpon() + .appendQueryParameter( + ContactsContract.DIRECTORY_PARAM_KEY, String.valueOf(cursor.getDirectoryId())) + .build(); } @Override -- cgit v1.2.3