summaryrefslogtreecommitdiffstats
path: root/java/com/android/dialer/phonenumbercache/ContactInfoHelper.java
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-06-19 11:26:01 -0700
committerEric Erfanian <erfanian@google.com>2017-06-19 11:30:45 -0700
commit2f1c7586bcce334ca69022eb8dc6d8965ceb6a05 (patch)
treebf00ada449ee3de31ec983a14e84159200aa18c2 /java/com/android/dialer/phonenumbercache/ContactInfoHelper.java
parent3d0ca68e466482971a4cf46576c50cb2bd42bcb5 (diff)
downloadandroid_packages_apps_Dialer-2f1c7586bcce334ca69022eb8dc6d8965ceb6a05.tar.gz
android_packages_apps_Dialer-2f1c7586bcce334ca69022eb8dc6d8965ceb6a05.tar.bz2
android_packages_apps_Dialer-2f1c7586bcce334ca69022eb8dc6d8965ceb6a05.zip
Update AOSP Dialer source from internal google3 repository at
cl/159428781. Test: make, treehugger This CL updates the AOSP Dialer source with all the changes that have gone into the private google3 repository. This includes all the changes from cl/152373142 (4/06/2017) to cl/159428781 (6/19/2017). This goal of these drops is to keep the AOSP source in sync with the internal google3 repository. Currently these sync are done by hand with very minor modifications to the internal source code. See the Android.mk file for list of modifications. Our current goal is to do frequent drops (daily if possible) and eventually switched to an automated process. Change-Id: Ie60a84b3936efd0ea3d95d7c86bf96d2b1663030
Diffstat (limited to 'java/com/android/dialer/phonenumbercache/ContactInfoHelper.java')
-rw-r--r--java/com/android/dialer/phonenumbercache/ContactInfoHelper.java35
1 files changed, 30 insertions, 5 deletions
diff --git a/java/com/android/dialer/phonenumbercache/ContactInfoHelper.java b/java/com/android/dialer/phonenumbercache/ContactInfoHelper.java
index bd4ba9764..4fa3147eb 100644
--- a/java/com/android/dialer/phonenumbercache/ContactInfoHelper.java
+++ b/java/com/android/dialer/phonenumbercache/ContactInfoHelper.java
@@ -203,6 +203,7 @@ public class ContactInfoHelper {
return info;
}
+ @Nullable
public ContactInfo lookupNumber(String number, String countryIso) {
return lookupNumber(number, countryIso, -1);
}
@@ -223,12 +224,14 @@ public class ContactInfoHelper {
@SuppressWarnings("ReferenceEquality")
public ContactInfo lookupNumber(String number, String countryIso, long directoryId) {
if (TextUtils.isEmpty(number)) {
+ LogUtil.d("ContactInfoHelper.lookupNumber", "number is empty");
return null;
}
ContactInfo info;
if (PhoneNumberHelper.isUriNumber(number)) {
+ LogUtil.d("ContactInfoHelper.lookupNumber", "number is sip");
// The number is a SIP address..
info = lookupContactFromUri(getContactInfoLookupUri(number, directoryId));
if (info == null || info == ContactInfo.EMPTY) {
@@ -246,6 +249,7 @@ public class ContactInfoHelper {
final ContactInfo updatedInfo;
if (info == null) {
// The lookup failed.
+ LogUtil.d("ContactInfoHelper.lookupNumber", "lookup failed");
updatedInfo = null;
} else {
// If we did not find a matching contact, generate an empty contact info for the number.
@@ -325,9 +329,11 @@ public class ContactInfoHelper {
*/
ContactInfo lookupContactFromUri(Uri uri) {
if (uri == null) {
+ LogUtil.d("ContactInfoHelper.lookupContactFromUri", "uri is null");
return null;
}
if (!PermissionsUtil.hasContactsReadPermissions(mContext)) {
+ LogUtil.d("ContactInfoHelper.lookupContactFromUri", "no contact permission, return empty");
return ContactInfo.EMPTY;
}
@@ -336,10 +342,12 @@ public class ContactInfoHelper {
String[] projection = PhoneQuery.getPhoneLookupProjection(uri);
phoneLookupCursor = mContext.getContentResolver().query(uri, projection, null, null, null);
} catch (NullPointerException e) {
+ LogUtil.e("ContactInfoHelper.lookupContactFromUri", "phone lookup", e);
// Trap NPE from pre-N CP2
return null;
}
if (phoneLookupCursor == null) {
+ LogUtil.d("ContactInfoHelper.lookupContactFromUri", "phoneLookupCursor is null");
return null;
}
@@ -408,19 +416,32 @@ public class ContactInfoHelper {
private ContactInfo queryContactInfoForPhoneNumber(
String number, String countryIso, long directoryId) {
if (TextUtils.isEmpty(number)) {
+ LogUtil.d("ContactInfoHelper.queryContactInfoForPhoneNumber", "number is empty");
return null;
}
ContactInfo info = lookupContactFromUri(getContactInfoLookupUri(number, directoryId));
+ if (info == null) {
+ LogUtil.d("ContactInfoHelper.queryContactInfoForPhoneNumber", "info looked up is null");
+ }
if (info != null && info != ContactInfo.EMPTY) {
info.formattedNumber = formatPhoneNumber(number, null, countryIso);
+ if (directoryId == -1) {
+ // Contact found in the default directory
+ info.sourceType = ContactSource.Type.SOURCE_TYPE_DIRECTORY;
+ } else {
+ // Contact found in the extended directory specified by directoryId
+ info.sourceType = ContactSource.Type.SOURCE_TYPE_EXTENDED;
+ }
} else if (mCachedNumberLookupService != null) {
CachedContactInfo cacheInfo =
mCachedNumberLookupService.lookupCachedContactFromNumber(mContext, number);
if (cacheInfo != null) {
- info = cacheInfo.getContactInfo().isBadData ? null : cacheInfo.getContactInfo();
- } else {
- info = null;
+ if (!cacheInfo.getContactInfo().isBadData) {
+ info = cacheInfo.getContactInfo();
+ } else {
+ LogUtil.i("ContactInfoHelper.queryContactInfoForPhoneNumber", "info is bad data");
+ }
}
}
return info;
@@ -601,13 +622,17 @@ public class ContactInfoHelper {
* will be updated if available.
*/
@WorkerThread
- public void updateFromCequintCallerId(ContactInfo info, String number) {
+ public void updateFromCequintCallerId(
+ @Nullable CequintCallerIdManager cequintCallerIdManager, ContactInfo info, String number) {
Assert.isWorkerThread();
if (!CequintCallerIdManager.isCequintCallerIdEnabled(mContext)) {
return;
}
+ if (cequintCallerIdManager == null) {
+ return;
+ }
CequintCallerIdContact cequintCallerIdContact =
- CequintCallerIdManager.getCequintCallerIdContact(mContext, number);
+ cequintCallerIdManager.getCequintCallerIdContact(mContext, number);
if (cequintCallerIdContact == null) {
return;
}