Program: 184858
Project: 184858
Buggy source:
private void onDisconnect(AsyncResult r){
  if (VDBG)   log("String_Node_Str" + mPhone.getState());
  mCdmaVoicePrivacyState=false;
  int autoretrySetting=0;
  if (mPhone.getPhoneName().equals("String_Node_Str")) {
    autoretrySetting=android.provider.Settings.System.getInt(mPhone.getContext().getContentResolver(),android.provider.Settings.System.CALL_AUTO_RETRY,0);
  }
  if (mPhone.getState() == Phone.State.IDLE) {
    PhoneUtils.setAudioControlState(PhoneUtils.AUDIO_IDLE);
  }
  if (mPhone.getPhoneName().equals("String_Node_Str")) {
    stopSignalInfoTone();
  }
  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;
    }
 else     if (((cause == Connection.DisconnectCause.NORMAL) || (cause == Connection.DisconnectCause.LOCAL)) && (mApplication.isOtaCallInActiveState())) {
      if (DBG)       log("String_Node_Str");
      toneToPlay=InCallTonePlayer.TONE_OTA_CALL_END;
    }
 else     if (cause == Connection.DisconnectCause.CDMA_REORDER) {
      if (DBG)       log("String_Node_Str");
      toneToPlay=InCallTonePlayer.TONE_REORDER;
    }
 else     if (cause == Connection.DisconnectCause.CDMA_INTERCEPT) {
      if (DBG)       log("String_Node_Str");
      toneToPlay=InCallTonePlayer.TONE_INTERCEPT;
    }
 else     if (cause == Connection.DisconnectCause.CDMA_DROP) {
      if (DBG)       log("String_Node_Str");
      toneToPlay=InCallTonePlayer.TONE_CDMA_DROP;
    }
 else     if (cause == Connection.DisconnectCause.OUT_OF_SERVICE) {
      if (DBG)       log("String_Node_Str");
      toneToPlay=InCallTonePlayer.TONE_OUT_OF_SERVICE;
    }
 else     if (cause == Connection.DisconnectCause.ERROR_UNSPECIFIED) {
      if (DBG)       log("String_Node_Str");
      toneToPlay=InCallTonePlayer.TONE_CALL_ENDED;
    }
  }
  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;
      mIsCdmaRedialCall=false;
    }
  }
  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();
    if (DBG)     log("String_Node_Str" + presentation);
    final long date=c.getCreateTime();
    final long duration=c.getDurationMillis();
    final Connection.DisconnectCause cause=c.getDisconnectCause();
    final String cdmaLogNumber=c.isIncoming() ? number : c.getOrigDialString();
    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;
      }
      final String eNumber=c.getAddress();
      if (mPhone.getPhoneName().equals("String_Node_Str")) {
        if ((PhoneNumberUtils.isEmergencyNumber(eNumber)) && (mCurrentEmergencyToneState != EMERGENCY_TONE_OFF)) {
          if (mEmergencyTonePlayerVibrator != null) {
            mEmergencyTonePlayerVibrator.stop();
          }
        }
      }
      Thread t=new Thread(){
        public void run(){
          if (mPhone.getPhoneName().equals("String_Node_Str")) {
            if (!mApplication.isOtaCallInActiveState() && !PhoneNumberUtils.isEmergencyNumber(eNumber)) {
              Calls.addCall(ci,mApplication,number,presentation,callLogType,date,(int)duration / 1000);
            }
          }
 else {
            Calls.addCall(ci,mApplication,number,presentation,callLogType,date,(int)duration / 1000);
          }
        }
      }
;
      t.start();
    }
    if (callLogType == CallLog.Calls.MISSED_TYPE) {
      showMissedCallNotification(c,date);
    }
    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");
    }
    if (((mPreviousCdmaCallState == Call.State.DIALING) || (mPreviousCdmaCallState == Call.State.ALERTING)) && (!PhoneNumberUtils.isEmergencyNumber(number)) && (cause != Connection.DisconnectCause.INCOMING_MISSED)&& (cause != Connection.DisconnectCause.NORMAL)&& (cause != Connection.DisconnectCause.LOCAL)&& (cause != Connection.DisconnectCause.INCOMING_REJECTED)) {
      if (!mIsCdmaRedialCall) {
        if (autoretrySetting == InCallScreen.AUTO_RETRY_ON) {
          PhoneUtils.placeCall(mPhone,number,null);
          mIsCdmaRedialCall=true;
        }
 else {
          mIsCdmaRedialCall=false;
        }
      }
 else {
        mIsCdmaRedialCall=false;
      }
    }
  }
  if (mPhone.getPhoneName().equals("String_Node_Str")) {
    mApplication.cdmaPhoneCallState.resetCdmaPhoneCallState();
    removeMessages(CALLWAITING_CALLERINFO_DISPLAY_DONE);
    removeMessages(CALLWAITING_ADDCALL_DISABLE_TIMEOUT);
  }
}

