Program: 184868
Project: 184868
Buggy source:
/** 
 * Updates the main block of caller info on the CallCard (ie. the stuff in the mainCallCard block) based on the specified Call.
 */
private void displayMainCallStatus(Phone phone,Call call){
  if (DBG)   log("String_Node_Str" + phone + "String_Node_Str"+ call+ "String_Node_Str");
  if (call == null) {
    mMainCallCard.setVisibility(View.GONE);
    return;
  }
  mMainCallCard.setVisibility(View.VISIBLE);
  Call.State state=call.getState();
  if (DBG)   log("String_Node_Str" + call.getState());
  int callCardBackgroundResid=0;
  boolean landscapeMode=InCallScreen.ConfigurationHelper.isLandscape();
  final boolean bluetoothActive=mApplication.showBluetoothIndication();
switch (state) {
case ACTIVE:
    if (bluetoothActive) {
      callCardBackgroundResid=landscapeMode ? R.drawable.incall_frame_bluetooth_tall_land : R.drawable.incall_frame_bluetooth_tall_port;
    }
 else {
      callCardBackgroundResid=landscapeMode ? R.drawable.incall_frame_connected_tall_land : R.drawable.incall_frame_connected_tall_port;
    }
  if (DBG)   log("String_Node_Str");
mCallTime.setActiveCallMode(call);
mCallTime.reset();
mCallTime.periodicUpdateTimer();
break;
case HOLDING:
callCardBackgroundResid=landscapeMode ? R.drawable.incall_frame_hold_tall_land : R.drawable.incall_frame_hold_tall_port;
mCallTime.cancelTimer();
break;
case DISCONNECTED:
callCardBackgroundResid=landscapeMode ? R.drawable.incall_frame_ended_tall_land : R.drawable.incall_frame_ended_tall_port;
mCallTime.cancelTimer();
break;
case DIALING:
case ALERTING:
if (bluetoothActive) {
callCardBackgroundResid=landscapeMode ? R.drawable.incall_frame_bluetooth_tall_land : R.drawable.incall_frame_bluetooth_tall_port;
}
 else {
callCardBackgroundResid=landscapeMode ? R.drawable.incall_frame_normal_tall_land : R.drawable.incall_frame_normal_tall_port;
}
mCallTime.cancelTimer();
break;
case INCOMING:
case WAITING:
if (bluetoothActive) {
callCardBackgroundResid=landscapeMode ? R.drawable.incall_frame_bluetooth_tall_land : R.drawable.incall_frame_bluetooth_tall_port;
}
 else {
callCardBackgroundResid=landscapeMode ? R.drawable.incall_frame_normal_tall_land : R.drawable.incall_frame_normal_tall_port;
}
mCallTime.cancelTimer();
break;
case IDLE:
Log.w(LOG_TAG,"String_Node_Str");
break;
default :
Log.w(LOG_TAG,"String_Node_Str" + state);
break;
}
setMainCallCardBackgroundResource(callCardBackgroundResid);
updateCardTitleWidgets(phone,call);
if (PhoneUtils.isConferenceCall(call)) {
updateDisplayForConference();
}
 else {
Connection conn=null;
if (phone.getPhoneName().equals("String_Node_Str")) {
conn=call.getLatestConnection();
}
 else {
conn=call.getEarliestConnection();
}
if (conn == null) {
if (DBG) log("String_Node_Str");
CallerInfo info=PhoneUtils.getCallerInfo(getContext(),null);
updateDisplayForPerson(info,Connection.PRESENTATION_ALLOWED,false,call);
}
 else {
if (DBG) log("String_Node_Str" + conn + "String_Node_Str"+ conn.getState());
int presentation=conn.getNumberPresentation();
boolean runQuery=true;
Object o=conn.getUserData();
if (o instanceof PhoneUtils.CallerInfoToken) {
runQuery=mPhotoTracker.isDifferentImageRequest(((PhoneUtils.CallerInfoToken)o).currentInfo);
}
 else {
runQuery=mPhotoTracker.isDifferentImageRequest(conn);
}
if (runQuery) {
if (DBG) log("String_Node_Str");
PhoneUtils.CallerInfoToken info=PhoneUtils.startGetCallerInfo(getContext(),conn,this,call);
updateDisplayForPerson(info.currentInfo,presentation,!info.isFinal,call);
}
 else {
if (DBG) log("String_Node_Str");
if (o instanceof CallerInfo) {
CallerInfo ci=(CallerInfo)o;
ci.cnapName=conn.getCnapName();
ci.numberPresentation=conn.getNumberPresentation();
ci.namePresentation=conn.getCnapNamePresentation();
if (DBG) log("String_Node_Str" + "String_Node_Str" + ci.cnapName + "String_Node_Str"+ ci.numberPresentation);
if (DBG) log("String_Node_Str" + ci);
updateDisplayForPerson(ci,presentation,false,call);
}
 else if (o instanceof PhoneUtils.CallerInfoToken) {
CallerInfo ci=((PhoneUtils.CallerInfoToken)o).currentInfo;
if (DBG) log("String_Node_Str" + "String_Node_Str" + ci.cnapName + "String_Node_Str"+ ci.numberPresentation);
if (DBG) log("String_Node_Str" + ci);
updateDisplayForPerson(ci,presentation,true,call);
}
 else {
Log.w(LOG_TAG,"String_Node_Str" + "String_Node_Str" + o);
}
}
}
}
updatePhotoForCallState(call);
}

