diff options
Diffstat (limited to 'java/com/android/dialer/phonelookup')
3 files changed, 18 insertions, 6 deletions
diff --git a/java/com/android/dialer/phonelookup/cp2/Cp2DefaultDirectoryPhoneLookup.java b/java/com/android/dialer/phonelookup/cp2/Cp2DefaultDirectoryPhoneLookup.java index fb2cd0a27..2e6bcde51 100644 --- a/java/com/android/dialer/phonelookup/cp2/Cp2DefaultDirectoryPhoneLookup.java +++ b/java/com/android/dialer/phonelookup/cp2/Cp2DefaultDirectoryPhoneLookup.java @@ -24,6 +24,7 @@ import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.DeletedContacts; +import android.provider.ContactsContract.Directory; import android.support.annotation.Nullable; import android.support.v4.util.ArrayMap; import android.support.v4.util.ArraySet; @@ -134,7 +135,8 @@ public final class Cp2DefaultDirectoryPhoneLookup implements PhoneLookup<Cp2Info return Cp2Info.getDefaultInstance(); } while (cursor.moveToNext()) { - cp2ContactInfos.add(Cp2Projections.buildCp2ContactInfoFromCursor(appContext, cursor)); + cp2ContactInfos.add( + Cp2Projections.buildCp2ContactInfoFromCursor(appContext, cursor, Directory.DEFAULT)); } } finally { if (cursor != null) { @@ -794,7 +796,8 @@ public final class Cp2DefaultDirectoryPhoneLookup implements PhoneLookup<Cp2Info cp2ContactInfosByNumber.put(validE164Number, cp2ContactInfos); } cp2ContactInfos.add( - Cp2Projections.buildCp2ContactInfoFromCursor(appContext, cursor)); + Cp2Projections.buildCp2ContactInfoFromCursor( + appContext, cursor, Directory.DEFAULT)); } } } @@ -818,7 +821,8 @@ public final class Cp2DefaultDirectoryPhoneLookup implements PhoneLookup<Cp2Info } else { while (cursor.moveToNext()) { cp2ContactInfos.add( - Cp2Projections.buildCp2ContactInfoFromCursor(appContext, cursor)); + Cp2Projections.buildCp2ContactInfoFromCursor( + appContext, cursor, Directory.DEFAULT)); } } } diff --git a/java/com/android/dialer/phonelookup/cp2/Cp2ExtendedDirectoryPhoneLookup.java b/java/com/android/dialer/phonelookup/cp2/Cp2ExtendedDirectoryPhoneLookup.java index ad1e9a906..528959342 100644 --- a/java/com/android/dialer/phonelookup/cp2/Cp2ExtendedDirectoryPhoneLookup.java +++ b/java/com/android/dialer/phonelookup/cp2/Cp2ExtendedDirectoryPhoneLookup.java @@ -175,7 +175,7 @@ public final class Cp2ExtendedDirectoryPhoneLookup implements PhoneLookup<Cp2Inf do { cp2InfoBuilder.addCp2ContactInfo( - Cp2Projections.buildCp2ContactInfoFromCursor(appContext, cursor)); + Cp2Projections.buildCp2ContactInfoFromCursor(appContext, cursor, directoryId)); } while (cursor.moveToNext()); } diff --git a/java/com/android/dialer/phonelookup/cp2/Cp2Projections.java b/java/com/android/dialer/phonelookup/cp2/Cp2Projections.java index 377091264..38390e559 100644 --- a/java/com/android/dialer/phonelookup/cp2/Cp2Projections.java +++ b/java/com/android/dialer/phonelookup/cp2/Cp2Projections.java @@ -18,6 +18,7 @@ package com.android.dialer.phonelookup.cp2; import android.content.Context; import android.database.Cursor; +import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.PhoneLookup; @@ -85,7 +86,8 @@ final class Cp2Projections { * Builds a {@link Cp2ContactInfo} based on the current row of {@code cursor}, of which the * projection is either {@link #PHONE_PROJECTION} or {@link #PHONE_LOOKUP_PROJECTION}. */ - static Cp2ContactInfo buildCp2ContactInfoFromCursor(Context appContext, Cursor cursor) { + static Cp2ContactInfo buildCp2ContactInfoFromCursor( + Context appContext, Cursor cursor, long directoryId) { String displayName = cursor.getString(CP2_INFO_NAME_INDEX); String photoThumbnailUri = cursor.getString(CP2_INFO_PHOTO_THUMBNAIL_URI_INDEX); String photoUri = cursor.getString(CP2_INFO_PHOTO_URI_INDEX); @@ -116,7 +118,13 @@ final class Cp2Projections { } infoBuilder.setContactId(contactId); if (!TextUtils.isEmpty(lookupKey)) { - infoBuilder.setLookupUri(Contacts.getLookupUri(contactId, lookupKey).toString()); + infoBuilder.setLookupUri( + Contacts.getLookupUri(contactId, lookupKey) + .buildUpon() + .appendQueryParameter( + ContactsContract.DIRECTORY_PARAM_KEY, String.valueOf(directoryId)) + .build() + .toString()); } // Only PHONE_PROJECTION has a column containing carrier presence info. |