Program: 184905
Project: 184905
Buggy source:
private void onDisconnect(AsyncResult r){
  if (VDBG)   log("String_Node_Str" + mPhone.getState());
  if (mPhone.getState() == Phone.State.IDLE) {
    PhoneUtils.setAudioControlState(PhoneUtils.AUDIO_IDLE);
  }
  Connection c=(Connection)r.result;
  if (DBG && c != null) {
    log("String_Node_Str" + c.getDisconnectCause() + "String_Node_Str"+ c.isIncoming()+ "String_Node_Str"+ c.getCreateTime());
  }
  if (DBG)   log("String_Node_Str");
  mRinger.stopRing();
  int toneToPlay=InCallTonePlayer.TONE_NONE;
  if (c != null) {
    Connection.DisconnectCause cause=c.getDisconnectCause();
    if (cause == Connection.DisconnectCause.BUSY) {
      if (DBG)       log("String_Node_Str");
      toneToPlay=InCallTonePlayer.TONE_BUSY;
    }
 else     if (cause == Connection.DisconnectCause.CONGESTION) {
      if (DBG)       log("String_Node_Str");
      toneToPlay=InCallTonePlayer.TONE_CONGESTION;
    }
  }
  if ((toneToPlay == InCallTonePlayer.TONE_NONE) && (mPhone.getState() == Phone.State.IDLE) && (c != null)) {
    Connection.DisconnectCause cause=c.getDisconnectCause();
    if ((cause == Connection.DisconnectCause.NORMAL) || (cause == Connection.DisconnectCause.LOCAL)) {
      if (VDBG)       log("String_Node_Str");
      toneToPlay=InCallTonePlayer.TONE_CALL_ENDED;
    }
  }
  if (mPhone.getState() == Phone.State.IDLE) {
    if (toneToPlay == InCallTonePlayer.TONE_NONE) {
      resetAudioStateAfterDisconnect();
    }
    NotificationMgr.getDefault().cancelCallInProgressNotification();
    if (!mApplication.isShowingCallScreen()) {
      if (VDBG)       log("String_Node_Str");
      mApplication.dismissCallScreen();
    }
  }
  if (c != null) {
    final String number=c.getAddress();
    final int presentation=c.getNumberPresentation();
    final long date=c.getCreateTime();
    final long duration=c.getDurationMillis();
    final Connection.DisconnectCause cause=c.getDisconnectCause();
    final int callLogType;
    if (c.isIncoming()) {
      callLogType=(cause == Connection.DisconnectCause.INCOMING_MISSED ? CallLog.Calls.MISSED_TYPE : CallLog.Calls.INCOMING_TYPE);
    }
 else {
      callLogType=CallLog.Calls.OUTGOING_TYPE;
    }
    if (VDBG)     log("String_Node_Str" + callLogType + "String_Node_Str"+ c.getUserData());
{
      Object o=c.getUserData();
      final CallerInfo ci;
      if ((o == null) || (o instanceof CallerInfo)) {
        ci=(CallerInfo)o;
      }
 else {
        ci=((PhoneUtils.CallerInfoToken)o).currentInfo;
      }
      Thread t=new Thread(){
        public void run(){
          Calls.addCall(ci,mApplication,number,presentation,callLogType,date,(int)duration / 1000);
        }
      }
;
      t.start();
    }
    if (callLogType == CallLog.Calls.MISSED_TYPE) {
      PhoneUtils.CallerInfoToken info=PhoneUtils.startGetCallerInfo(mApplication,c,this,new Long(date));
      if (info != null) {
        if (VDBG)         log("String_Node_Str");
        if (info.isFinal) {
          CallerInfo ci=info.currentInfo;
          NotificationMgr.getDefault().notifyMissedCall(ci.name,ci.phoneNumber,ci.phoneLabel,date);
        }
      }
 else {
        Log.w(LOG_TAG,"String_Node_Str" + c);
      }
    }
    if (toneToPlay != InCallTonePlayer.TONE_NONE) {
      if (VDBG)       log("String_Node_Str" + toneToPlay + "String_Node_Str");
      new InCallTonePlayer(toneToPlay).start();
    }
    if (mPhone.getState() == Phone.State.IDLE) {
      if (!mApplication.isShowingCallScreen()) {
        if (VDBG)         log("String_Node_Str");
        mApplication.setScreenTimeout(PhoneApp.ScreenTimeoutDuration.DEFAULT);
        mApplication.requestWakeState(PhoneApp.WakeState.SLEEP);
      }
 else {
        if (VDBG)         log("String_Node_Str");
      }
    }
 else {
      if (VDBG)       log("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
private void onDisconnect(AsyncResult r){
  if (VDBG)   log("String_Node_Str" + mPhone.getState());
  if (mPhone.getState() == Phone.State.IDLE) {
    PhoneUtils.setAudioControlState(PhoneUtils.AUDIO_IDLE);
  }
  Connection c=(Connection)r.result;
  if (DBG && c != null) {
    log("String_Node_Str" + c.getDisconnectCause() + "String_Node_Str"+ c.isIncoming()+ "String_Node_Str"+ c.getCreateTime());
  }
  if (DBG)   log("String_Node_Str");
  mRinger.stopRing();
  int toneToPlay=InCallTonePlayer.TONE_NONE;
  if (c != null) {
    Connection.DisconnectCause cause=c.getDisconnectCause();
    if (cause == Connection.DisconnectCause.BUSY) {
      if (DBG)       log("String_Node_Str");
      toneToPlay=InCallTonePlayer.TONE_BUSY;
    }
 else     if (cause == Connection.DisconnectCause.CONGESTION) {
      if (DBG)       log("String_Node_Str");
      toneToPlay=InCallTonePlayer.TONE_CONGESTION;
    }
  }
  if ((toneToPlay == InCallTonePlayer.TONE_NONE) && (mPhone.getState() == Phone.State.IDLE) && (c != null)) {
    Connection.DisconnectCause cause=c.getDisconnectCause();
    if ((cause == Connection.DisconnectCause.NORMAL) || (cause == Connection.DisconnectCause.LOCAL)) {
      if (VDBG)       log("String_Node_Str");
      toneToPlay=InCallTonePlayer.TONE_CALL_ENDED;
    }
  }
  if (mPhone.getState() == Phone.State.IDLE) {
    if (toneToPlay == InCallTonePlayer.TONE_NONE) {
      resetAudioStateAfterDisconnect();
    }
    NotificationMgr.getDefault().cancelCallInProgressNotification();
    if (!mApplication.isShowingCallScreen()) {
      if (VDBG)       log("String_Node_Str");
      mApplication.dismissCallScreen();
    }
  }
  if (c != null) {
    final String number=c.getAddress();
    final int presentation=c.getNumberPresentation();
    final long date=c.getCreateTime();
    final long duration=c.getDurationMillis();
    final Connection.DisconnectCause cause=c.getDisconnectCause();
    final int callLogType;
    if (c.isIncoming()) {
      callLogType=(cause == Connection.DisconnectCause.INCOMING_MISSED ? CallLog.Calls.MISSED_TYPE : CallLog.Calls.INCOMING_TYPE);
    }
 else {
      callLogType=CallLog.Calls.OUTGOING_TYPE;
    }
    if (VDBG)     log("String_Node_Str" + callLogType + "String_Node_Str"+ c.getUserData());
{
      Object o=c.getUserData();
      final CallerInfo ci;
      if ((o == null) || (o instanceof CallerInfo)) {
        ci=(CallerInfo)o;
      }
 else {
        ci=((PhoneUtils.CallerInfoToken)o).currentInfo;
      }
      Thread t=new Thread(){
        public void run(){
          Calls.addCall(ci,mApplication,number,presentation,callLogType,date,(int)duration / 1000);
        }
      }
;
      t.start();
    }
    if (callLogType == CallLog.Calls.MISSED_TYPE) {
      PhoneUtils.CallerInfoToken info=PhoneUtils.startGetCallerInfo(mApplication,c,this,Long.valueOf(date));
      if (info != null) {
        if (VDBG)         log("String_Node_Str");
        if (info.isFinal) {
          CallerInfo ci=info.currentInfo;
          NotificationMgr.getDefault().notifyMissedCall(ci.name,ci.phoneNumber,ci.phoneLabel,date);
        }
      }
 else {
        Log.w(LOG_TAG,"String_Node_Str" + c);
      }
    }
    if (toneToPlay != InCallTonePlayer.TONE_NONE) {
      if (VDBG)       log("String_Node_Str" + toneToPlay + "String_Node_Str");
      new InCallTonePlayer(toneToPlay).start();
    }
    if (mPhone.getState() == Phone.State.IDLE) {
      if (!mApplication.isShowingCallScreen()) {
        if (VDBG)         log("String_Node_Str");
        mApplication.setScreenTimeout(PhoneApp.ScreenTimeoutDuration.DEFAULT);
        mApplication.requestWakeState(PhoneApp.WakeState.SLEEP);
      }
 else {
        if (VDBG)         log("String_Node_Str");
      }
    }
 else {
      if (VDBG)       log("String_Node_Str");
    }
  }
}