summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/phonenumbercache
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-04-06 09:41:50 -0700
committerEric Erfanian <erfanian@google.com>2017-04-06 09:41:50 -0700
commitd8046e520a866b9948ee9ba47cf642b441ca8e23 (patch)
tree8d08d4f2292aa84dc435d455891e7ab633d95a25 /java/com/android/dialer/phonenumbercache
parentcdb1edf966a892abebcba425a85b7d4e47758302 (diff)
Update AOSP Dialer source from internal google3 repository at
cl/152373142. 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/151342913 (3/27/2017) to cl/152373142 (4/06/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: I2fbc88cf6867b90ac8b65f75e5e34468988c7217
Diffstat (limited to 'java/com/android/dialer/phonenumbercache')
-rw-r--r--java/com/android/dialer/phonenumbercache/CachedNumberLookupService.java17
-rw-r--r--java/com/android/dialer/phonenumbercache/ContactInfo.java3
-rw-r--r--java/com/android/dialer/phonenumbercache/ContactInfoHelper.java9
3 files changed, 25 insertions, 4 deletions
diff --git a/java/com/android/dialer/phonenumbercache/CachedNumberLookupService.java b/java/com/android/dialer/phonenumbercache/CachedNumberLookupService.java
index f443d56fb..e589a6882 100644
--- a/java/com/android/dialer/phonenumbercache/CachedNumberLookupService.java
+++ b/java/com/android/dialer/phonenumbercache/CachedNumberLookupService.java
@@ -18,10 +18,13 @@ package com.android.dialer.phonenumbercache;
import android.content.Context;
import android.net.Uri;
+import android.support.annotation.IntDef;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.WorkerThread;
import java.io.InputStream;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
public interface CachedNumberLookupService {
@@ -66,11 +69,23 @@ public interface CachedNumberLookupService {
int SOURCE_TYPE_PLACES = 3;
int SOURCE_TYPE_PROFILE = 4;
int SOURCE_TYPE_CNAP = 5;
+ int SOURCE_TYPE_CEQUINT_CALLER_ID = 6;
+
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef({
+ SOURCE_TYPE_DIRECTORY,
+ SOURCE_TYPE_EXTENDED,
+ SOURCE_TYPE_PLACES,
+ SOURCE_TYPE_PROFILE,
+ SOURCE_TYPE_CNAP,
+ SOURCE_TYPE_CEQUINT_CALLER_ID
+ })
+ public @interface ContactSourceType {}
@NonNull
ContactInfo getContactInfo();
- void setSource(int sourceType, String name, long directoryId);
+ void setSource(@ContactSourceType int sourceType, String name, long directoryId);
void setDirectorySource(String name, long directoryId);
diff --git a/java/com/android/dialer/phonenumbercache/ContactInfo.java b/java/com/android/dialer/phonenumbercache/ContactInfo.java
index 03240cc62..dab5e4b4c 100644
--- a/java/com/android/dialer/phonenumbercache/ContactInfo.java
+++ b/java/com/android/dialer/phonenumbercache/ContactInfo.java
@@ -20,6 +20,7 @@ import android.net.Uri;
import android.text.TextUtils;
import com.android.contacts.common.ContactsUtils.UserType;
import com.android.contacts.common.util.UriUtils;
+import com.android.dialer.phonenumbercache.CachedNumberLookupService.CachedContactInfo.ContactSourceType;
/** Information for a contact as needed by the Call Log. */
public class ContactInfo {
@@ -57,7 +58,7 @@ public class ContactInfo {
public boolean isBadData;
public String objectId;
public @UserType long userType;
- public int sourceType = 0;
+ public @ContactSourceType int sourceType = 0;
/** @see android.provider.ContactsContract.CommonDataKinds.Phone#CARRIER_PRESENCE */
public int carrierPresence;
diff --git a/java/com/android/dialer/phonenumbercache/ContactInfoHelper.java b/java/com/android/dialer/phonenumbercache/ContactInfoHelper.java
index 66ddd06fd..dc11c1b21 100644
--- a/java/com/android/dialer/phonenumbercache/ContactInfoHelper.java
+++ b/java/com/android/dialer/phonenumbercache/ContactInfoHelper.java
@@ -31,6 +31,7 @@ import android.provider.ContactsContract.Directory;
import android.provider.ContactsContract.DisplayNameSources;
import android.provider.ContactsContract.PhoneLookup;
import android.support.annotation.Nullable;
+import android.support.annotation.WorkerThread;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import com.android.contacts.common.ContactsUtils;
@@ -38,6 +39,7 @@ 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.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.oem.CequintCallerIdManager;
import com.android.dialer.oem.CequintCallerIdManager.CequintCallerIdContact;
@@ -596,7 +598,9 @@ public class ContactInfoHelper {
* Update ContactInfo by querying to Cequint Caller ID. Only name, geoDescription and photo uri
* will be updated if available.
*/
+ @WorkerThread
public void updateFromCequintCallerId(ContactInfo info, String number) {
+ Assert.isWorkerThread();
if (!CequintCallerIdManager.isCequintCallerIdEnabled(mContext)) {
return;
}
@@ -605,13 +609,14 @@ public class ContactInfoHelper {
if (cequintCallerIdContact == null) {
return;
}
- if (!TextUtils.isEmpty(cequintCallerIdContact.name)) {
+ if (TextUtils.isEmpty(info.name) && !TextUtils.isEmpty(cequintCallerIdContact.name)) {
info.name = cequintCallerIdContact.name;
}
if (!TextUtils.isEmpty(cequintCallerIdContact.geoDescription)) {
info.geoDescription = cequintCallerIdContact.geoDescription;
+ info.sourceType = CachedContactInfo.SOURCE_TYPE_CEQUINT_CALLER_ID;
}
- if (cequintCallerIdContact.imageUrl != null) {
+ if (info.photoUri == null && cequintCallerIdContact.imageUrl != null) {
info.photoUri = UriUtils.parseUriOrNull(cequintCallerIdContact.imageUrl);
}
}