summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/app/contactinfo/ContactInfoCache.java
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-05-05 15:29:54 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-05-05 15:29:54 +0000
commit43b3152d075138b11e1fe297682b3bbc775e5641 (patch)
tree3a325b0effac02fbd228b8ddf2f96589e5df72cd /java/com/android/dialer/app/contactinfo/ContactInfoCache.java
parent2034759538273aed8a0b412d8fb90994eba1f7ea (diff)
parent300a8683b9c28424fb0f0c571a0abe128c461f69 (diff)
Update Dialer to V10 RC16 am: 10b34a5ebf
am: 300a8683b9 Change-Id: If5695bad59f8a4dab6e6c90b54943b900bd2652a
Diffstat (limited to 'java/com/android/dialer/app/contactinfo/ContactInfoCache.java')
-rw-r--r--java/com/android/dialer/app/contactinfo/ContactInfoCache.java22
1 files changed, 15 insertions, 7 deletions
diff --git a/java/com/android/dialer/app/contactinfo/ContactInfoCache.java b/java/com/android/dialer/app/contactinfo/ContactInfoCache.java
index 7a5db19f2..e561b5607 100644
--- a/java/com/android/dialer/app/contactinfo/ContactInfoCache.java
+++ b/java/com/android/dialer/app/contactinfo/ContactInfoCache.java
@@ -28,6 +28,7 @@ import com.android.dialer.phonenumbercache.ContactInfo;
import com.android.dialer.phonenumbercache.ContactInfoHelper;
import com.android.dialer.util.ExpirableCache;
import java.lang.ref.WeakReference;
+import java.util.Objects;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.PriorityBlockingQueue;
@@ -77,6 +78,8 @@ public class ContactInfoCache {
break;
case START_THREAD:
reference.startRequestProcessing();
+ break;
+ default: // fall out
}
}
}
@@ -125,7 +128,7 @@ public class ContactInfoCache {
enqueueRequest(number, countryIso, callLogContactInfo, /* immediate */ false, requestType);
}
- if (info == ContactInfo.EMPTY) {
+ if (Objects.equals(info, ContactInfo.EMPTY)) {
// Use the cached contact info from the call log.
info = callLogContactInfo;
}
@@ -153,11 +156,15 @@ public class ContactInfoCache {
ContactInfo info;
if (request.isLocalRequest()) {
info = mContactInfoHelper.lookupNumber(request.number, request.countryIso);
- // TODO: Maybe skip look up if it's already available in cached number lookup service.
- long start = SystemClock.elapsedRealtime();
- mContactInfoHelper.updateFromCequintCallerId(info, request.number);
- long time = SystemClock.elapsedRealtime() - start;
- LogUtil.d("ContactInfoCache.queryContactInfo", "Cequint Caller Id look up takes %d ms", time);
+ if (!info.contactExists) {
+ // TODO: Maybe skip look up if it's already available in cached number lookup
+ // service.
+ long start = SystemClock.elapsedRealtime();
+ mContactInfoHelper.updateFromCequintCallerId(info, request.number);
+ long time = SystemClock.elapsedRealtime() - start;
+ LogUtil.d(
+ "ContactInfoCache.queryContactInfo", "Cequint Caller Id look up takes %d ms", time);
+ }
if (request.type == ContactInfoRequest.TYPE_LOCAL_AND_REMOTE) {
if (!mContactInfoHelper.hasName(info)) {
enqueueRequest(
@@ -192,7 +199,8 @@ public class ContactInfoCache {
// Exception: Photo uris for contacts from remote sources are not cached in the call log
// cache, so we have to force a redraw for these contacts regardless.
boolean updated =
- (existingInfo != ContactInfo.EMPTY || isRemoteSource) && !info.equals(existingInfo);
+ (!Objects.equals(existingInfo, ContactInfo.EMPTY) || isRemoteSource)
+ && !info.equals(existingInfo);
// Store the data in the cache so that the UI thread can use to display it. Store it
// even if it has not changed so that it is marked as not expired.