summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRohit Yengisetty <rohit@cyngn.com>2016-01-19 13:47:16 -0800
committerRohit Yengisetty <rohit@cyngn.com>2016-01-19 13:47:16 -0800
commitd6302ae725bf1058e24bafef177a7c81384a4662 (patch)
treeb0b23b19cc0a39f5e0dd46c61bb8c46783011356 /src
parentb88149fe81a554927c42cf90e5e00a1170786d52 (diff)
downloadandroid_packages_apps_ContactsCommon-d6302ae725bf1058e24bafef177a7c81384a4662.tar.gz
android_packages_apps_ContactsCommon-d6302ae725bf1058e24bafef177a7c81384a4662.tar.bz2
android_packages_apps_ContactsCommon-d6302ae725bf1058e24bafef177a7c81384a4662.zip
Add lookupkey for Contact in ContactBuilder
Change-Id: I3271b7c14ef3c61c6f976fcb369c340c1bbaf7bb
Diffstat (limited to 'src')
-rw-r--r--src/com/android/contacts/common/model/ContactBuilder.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/com/android/contacts/common/model/ContactBuilder.java b/src/com/android/contacts/common/model/ContactBuilder.java
index b40ea26b..9056ff03 100644
--- a/src/com/android/contacts/common/model/ContactBuilder.java
+++ b/src/com/android/contacts/common/model/ContactBuilder.java
@@ -17,6 +17,7 @@
package com.android.contacts.common.model;
import android.content.ContentValues;
+import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import com.android.contacts.common.util.CallerMetaData;
@@ -74,6 +75,7 @@ public class ContactBuilder {
private int mDisplayNameSource = DisplayNameSources.STRUCTURED_NAME;
private Uri mPhotoUri;
private String mPhotoUrl;
+ private String mLookupKey;
private boolean mIsBusiness;
@@ -145,6 +147,14 @@ public class ContactBuilder {
}
}
+ // determine the lookup-key for the contact
+ if (nameObj != null && !TextUtils.isEmpty(mName.displayName)) {
+ mLookupKey = mName.displayName;
+ } else if (mPhoneNumbers.size() > 0) {
+ String number = mPhoneNumbers.get(0).number;
+ mLookupKey = PhoneNumberUtils.normalizeNumber(number);
+ }
+
mSpamCount = contact.optInt(CallerMetaData.SPAM_COUNT, 0);
mInfoProviderName = contact.optString(CallerMetaData.INFO_PROVIDER, null);
mSuccinctLocation = contact.optString(CallerMetaData.SUCCINCT_LOCATION, null);
@@ -387,7 +397,7 @@ public class ContactBuilder {
lookupUri, lookupUri,
lookupUri,
mDirectoryId,
- null /* lookupKey */,
+ mLookupKey,
-1 /* id */,
-1 /* nameRawContactId */,
mDisplayNameSource,