CallCard.java文件中
String number = info.phoneNumber;
if ((number != null) && number.startsWith("sip:")) {
number = number.substring(4);
}
/**
* Try to display the cached image from the callerinfo object.
*
* @return true if we were able to find the image in the cache, false otherwise.
*/
private static final boolean showCachedImage(ImageView view, CallerInfo ci) {
if ((ci != null) && ci.isCachedPhotoCurrent) {
if (ci.cachedPhoto != null) {
showImage(view, ci.cachedPhoto);
} else {
showImage(view, R.drawable.picture_unknown);
}
return true;
}
return false;
}
---------------------------------------------------------------------------------------------------------------------
设置会议图片:
private void displayOnHoldCallStatus(CallManager cm, Call call){
Call.State state = call.getState();
if (PhoneUtils.isConferenceCall(call)) {
if (DBG) log("==> conference call.");
mSecondaryCallName.setText(getContext().getString(R.string.confCall));
showImage(mSecondaryCallPhoto, R.drawable.picture_conference); //会议照片
}
}
-----------------------------------------------------------------------------------------------------------------
显示第二张图片:
PhoneUtils.CallerInfoToken infoToken = PhoneUtils.startGetCallerInfo(
getContext(), call, this, mSecondaryCallName);
mSecondaryCallName.setText(
PhoneUtils.getCompactNameFromCallerInfo(infoToken.currentInfo,
getContext()));
// Also pull the photo out of the current CallerInfo.
// (Note we assume we already have a valid photo at
// this point, since *presumably* the caller-id query
// was already run at some point *before* this call
// got put on hold. If there's no cached photo, just
// fall back to the default "unknown" image.)
if (infoToken.isFinal) {
showCachedImage(mSecondaryCallPhoto, infoToken.currentInfo);
} else {
showImage(mSecondaryCallPhoto, R.drawable.picture_unknown);
}
-----------------------------------------------------------------------------------------------------------------
if (TextUtils.isEmpty(info.name)) {
。。。。。。。。。
}else {
// We do have a valid "name" in the CallerInfo. Display that
// in the "name" slot, and the phone number in the "number" slot.
if (presentation != Connection.PRESENTATION_ALLOWED) {
// This case should never happen since the network should never send a name
// AND a restricted presentation. However we leave it here in case of weird
// network behavior
displayName = getPresentationString(presentation);
if (DBG) log(" ==> valid name, but presentation not allowed!"
+ " displayName = " + displayName);
} else {
displayName = info.name;
displayNumber = number;
label = info.phoneLabel;
if (DBG) log(" ==> name is present in CallerInfo: displayName '"
+ displayName + "', displayNumber '" + displayNumber + "'");
}
}
personUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, info.person_id);
if (DBG) log("- got personUri: '" + personUri
+ "', based on info.person_id: " + info.person_id);
} else {
displayName = getPresentationString(presentation);
}
if (call.isGeneric()) {
mName.setText(R.string.card_title_in_call);
} else {
mName.setText(displayName);
}
mName.setVisibility(View.VISIBLE);