Do not look up a contact for special numbers.

Do not attempt to look up a contact for unknown, private, phonebox, and
voicemail numbers. Instead, use the raw number, which will then
correctly be formatted by the UI.

Bug: 5293193
Change-Id: I4315b56d19b802ad701bab806fd278a1e14c240c
diff --git a/src/com/android/contacts/calllog/CallLogAdapter.java b/src/com/android/contacts/calllog/CallLogAdapter.java
index 0dc5e35..226d23e 100644
--- a/src/com/android/contacts/calllog/CallLogAdapter.java
+++ b/src/com/android/contacts/calllog/CallLogAdapter.java
@@ -584,7 +584,13 @@
         ExpirableCache.CachedValue<ContactInfo> cachedInfo =
                 mContactInfoCache.getCachedValue(number);
         ContactInfo info = cachedInfo == null ? null : cachedInfo.getValue();
-        if (cachedInfo == null) {
+        if (!mPhoneNumberHelper.canPlaceCallsTo(number)
+                || mPhoneNumberHelper.isVoicemailNumber(number)) {
+            // If this is a number that cannot be dialed, there is no point in looking up a contact
+            // for it.
+            info = ContactInfo.EMPTY;
+            formattedNumber = null;
+        } else if (cachedInfo == null) {
             mContactInfoCache.put(number, ContactInfo.EMPTY);
             // Use the cached contact info from the call log.
             info = cachedContactInfo;