From 7a863a056a96638c32171f721d99c694a1890df8 Mon Sep 17 00:00:00 2001 From: Christine Chen Date: Fri, 6 Sep 2013 17:49:24 -0700 Subject: Fixes bug where photo is only set to primary call. Bug: 10653476 Change-Id: Icc2e31215c6e3fa59266e3c6b1e3ac2935770e49 --- .../src/com/android/incallui/CallCardPresenter.java | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'InCallUI/src/com/android/incallui') diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java index ee587067f..94f787639 100644 --- a/InCallUI/src/com/android/incallui/CallCardPresenter.java +++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java @@ -118,7 +118,7 @@ public class CallCardPresenter extends Presenter @Override public void onStateChange(InCallState state, CallList callList) { - Log.d(TAG, "onStateChange() " + state); + Log.d(this, "onStateChange() " + state); final CallCardUi ui = getUi(); if (ui == null) { return; @@ -253,8 +253,7 @@ public class CallCardPresenter extends Presenter if (entry.label == null) { // Name not found. Try lookup. Log.d(TAG, "Contact lookup. Contact provider miss. Searching people api."); - lookupPhoneNumber(identification.getNumber(), - isPrimary, isConference); + lookupPhoneNumber(identification.getNumber(), isPrimary, isConference); } else { Log.d(TAG, "Contact lookup. Found in contact provider: " + entry); updateContactEntry(entry, isPrimary, isConference); @@ -263,12 +262,11 @@ public class CallCardPresenter extends Presenter @Override public void onImageLoadComplete(int callId, Bitmap photo) { - if (callId == mPrimary.getCallId()) { + if (mPrimary != null && callId == mPrimary.getCallId()) { getUi().setPrimaryImage(photo); - } else if (callId == mSecondary.getCallId()) { + } else if (mSecondary != null && callId == mSecondary.getCallId()) { getUi().setSecondaryImage(photo); } - } }); } else { @@ -409,7 +407,7 @@ public class CallCardPresenter extends Presenter updateContactEntry(entry, isPrimary, isConference); if (info.getImageUrl() != null) { - fetchImage(info.getImageUrl()); + fetchImage(info.getImageUrl(), isPrimary); } } }); @@ -457,13 +455,17 @@ public class CallCardPresenter extends Presenter !TextUtils.isEmpty(mPrimary.getGatewayPackage())); } - private void fetchImage(final String url) { + private void fetchImage(final String url, final boolean isPrimary) { if (url != null && mPhoneNumberService != null) { mPhoneNumberService.fetchImage(url, new PhoneNumberService.ImageLookupListener() { @Override public void onImageFetchComplete(Bitmap bitmap) { if (getUi() != null) { - getUi().setPrimaryImage(bitmap); + if (isPrimary) { + getUi().setPrimaryImage(bitmap); + } else { + getUi().setSecondaryImage(bitmap); + } } } }); -- cgit v1.2.3