From 568a22f1d76c83e02b3494a506c21663897d85bb Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Fri, 2 Oct 2015 14:54:16 -0700 Subject: Fix potential mismatched caller information This fixes a bug where caller information returned for a call waiting would be mistakenedly applied to an existing call by ensuring that the returned contact information is only assigned to the call that initiated the lookup. 1) Active call A is in progress 2) Incoming call B (call waiting) 3) Contact info lookup is initiated for call B 4) Call B is rejected 5) Contact info is returned 6) UI for call A is updated with the returned info Bug: 24591055 Change-Id: I41e0741d8bc01a2fe98d77cb080d1df455b1e5df --- src/com/android/incallui/CallCardPresenter.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/com/android/incallui/CallCardPresenter.java b/src/com/android/incallui/CallCardPresenter.java index 0cc5da1c..d5972182 100644 --- a/src/com/android/incallui/CallCardPresenter.java +++ b/src/com/android/incallui/CallCardPresenter.java @@ -513,7 +513,15 @@ public class CallCardPresenter extends Presenter } 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); } -- cgit v1.2.3