am 568a22f1: Fix potential mismatched caller information

* commit '568a22f1d76c83e02b3494a506c21663897d85bb':
  Fix potential mismatched caller information
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java
index 0cc5da1..d597218 100644
--- a/InCallUI/src/com/android/incallui/CallCardPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java
@@ -513,7 +513,15 @@
     }
 
     private void onContactInfoComplete(String callId, ContactCacheEntry entry, boolean isPrimary) {
-        updateContactEntry(entry, isPrimary);
+        final boolean entryMatchesExistingCall =
+                (isPrimary && mPrimary != null && TextUtils.equals(callId,  mPrimary.getId())) ||
+                (!isPrimary && mSecondary != null && TextUtils.equals(callId, mSecondary.getId()));
+        if (entryMatchesExistingCall) {
+            updateContactEntry(entry, isPrimary);
+        } else {
+            Log.w(this, "Dropping stale contact lookup info for " + callId);
+        }
+
         if (entry.name != null) {
             Log.d(TAG, "Contact found: " + entry);
         }