diff options
author | Santos Cordon <santoscordon@google.com> | 2014-10-10 22:53:19 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-10-10 22:53:19 +0000 |
commit | bdc91923fc72579fd9fad79b581c7ceb1cba7534 (patch) | |
tree | 37978b6232a6c35dd586d00a6b951f0f4b3555b3 /InCallUI | |
parent | baf37756268a62a7dab108971d26513725ec1968 (diff) | |
parent | e6b3f45a870e87da4ceedc512751a5da43968036 (diff) |
am 174f5360: am 187e6ffe: Dont overwrite cnap name with a failed local lookup.
* commit '174f53604041b67e80e7c33c45f51791ac8b5222':
Dont overwrite cnap name with a failed local lookup.
Diffstat (limited to 'InCallUI')
-rw-r--r-- | InCallUI/src/com/android/incallui/ContactInfoCache.java | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/InCallUI/src/com/android/incallui/ContactInfoCache.java b/InCallUI/src/com/android/incallui/ContactInfoCache.java index 4623c3b0f..bf67a6702 100644 --- a/InCallUI/src/com/android/incallui/ContactInfoCache.java +++ b/InCallUI/src/com/android/incallui/ContactInfoCache.java @@ -156,16 +156,24 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete presentationMode = TelecomManager.PRESENTATION_ALLOWED; } - final ContactCacheEntry cacheEntry = buildEntry(mContext, callId, - callerInfo, presentationMode, isIncoming); + ContactCacheEntry cacheEntry = mInfoMap.get(callId); + // Rebuild the entry from the new data if: + // 1) This is NOT the asynchronous local lookup (IOW, this is the first pass) + // 2) The local lookup was done and the contact exists + // 3) The existing cached entry is empty (no name). + if (!didLocalLookup || callerInfo.contactExists || + (cacheEntry != null && TextUtils.isEmpty(cacheEntry.name))) { + cacheEntry = buildEntry(mContext, callId, callerInfo, presentationMode, isIncoming); + mInfoMap.put(callId, cacheEntry); + } - // Add the contact info to the cache. - mInfoMap.put(callId, cacheEntry); sendInfoNotifications(callId, cacheEntry); if (didLocalLookup) { - if (!callerInfo.contactExists && cacheEntry.name == null && - mPhoneNumberService != null) { + // Before issuing a request for more data from other services, We only check that the + // contact wasn't found in the local DB. We don't check the if the cache entry already + // has a name because we allow overriding cnap data with data from other services. + if (!callerInfo.contactExists && mPhoneNumberService != null) { Log.d(TAG, "Contact lookup. Local contacts miss, checking remote"); final PhoneNumberServiceListener listener = new PhoneNumberServiceListener(callId); mPhoneNumberService.getPhoneNumberInfo(cacheEntry.number, listener, listener, @@ -179,8 +187,6 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete } else { if (callerInfo.contactExists) { Log.d(TAG, "Contact lookup done. Local contact found, no image."); - } else if (cacheEntry.name != null) { - Log.d(TAG, "Contact lookup done. Special contact type."); } else { Log.d(TAG, "Contact lookup done. Local contact not found and" + " no remote lookup service available."); |