summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/phonenumbercache
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-03-27 12:31:48 -0700
committerEric Erfanian <erfanian@google.com>2017-03-27 12:31:48 -0700
commit9779f967ebb9512e5b19090b071572c9c4f0f2a6 (patch)
tree55d3e81855905643abd7b3ce5576a58ee0e9d9e6 /java/com/android/dialer/phonenumbercache
parent9050823ccf6f512e06ad65c8a741cb17cbc4a833 (diff)
Update AOSP Dialer source from internal google3 repository at
cl/151342913. 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/151128062 (3/24/2017) to cl/151342913 (3/27/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: I8d4855628b62e9067e71f32ed40317617a1e3b02
Diffstat (limited to 'java/com/android/dialer/phonenumbercache')
-rw-r--r--java/com/android/dialer/phonenumbercache/ContactInfo.java11
-rw-r--r--java/com/android/dialer/phonenumbercache/ContactInfoHelper.java38
2 files changed, 45 insertions, 4 deletions
diff --git a/java/com/android/dialer/phonenumbercache/ContactInfo.java b/java/com/android/dialer/phonenumbercache/ContactInfo.java
index d7a75c34f..03240cc62 100644
--- a/java/com/android/dialer/phonenumbercache/ContactInfo.java
+++ b/java/com/android/dialer/phonenumbercache/ContactInfo.java
@@ -38,6 +38,7 @@ public class ContactInfo {
public String label;
public String number;
public String formattedNumber;
+ public String geoDescription;
/*
* ContactInfo.normalizedNumber is a column value returned by PhoneLookup query. By definition,
* it's E164 representation.
@@ -121,7 +122,13 @@ public class ContactInfo {
if (userType != other.userType) {
return false;
}
- return carrierPresence == other.carrierPresence;
+ if (carrierPresence != other.carrierPresence) {
+ return false;
+ }
+ if (!TextUtils.equals(geoDescription, other.geoDescription)) {
+ return false;
+ }
+ return true;
}
@Override
@@ -160,6 +167,8 @@ public class ContactInfo {
+ userType
+ ", carrierPresence="
+ carrierPresence
+ + ", geoDescription="
+ + geoDescription
+ '}';
}
}
diff --git a/java/com/android/dialer/phonenumbercache/ContactInfoHelper.java b/java/com/android/dialer/phonenumbercache/ContactInfoHelper.java
index 6a5e2e6b4..66ddd06fd 100644
--- a/java/com/android/dialer/phonenumbercache/ContactInfoHelper.java
+++ b/java/com/android/dialer/phonenumbercache/ContactInfoHelper.java
@@ -33,12 +33,14 @@ import android.provider.ContactsContract.PhoneLookup;
import android.support.annotation.Nullable;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
-import android.util.Log;
import com.android.contacts.common.ContactsUtils;
import com.android.contacts.common.ContactsUtils.UserType;
import com.android.contacts.common.compat.DirectoryCompat;
import com.android.contacts.common.util.Constants;
import com.android.contacts.common.util.UriUtils;
+import com.android.dialer.common.LogUtil;
+import com.android.dialer.oem.CequintCallerIdManager;
+import com.android.dialer.oem.CequintCallerIdManager.CequintCallerIdContact;
import com.android.dialer.phonenumbercache.CachedNumberLookupService.CachedContactInfo;
import com.android.dialer.phonenumberutil.PhoneNumberHelper;
import com.android.dialer.telecom.TelecomUtil;
@@ -131,7 +133,7 @@ public class ContactInfoHelper {
}
} catch (IllegalArgumentException e) {
// Avoid dialer crash when lookup key is not valid
- Log.e(TAG, "IllegalArgumentException in lookUpDisplayNameAlternative", e);
+ LogUtil.e(TAG, "IllegalArgumentException in lookUpDisplayNameAlternative", e);
} finally {
if (cursor != null) {
cursor.close();
@@ -508,6 +510,11 @@ public class ContactInfoHelper {
values.put(Calls.CACHED_FORMATTED_NUMBER, updatedInfo.formattedNumber);
needsUpdate = true;
}
+
+ if (!TextUtils.equals(updatedInfo.geoDescription, callLogInfo.geoDescription)) {
+ values.put(Calls.GEOCODED_LOCATION, updatedInfo.geoDescription);
+ needsUpdate = true;
+ }
} else {
// No previous values, store all of them.
values.put(Calls.CACHED_NAME, updatedInfo.name);
@@ -521,6 +528,7 @@ public class ContactInfoHelper {
Calls.CACHED_PHOTO_URI,
UriUtils.uriToString(UriUtils.nullForNonContactsUri(updatedInfo.photoUri)));
values.put(Calls.CACHED_FORMATTED_NUMBER, updatedInfo.formattedNumber);
+ values.put(Calls.GEOCODED_LOCATION, updatedInfo.geoDescription);
needsUpdate = true;
}
@@ -547,7 +555,7 @@ public class ContactInfoHelper {
new String[] {number, countryIso});
}
} catch (SQLiteFullException e) {
- Log.e(TAG, "Unable to update contact info in call log db", e);
+ LogUtil.e(TAG, "Unable to update contact info in call log db", e);
}
}
@@ -583,4 +591,28 @@ public class ContactInfoHelper {
return mCachedNumberLookupService != null
&& mCachedNumberLookupService.canReportAsInvalid(sourceType, objectId);
}
+
+ /**
+ * Update ContactInfo by querying to Cequint Caller ID. Only name, geoDescription and photo uri
+ * will be updated if available.
+ */
+ public void updateFromCequintCallerId(ContactInfo info, String number) {
+ if (!CequintCallerIdManager.isCequintCallerIdEnabled(mContext)) {
+ return;
+ }
+ CequintCallerIdContact cequintCallerIdContact =
+ CequintCallerIdManager.getCequintCallerIdContact(mContext, number);
+ if (cequintCallerIdContact == null) {
+ return;
+ }
+ if (!TextUtils.isEmpty(cequintCallerIdContact.name)) {
+ info.name = cequintCallerIdContact.name;
+ }
+ if (!TextUtils.isEmpty(cequintCallerIdContact.geoDescription)) {
+ info.geoDescription = cequintCallerIdContact.geoDescription;
+ }
+ if (cequintCallerIdContact.imageUrl != null) {
+ info.photoUri = UriUtils.parseUriOrNull(cequintCallerIdContact.imageUrl);
+ }
+ }
}