diff options
author | Eric Erfanian <erfanian@google.com> | 2017-05-03 23:10:39 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-05-03 23:10:39 +0000 |
commit | d67f1627521b174f12e0c247f154c7c93c5e408e (patch) | |
tree | 1a45d60921e293c6088efeaf4d9c408456f3e0e2 /java/com/android/incallui/ContactInfoCache.java | |
parent | 010981b798fbc6b8e6a00c3ea507f00c3e77c371 (diff) | |
parent | 8369df095a73a77b3715f8ae7ba06089cebca4ce (diff) |
This change reflects the Dialer V10 RC00 branch.
am: 8369df095a
Change-Id: I6820870feb74cba010ac3039e4da41325b3005f9
Diffstat (limited to 'java/com/android/incallui/ContactInfoCache.java')
-rw-r--r-- | java/com/android/incallui/ContactInfoCache.java | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/java/com/android/incallui/ContactInfoCache.java b/java/com/android/incallui/ContactInfoCache.java index 9e696b55e..3014de363 100644 --- a/java/com/android/incallui/ContactInfoCache.java +++ b/java/com/android/incallui/ContactInfoCache.java @@ -45,7 +45,8 @@ import com.android.dialer.common.Assert; import com.android.dialer.common.concurrent.DialerExecutor; import com.android.dialer.common.concurrent.DialerExecutor.Worker; import com.android.dialer.common.concurrent.DialerExecutors; -import com.android.dialer.logging.nano.ContactLookupResult; +import com.android.dialer.logging.ContactLookupResult; +import com.android.dialer.logging.ContactSource; import com.android.dialer.oem.CequintCallerIdManager; import com.android.dialer.oem.CequintCallerIdManager.CequintCallerIdContact; import com.android.dialer.phonenumbercache.CachedNumberLookupService; @@ -98,7 +99,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener { } ContactInfo contactInfo = new ContactInfo(); CachedContactInfo cacheInfo = input.service.buildCachedContactInfo(contactInfo); - cacheInfo.setSource(CachedContactInfo.SOURCE_TYPE_CNAP, "CNAP", 0); + cacheInfo.setSource(ContactSource.Type.SOURCE_TYPE_CNAP, "CNAP", 0); contactInfo.name = input.cnapName; contactInfo.number = input.number; contactInfo.type = ContactsContract.CommonDataKinds.Phone.TYPE_MAIN; @@ -143,8 +144,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener { // TODO: get rid of caller info. final CallerInfo info = CallerInfoUtils.buildCallerInfo(context, call); - ContactInfoCache.populateCacheEntry( - context, info, entry, call.getNumberPresentation(), isIncoming); + ContactInfoCache.populateCacheEntry(context, info, entry, call.getNumberPresentation()); return entry; } @@ -153,8 +153,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener { @NonNull Context context, @NonNull CallerInfo info, @NonNull ContactCacheEntry cce, - int presentation, - boolean isIncoming) { + int presentation) { Objects.requireNonNull(info); String displayName = null; String displayNumber = null; @@ -442,7 +441,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener { } // We always replace the entry. The only exception is the same photo case. - ContactCacheEntry cacheEntry = buildEntry(mContext, callerInfo, presentationMode, isIncoming); + ContactCacheEntry cacheEntry = buildEntry(mContext, callerInfo, presentationMode); cacheEntry.queryId = queryToken.mQueryId; ContactCacheEntry existingCacheEntry = mInfoMap.get(callId); @@ -509,20 +508,26 @@ public class ContactInfoCache implements OnImageLoadCompleteListener { if (cequintCallerIdContact == null) { return; } + boolean hasUpdate = false; if (TextUtils.isEmpty(callerInfo.name) && !TextUtils.isEmpty(cequintCallerIdContact.name)) { callerInfo.name = cequintCallerIdContact.name; - callerInfo.contactExists = true; + hasUpdate = true; } if (!TextUtils.isEmpty(cequintCallerIdContact.geoDescription)) { callerInfo.geoDescription = cequintCallerIdContact.geoDescription; callerInfo.shouldShowGeoDescription = true; - callerInfo.contactExists = true; + hasUpdate = true; } - if (callerInfo.contactDisplayPhotoUri == null && cequintCallerIdContact.imageUrl != null) { + // Don't overwrite photo in local contacts. + if (!callerInfo.contactExists + && callerInfo.contactDisplayPhotoUri == null + && cequintCallerIdContact.imageUrl != null) { callerInfo.contactDisplayPhotoUri = Uri.parse(cequintCallerIdContact.imageUrl); - callerInfo.contactExists = true; + hasUpdate = true; } + // Set contact to exist to avoid phone number service lookup. + callerInfo.contactExists = hasUpdate; } /** @@ -600,10 +605,9 @@ public class ContactInfoCache implements OnImageLoadCompleteListener { mQueryId = 0; } - private ContactCacheEntry buildEntry( - Context context, CallerInfo info, int presentation, boolean isIncoming) { + private ContactCacheEntry buildEntry(Context context, CallerInfo info, int presentation) { final ContactCacheEntry cce = new ContactCacheEntry(); - populateCacheEntry(context, info, cce, presentation, isIncoming); + populateCacheEntry(context, info, cce, presentation); // This will only be true for emergency numbers if (info.photoResource != 0) { @@ -712,7 +716,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener { public Uri lookupUri; // Sent to NotificationMananger public String lookupKey; - public int contactLookupResult = ContactLookupResult.Type.NOT_FOUND; + public ContactLookupResult.Type contactLookupResult = ContactLookupResult.Type.NOT_FOUND; public long userType = ContactsUtils.USER_TYPE_CURRENT; Uri contactRingtoneUri; /** Query id to identify the query session. */ |