Fixed version (ground truth):
/** 
 * Updates the main block of caller info on the CallCard (ie. the stuff in the mainCallCard block) based on the specified Call.
 */
private void displayMainCallStatus(Phone phone,Call call){
  if (DBG)   log("String_Node_Str" + phone + "String_Node_Str"+ call+ "String_Node_Str");
  if (call == null) {
    mMainCallCard.setVisibility(View.GONE);
    return;
  }
  mMainCallCard.setVisibility(View.VISIBLE);
  Call.State state=call.getState();
  if (DBG)   log("String_Node_Str" + call.getState());
  int callCardBackgroundResid=0;
  boolean landscapeMode=InCallScreen.ConfigurationHelper.isLandscape();
  final boolean bluetoothActive=mApplication.showBluetoothIndication();
switch (state) {
case ACTIVE:
    if (bluetoothActive) {
      callCardBackgroundResid=landscapeMode ? R.drawable.incall_frame_bluetooth_tall_land : R.drawable.incall_frame_bluetooth_tall_port;
    }
 else {
      callCardBackgroundResid=landscapeMode ? R.drawable.incall_frame_connected_tall_land : R.drawable.incall_frame_connected_tall_port;
    }
  if (DBG)   log("String_Node_Str");
mCallTime.setActiveCallMode(call);
mCallTime.reset();
mCallTime.periodicUpdateTimer();
break;
case HOLDING:
callCardBackgroundResid=landscapeMode ? R.drawable.incall_frame_hold_tall_land : R.drawable.incall_frame_hold_tall_port;
mCallTime.cancelTimer();
break;
case DISCONNECTED:
callCardBackgroundResid=landscapeMode ? R.drawable.incall_frame_ended_tall_land : R.drawable.incall_frame_ended_tall_port;
mCallTime.cancelTimer();
break;
case DIALING:
case ALERTING:
if (bluetoothActive) {
callCardBackgroundResid=landscapeMode ? R.drawable.incall_frame_bluetooth_tall_land : R.drawable.incall_frame_bluetooth_tall_port;
}
 else {
callCardBackgroundResid=landscapeMode ? R.drawable.incall_frame_normal_tall_land : R.drawable.incall_frame_normal_tall_port;
}
mCallTime.cancelTimer();
break;
case INCOMING:
case WAITING:
if (bluetoothActive) {
callCardBackgroundResid=landscapeMode ? R.drawable.incall_frame_bluetooth_tall_land : R.drawable.incall_frame_bluetooth_tall_port;
}
 else {
callCardBackgroundResid=landscapeMode ? R.drawable.incall_frame_normal_tall_land : R.drawable.incall_frame_normal_tall_port;
}
mCallTime.cancelTimer();
break;
case IDLE:
Log.w(LOG_TAG,"String_Node_Str");
break;
default :
Log.w(LOG_TAG,"String_Node_Str" + state);
break;
}
setMainCallCardBackgroundResource(callCardBackgroundResid);
updateCardTitleWidgets(phone,call);
if (PhoneUtils.isConferenceCall(call)) {
updateDisplayForConference();
}
 else {
Connection conn=null;
if (phone.getPhoneName().equals("String_Node_Str")) {
conn=call.getLatestConnection();
}
 else {
conn=call.getEarliestConnection();
}
if (conn == null) {
if (DBG) log("String_Node_Str");
CallerInfo info=PhoneUtils.getCallerInfo(getContext(),null);
updateDisplayForPerson(info,Connection.PRESENTATION_ALLOWED,false,call);
}
 else {
if (DBG) log("String_Node_Str" + conn + "String_Node_Str"+ conn.getState());
int presentation=conn.getNumberPresentation();
boolean runQuery=true;
Object o=conn.getUserData();
if (o instanceof PhoneUtils.CallerInfoToken) {
runQuery=mPhotoTracker.isDifferentImageRequest(((PhoneUtils.CallerInfoToken)o).currentInfo);
}
 else {
runQuery=mPhotoTracker.isDifferentImageRequest(conn);
}
if (phone.getPhoneName().equals("String_Node_Str")) {
Object obj=conn.getUserData();
String updatedNumber=conn.getAddress();
String updatedCnapName=conn.getCnapName();
CallerInfo info=null;
if (obj instanceof PhoneUtils.CallerInfoToken) {
info=((PhoneUtils.CallerInfoToken)o).currentInfo;
}
 else if (o instanceof CallerInfo) {
info=(CallerInfo)o;
}
if (info != null) {
if (updatedNumber != null && !updatedNumber.equals(info.phoneNumber)) {
if (DBG) log("String_Node_Str" + updatedNumber);
runQuery=true;
}
if (updatedCnapName != null && !updatedCnapName.equals(info.cnapName)) {
if (DBG) log("String_Node_Str" + updatedCnapName);
runQuery=true;
}
}
}
if (runQuery) {
if (DBG) log("String_Node_Str");
PhoneUtils.CallerInfoToken info=PhoneUtils.startGetCallerInfo(getContext(),conn,this,call);
updateDisplayForPerson(info.currentInfo,presentation,!info.isFinal,call);
}
 else {
if (DBG) log("String_Node_Str");
if (o instanceof CallerInfo) {
CallerInfo ci=(CallerInfo)o;
ci.cnapName=conn.getCnapName();
ci.numberPresentation=conn.getNumberPresentation();
ci.namePresentation=conn.getCnapNamePresentation();
if (DBG) log("String_Node_Str" + "String_Node_Str" + ci.cnapName + "String_Node_Str"+ ci.numberPresentation);
if (DBG) log("String_Node_Str" + ci);
updateDisplayForPerson(ci,presentation,false,call);
}
 else if (o instanceof PhoneUtils.CallerInfoToken) {
CallerInfo ci=((PhoneUtils.CallerInfoToken)o).currentInfo;
if (DBG) log("String_Node_Str" + "String_Node_Str" + ci.cnapName + "String_Node_Str"+ ci.numberPresentation);
if (DBG) log("String_Node_Str" + ci);
updateDisplayForPerson(ci,presentation,true,call);
}
 else {
Log.w(LOG_TAG,"String_Node_Str" + "String_Node_Str" + o);
}
}
}
}
updatePhotoForCallState(call);
}