From 773ae90fbe87a14dd1c48ac0f769f5878c53a693 Mon Sep 17 00:00:00 2001 From: Makoto Onuki Date: Thu, 10 Jul 2014 14:05:35 -0700 Subject: Enterprise caller-id: Now CP2 returns contact-id for corp contacts. Ignore them. This follows change I21ab20ad4147b303cd0d49d33b64a38275342dc5. Bug 15779911 Change-Id: Id0256cc740bb7a4d6c2d1515bde2c9f97c30863a --- InCallUI/src/com/android/incallui/CallerInfo.java | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/InCallUI/src/com/android/incallui/CallerInfo.java b/InCallUI/src/com/android/incallui/CallerInfo.java index a5ab07c64..2029ca6f5 100644 --- a/InCallUI/src/com/android/incallui/CallerInfo.java +++ b/InCallUI/src/com/android/incallui/CallerInfo.java @@ -24,6 +24,7 @@ import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import android.net.Uri; import android.provider.ContactsContract.CommonDataKinds.Phone; +import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Data; import android.provider.ContactsContract.PhoneLookup; import android.provider.ContactsContract.RawContacts; @@ -212,17 +213,20 @@ public class CallerInfo { // Look for the person_id. columnIndex = getColumnIndexForPersonId(contactRef, cursor); if (columnIndex != -1) { - info.contactIdOrZero = cursor.getLong(columnIndex); - Log.v(TAG, "==> got info.contactIdOrZero: " + info.contactIdOrZero); - - // cache the lookup key for later use with person_id to create lookup URIs - columnIndex = cursor.getColumnIndex(PhoneLookup.LOOKUP_KEY); - if (columnIndex != -1) { - info.lookupKeyOrNull = cursor.getString(columnIndex); + final long contactId = cursor.getLong(columnIndex); + if (contactId != 0 && !Contacts.isCorpContactId(contactId)) { + info.contactIdOrZero = contactId; + Log.v(TAG, "==> got info.contactIdOrZero: " + info.contactIdOrZero); + + // cache the lookup key for later use with person_id to create lookup URIs + columnIndex = cursor.getColumnIndex(PhoneLookup.LOOKUP_KEY); + if (columnIndex != -1) { + info.lookupKeyOrNull = cursor.getString(columnIndex); + } } } else { // No valid columnIndex, so we can't look up person_id. - Log.v(TAG, "Couldn't find person_id column for " + contactRef); + Log.v(TAG, "Couldn't find contactId column for " + contactRef); // Watch out: this means that anything that depends on // person_id will be broken (like contact photo lookups in // the in-call UI, for example.) -- cgit v1.2.3