Fixed version (ground truth):
private void onDisconnect(AsyncResult r){
  if (VDBG)   log("String_Node_Str" + mPhone.getState());
  mCdmaVoicePrivacyState=false;
  int autoretrySetting=0;
  if (mPhone.getPhoneName().equals("String_Node_Str")) {
    autoretrySetting=android.provider.Settings.System.getInt(mPhone.getContext().getContentResolver(),android.provider.Settings.System.CALL_AUTO_RETRY,0);
  }
  if (mPhone.getState() == Phone.State.IDLE) {
    PhoneUtils.setAudioControlState(PhoneUtils.AUDIO_IDLE);
  }
  if (mPhone.getPhoneName().equals("String_Node_Str")) {
    stopSignalInfoTone();
  }
  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;
    }
 else     if (((cause == Connection.DisconnectCause.NORMAL) || (cause == Connection.DisconnectCause.LOCAL)) && (mApplication.isOtaCallInActiveState())) {
      if (DBG)       log("String_Node_Str");
      toneToPlay=InCallTonePlayer.TONE_OTA_CALL_END;
    }
 else     if (cause == Connection.DisconnectCause.CDMA_REORDER) {
      if (DBG)       log("String_Node_Str");
      toneToPlay=InCallTonePlayer.TONE_REORDER;
    }
 else     if (cause == Connection.DisconnectCause.CDMA_INTERCEPT) {
      if (DBG)       log("String_Node_Str");
      toneToPlay=InCallTonePlayer.TONE_INTERCEPT;
    }
 else     if (cause == Connection.DisconnectCause.CDMA_DROP) {
      if (DBG)       log("String_Node_Str");
      toneToPlay=InCallTonePlayer.TONE_CDMA_DROP;
    }
 else     if (cause == Connection.DisconnectCause.OUT_OF_SERVICE) {
      if (DBG)       log("String_Node_Str");
      toneToPlay=InCallTonePlayer.TONE_OUT_OF_SERVICE;
    }
 else     if (cause == Connection.DisconnectCause.ERROR_UNSPECIFIED) {
      if (DBG)       log("String_Node_Str");
      toneToPlay=InCallTonePlayer.TONE_CALL_ENDED;
    }
  }
  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;
      mIsCdmaRedialCall=false;
    }
  }
  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();
    if (DBG)     log("String_Node_Str" + presentation);
    final long date=c.getCreateTime();
    final long duration=c.getDurationMillis();
    final Connection.DisconnectCause cause=c.getDisconnectCause();
    final String cdmaLogNumber=c.isIncoming() ? number : c.getOrigDialString();
    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;
      }
      final String eNumber=c.getAddress();
      if (mPhone.getPhoneName().equals("String_Node_Str")) {
        if ((PhoneNumberUtils.isEmergencyNumber(eNumber)) && (mCurrentEmergencyToneState != EMERGENCY_TONE_OFF)) {
          if (mEmergencyTonePlayerVibrator != null) {
            mEmergencyTonePlayerVibrator.stop();
          }
        }
      }
      Thread t=new Thread(){
        public void run(){
          if (mPhone.getPhoneName().equals("String_Node_Str")) {
            if (!mPhone.isOtaSpNumber(eNumber) && !PhoneNumberUtils.isEmergencyNumber(eNumber)) {
              Calls.addCall(ci,mApplication,number,presentation,callLogType,date,(int)duration / 1000);
            }
          }
 else {
            Calls.addCall(ci,mApplication,number,presentation,callLogType,date,(int)duration / 1000);
          }
        }
      }
;
      t.start();
    }
    if (callLogType == CallLog.Calls.MISSED_TYPE) {
      showMissedCallNotification(c,date);
    }
    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");
    }
    if (((mPreviousCdmaCallState == Call.State.DIALING) || (mPreviousCdmaCallState == Call.State.ALERTING)) && (!PhoneNumberUtils.isEmergencyNumber(number)) && (cause != Connection.DisconnectCause.INCOMING_MISSED)&& (cause != Connection.DisconnectCause.NORMAL)&& (cause != Connection.DisconnectCause.LOCAL)&& (cause != Connection.DisconnectCause.INCOMING_REJECTED)) {
      if (!mIsCdmaRedialCall) {
        if (autoretrySetting == InCallScreen.AUTO_RETRY_ON) {
          PhoneUtils.placeCall(mPhone,number,null);
          mIsCdmaRedialCall=true;
        }
 else {
          mIsCdmaRedialCall=false;
        }
      }
 else {
        mIsCdmaRedialCall=false;
      }
    }
  }
  if (mPhone.getPhoneName().equals("String_Node_Str")) {
    mApplication.cdmaPhoneCallState.resetCdmaPhoneCallState();
    removeMessages(CALLWAITING_CALLERINFO_DISPLAY_DONE);
    removeMessages(CALLWAITING_ADDCALL_DISABLE_TIMEOUT);
  }
}