nus-yam/ex-repair huggingface dataset:
Program: 184779
Project: 184779
Buggy source:
/** 
 * Resets the audio mode and speaker state when a call ends.
 */
private void resetAudioStateAfterDisconnect(){
  if (VDBG)   log("String_Node_Str");
  if (mBluetoothHandsfree != null) {
    mBluetoothHandsfree.audioOff();
  }
  if (PhoneUtils.isSpeakerOn(mPhone.getContext())) {
    PhoneUtils.turnOnSpeaker(mPhone.getContext(),false,true);
  }
  PhoneUtils.setAudioMode(mPhone.getContext(),AudioManager.MODE_NORMAL);
}

Fixed version (ground truth):
/** 
 * Resets the audio mode and speaker state when a call ends.
 */
private void resetAudioStateAfterDisconnect(){
  if (VDBG)   log("String_Node_Str");
  if (mBluetoothHandsfree != null) {
    mBluetoothHandsfree.audioOff();
  }
  PhoneUtils.turnOnSpeaker(mPhone.getContext(),false,true);
  PhoneUtils.setAudioMode(mPhone.getContext(),AudioManager.MODE_NORMAL);
}
Program: 184780
Project: 184780
Buggy source:
/** 
 * Show "Programming In Progress" screen during OTA call. Shown when OTA provisioning is in progress after user has selected an option.
 */
private void otaShowInProgressScreen(){
  if (DBG)   log("String_Node_Str");
  if (!isDialerOpened()) {
    otaScreenInitialize();
    mOtaWidgetData.otaTextListenProgress.setVisibility(View.VISIBLE);
    mOtaWidgetData.otaTextListenProgress.setText(R.string.ota_progress);
    mOtaWidgetData.otaTextProgressBar.setVisibility(View.VISIBLE);
    mOtaWidgetData.callCardOtaButtonsListenProgress.setVisibility(View.VISIBLE);
    mOtaWidgetData.otaSpeakerButton.setVisibility(View.VISIBLE);
  }
 else {
    if (mDialerDrawer != null)     mDialerDrawer.setVisibility(View.VISIBLE);
  }
  mApplication.cdmaOtaScreenState.otaScreenState=CdmaOtaScreenState.OtaScreenState.OTA_STATUS_PROGRESS;
  mInCallScreen.updateMenuItems();
}

Fixed version (ground truth):
/** 
 * Show "Programming In Progress" screen during OTA call. Shown when OTA provisioning is in progress after user has selected an option.
 */
private void otaShowInProgressScreen(){
  if (DBG)   log("String_Node_Str");
  if (!isDialerOpened()) {
    otaScreenInitialize();
    mOtaWidgetData.otaTextListenProgress.setVisibility(View.VISIBLE);
    mOtaWidgetData.otaTextListenProgress.setText(R.string.ota_progress);
    mOtaWidgetData.otaTextProgressBar.setVisibility(View.VISIBLE);
    mOtaWidgetData.callCardOtaButtonsListenProgress.setVisibility(View.VISIBLE);
    mOtaWidgetData.otaSpeakerButton.setVisibility(View.VISIBLE);
    boolean speakerOn=PhoneUtils.isSpeakerOn(mContext);
    mOtaWidgetData.otaSpeakerButton.setChecked(speakerOn);
  }
 else {
    if (mDialerDrawer != null)     mDialerDrawer.setVisibility(View.VISIBLE);
  }
  mApplication.cdmaOtaScreenState.otaScreenState=CdmaOtaScreenState.OtaScreenState.OTA_STATUS_PROGRESS;
  mInCallScreen.updateMenuItems();
}
Program: 184782
Project: 184782
Buggy source:
/** 
 * Clear out all OTA UI widget elements. Needs to get called when OTA call ends or InCallScreen is destroyed.
 */
public void cleanOtaScreen(){
  if (DBG)   log("String_Node_Str");
  mApplication.cdmaOtaScreenState.otaScreenState=CdmaOtaScreenState.OtaScreenState.OTA_STATUS_UNDEFINED;
  mApplication.cdmaOtaProvisionData.isOtaCallCommitted=false;
  mApplication.cdmaOtaProvisionData.isOtaCallIntentProcessed=false;
  mApplication.cdmaOtaProvisionData.inOtaSpcState=false;
  mApplication.cdmaOtaProvisionData.activationCount=0;
  mApplication.cdmaOtaProvisionData.otaSpcUptime=0;
  if (mInCallPanel != null)   mInCallPanel.setVisibility(View.VISIBLE);
  if (mCallCard != null)   mCallCard.hideCallCardElements();
  if (mDialerDrawer != null)   mDialerDrawer.setVisibility(View.VISIBLE);
  mOtaWidgetData.otaTextActivate.setVisibility(View.GONE);
  mOtaWidgetData.otaTextListenProgress.setVisibility(View.GONE);
  mOtaWidgetData.otaTextProgressBar.setVisibility(View.GONE);
  mOtaWidgetData.otaTextSuccessFail.setVisibility(View.GONE);
  mOtaWidgetData.callCardOtaButtonsActivate.setVisibility(View.GONE);
  mOtaWidgetData.callCardOtaButtonsListenProgress.setVisibility(View.GONE);
  mOtaWidgetData.callCardOtaButtonsFailSuccess.setVisibility(View.GONE);
  mOtaWidgetData.otaCallCardBase.setVisibility(View.GONE);
  mOtaWidgetData.otaDtmfDialerView.setVisibility(View.GONE);
  mOtaWidgetData.otaNextButton.setVisibility(View.GONE);
  mOtaWidgetData.otaTryAgainButton.setVisibility(View.GONE);
}

Fixed version (ground truth):
/** 
 * Clear out all OTA UI widget elements. Needs to get called when OTA call ends or InCallScreen is destroyed.
 */
public void cleanOtaScreen(){
  if (DBG)   log("String_Node_Str");
  mApplication.cdmaOtaScreenState.otaScreenState=CdmaOtaScreenState.OtaScreenState.OTA_STATUS_UNDEFINED;
  mApplication.cdmaOtaProvisionData.isOtaCallCommitted=false;
  mApplication.cdmaOtaProvisionData.isOtaCallIntentProcessed=false;
  mApplication.cdmaOtaProvisionData.inOtaSpcState=false;
  mApplication.cdmaOtaProvisionData.activationCount=0;
  mApplication.cdmaOtaProvisionData.otaSpcUptime=0;
  if (mInCallPanel != null)   mInCallPanel.setVisibility(View.VISIBLE);
  if (mCallCard != null)   mCallCard.hideCallCardElements();
  if (mDialerDrawer != null)   mDialerDrawer.setVisibility(View.VISIBLE);
  mOtaWidgetData.otaTextActivate.setVisibility(View.GONE);
  mOtaWidgetData.otaTextListenProgress.setVisibility(View.GONE);
  mOtaWidgetData.otaTextProgressBar.setVisibility(View.GONE);
  mOtaWidgetData.otaTextSuccessFail.setVisibility(View.GONE);
  mOtaWidgetData.callCardOtaButtonsActivate.setVisibility(View.GONE);
  mOtaWidgetData.callCardOtaButtonsListenProgress.setVisibility(View.GONE);
  mOtaWidgetData.callCardOtaButtonsFailSuccess.setVisibility(View.GONE);
  mOtaWidgetData.otaCallCardBase.setVisibility(View.GONE);
  mOtaWidgetData.otaDtmfDialerView.setVisibility(View.GONE);
  mOtaWidgetData.otaNextButton.setVisibility(View.GONE);
  mOtaWidgetData.otaTryAgainButton.setVisibility(View.GONE);
  setSpeaker(false);
}
Program: 184783
Project: 184783
Buggy source:
/** 
 * Show "Listen for Instruction" screen during OTA call. Shown when OTA Call is initiated and user needs to listen for network instructions and press appropriate DTMF digits to proceed to the "Programming in Progress" phase.
 */
private void otaShowListeningScreen(){
  if (DBG)   log("String_Node_Str");
  if (mApplication.cdmaOtaConfigData.otaShowListeningScreen == OTA_SHOW_LISTENING_SCREEN_ON) {
    if (DBG)     log("String_Node_Str");
    if (!isDialerOpened()) {
      otaScreenInitialize();
      mOtaWidgetData.otaTextListenProgress.setVisibility(View.VISIBLE);
      mOtaWidgetData.otaTextListenProgress.setText(R.string.ota_listen);
      mOtaWidgetData.otaDtmfDialerView.setVisibility(View.VISIBLE);
      mOtaWidgetData.callCardOtaButtonsListenProgress.setVisibility(View.VISIBLE);
      mOtaWidgetData.otaSpeakerButton.setVisibility(View.VISIBLE);
    }
 else {
      if (mDialerDrawer != null)       mDialerDrawer.setVisibility(View.VISIBLE);
    }
    mApplication.cdmaOtaScreenState.otaScreenState=CdmaOtaScreenState.OtaScreenState.OTA_STATUS_LISTENING;
    mInCallScreen.updateMenuItems();
  }
 else {
    if (DBG)     log("String_Node_Str");
    otaShowInProgressScreen();
  }
}

Fixed version (ground truth):
/** 
 * Show "Listen for Instruction" screen during OTA call. Shown when OTA Call is initiated and user needs to listen for network instructions and press appropriate DTMF digits to proceed to the "Programming in Progress" phase.
 */
private void otaShowListeningScreen(){
  if (DBG)   log("String_Node_Str");
  if (mApplication.cdmaOtaConfigData.otaShowListeningScreen == OTA_SHOW_LISTENING_SCREEN_ON) {
    if (DBG)     log("String_Node_Str");
    if (!isDialerOpened()) {
      otaScreenInitialize();
      mOtaWidgetData.otaTextListenProgress.setVisibility(View.VISIBLE);
      mOtaWidgetData.otaTextListenProgress.setText(R.string.ota_listen);
      mOtaWidgetData.otaDtmfDialerView.setVisibility(View.VISIBLE);
      mOtaWidgetData.callCardOtaButtonsListenProgress.setVisibility(View.VISIBLE);
      mOtaWidgetData.otaSpeakerButton.setVisibility(View.VISIBLE);
      boolean speakerOn=PhoneUtils.isSpeakerOn(mContext);
      mOtaWidgetData.otaSpeakerButton.setChecked(speakerOn);
    }
 else {
      if (mDialerDrawer != null)       mDialerDrawer.setVisibility(View.VISIBLE);
    }
    mApplication.cdmaOtaScreenState.otaScreenState=CdmaOtaScreenState.OtaScreenState.OTA_STATUS_LISTENING;
    mInCallScreen.updateMenuItems();
  }
 else {
    if (DBG)     log("String_Node_Str");
    otaShowInProgressScreen();
  }
}
Program: 184784
Project: 184784
Buggy source:
private void onClickOtaEndButton(){
  if (DBG)   log("String_Node_Str");
  if (!mApplication.cdmaOtaProvisionData.inOtaSpcState) {
    PhoneUtils.hangup(mApplication.phone);
  }
}

Fixed version (ground truth):
private void onClickOtaEndButton(){
  if (DBG)   log("String_Node_Str");
  if (!mApplication.cdmaOtaProvisionData.inOtaSpcState) {
    if (PhoneUtils.hangup(mApplication.phone) == false) {
      setSpeaker(false);
      mInCallScreen.handleOtaCallEnd();
    }
  }
}
Program: 184785
Project: 184785
Buggy source:
/** 
 * Show "Programming In Progress" screen during OTA call. Shown when OTA provisioning is in progress after user has selected an option.
 */
private void otaShowInProgressScreen(){
  if (DBG)   log("String_Node_Str");
  if (!isDialerOpened()) {
    otaScreenInitialize();
    mOtaWidgetData.otaTextListenProgress.setVisibility(View.VISIBLE);
    mOtaWidgetData.otaTextListenProgress.setText(R.string.ota_progress);
    mOtaWidgetData.otaTextProgressBar.setVisibility(View.VISIBLE);
    mOtaWidgetData.callCardOtaButtonsListenProgress.setVisibility(View.VISIBLE);
    mOtaWidgetData.otaSpeakerButton.setVisibility(View.VISIBLE);
  }
 else {
    if (mDialerDrawer != null)     mDialerDrawer.setVisibility(View.VISIBLE);
  }
  mApplication.cdmaOtaScreenState.otaScreenState=CdmaOtaScreenState.OtaScreenState.OTA_STATUS_PROGRESS;
  mInCallScreen.updateMenuItems();
}

Fixed version (ground truth):
/** 
 * Show "Programming In Progress" screen during OTA call. Shown when OTA provisioning is in progress after user has selected an option.
 */
private void otaShowInProgressScreen(){
  if (DBG)   log("String_Node_Str");
  if (!isDialerOpened()) {
    otaScreenInitialize();
    mOtaWidgetData.otaTextListenProgress.setVisibility(View.VISIBLE);
    mOtaWidgetData.otaTextListenProgress.setText(R.string.ota_progress);
    mOtaWidgetData.otaTextProgressBar.setVisibility(View.VISIBLE);
    mOtaWidgetData.callCardOtaButtonsListenProgress.setVisibility(View.VISIBLE);
    mOtaWidgetData.otaSpeakerButton.setVisibility(View.VISIBLE);
    boolean speakerOn=PhoneUtils.isSpeakerOn(mContext);
    mOtaWidgetData.otaSpeakerButton.setChecked(speakerOn);
  }
 else {
    if (mDialerDrawer != null)     mDialerDrawer.setVisibility(View.VISIBLE);
  }
  mApplication.cdmaOtaScreenState.otaScreenState=CdmaOtaScreenState.OtaScreenState.OTA_STATUS_PROGRESS;
  mInCallScreen.updateMenuItems();
}
Program: 184787
Project: 184787
Buggy source:
/** 
 * Clear out all OTA UI widget elements. Needs to get called when OTA call ends or InCallScreen is destroyed.
 */
public void cleanOtaScreen(){
  if (DBG)   log("String_Node_Str");
  mApplication.cdmaOtaScreenState.otaScreenState=CdmaOtaScreenState.OtaScreenState.OTA_STATUS_UNDEFINED;
  mApplication.cdmaOtaProvisionData.isOtaCallCommitted=false;
  mApplication.cdmaOtaProvisionData.isOtaCallIntentProcessed=false;
  mApplication.cdmaOtaProvisionData.inOtaSpcState=false;
  mApplication.cdmaOtaProvisionData.activationCount=0;
  mApplication.cdmaOtaProvisionData.otaSpcUptime=0;
  if (mInCallPanel != null)   mInCallPanel.setVisibility(View.VISIBLE);
  if (mCallCard != null)   mCallCard.hideCallCardElements();
  if (mDialerDrawer != null)   mDialerDrawer.setVisibility(View.VISIBLE);
  mOtaWidgetData.otaTextActivate.setVisibility(View.GONE);
  mOtaWidgetData.otaTextListenProgress.setVisibility(View.GONE);
  mOtaWidgetData.otaTextProgressBar.setVisibility(View.GONE);
  mOtaWidgetData.otaTextSuccessFail.setVisibility(View.GONE);
  mOtaWidgetData.callCardOtaButtonsActivate.setVisibility(View.GONE);
  mOtaWidgetData.callCardOtaButtonsListenProgress.setVisibility(View.GONE);
  mOtaWidgetData.callCardOtaButtonsFailSuccess.setVisibility(View.GONE);
  mOtaWidgetData.otaCallCardBase.setVisibility(View.GONE);
  mOtaWidgetData.otaDtmfDialerView.setVisibility(View.GONE);
  mOtaWidgetData.otaNextButton.setVisibility(View.GONE);
  mOtaWidgetData.otaTryAgainButton.setVisibility(View.GONE);
}

Fixed version (ground truth):
/** 
 * Clear out all OTA UI widget elements. Needs to get called when OTA call ends or InCallScreen is destroyed.
 */
public void cleanOtaScreen(){
  if (DBG)   log("String_Node_Str");
  mApplication.cdmaOtaScreenState.otaScreenState=CdmaOtaScreenState.OtaScreenState.OTA_STATUS_UNDEFINED;
  mApplication.cdmaOtaProvisionData.isOtaCallCommitted=false;
  mApplication.cdmaOtaProvisionData.isOtaCallIntentProcessed=false;
  mApplication.cdmaOtaProvisionData.inOtaSpcState=false;
  mApplication.cdmaOtaProvisionData.activationCount=0;
  mApplication.cdmaOtaProvisionData.otaSpcUptime=0;
  if (mInCallPanel != null)   mInCallPanel.setVisibility(View.VISIBLE);
  if (mCallCard != null)   mCallCard.hideCallCardElements();
  if (mDialerDrawer != null)   mDialerDrawer.setVisibility(View.VISIBLE);
  mOtaWidgetData.otaTextActivate.setVisibility(View.GONE);
  mOtaWidgetData.otaTextListenProgress.setVisibility(View.GONE);
  mOtaWidgetData.otaTextProgressBar.setVisibility(View.GONE);
  mOtaWidgetData.otaTextSuccessFail.setVisibility(View.GONE);
  mOtaWidgetData.callCardOtaButtonsActivate.setVisibility(View.GONE);
  mOtaWidgetData.callCardOtaButtonsListenProgress.setVisibility(View.GONE);
  mOtaWidgetData.callCardOtaButtonsFailSuccess.setVisibility(View.GONE);
  mOtaWidgetData.otaCallCardBase.setVisibility(View.GONE);
  mOtaWidgetData.otaDtmfDialerView.setVisibility(View.GONE);
  mOtaWidgetData.otaNextButton.setVisibility(View.GONE);
  mOtaWidgetData.otaTryAgainButton.setVisibility(View.GONE);
  setSpeaker(false);
}
Program: 184788
Project: 184788
Buggy source:
/** 
 * Show "Listen for Instruction" screen during OTA call. Shown when OTA Call is initiated and user needs to listen for network instructions and press appropriate DTMF digits to proceed to the "Programming in Progress" phase.
 */
private void otaShowListeningScreen(){
  if (DBG)   log("String_Node_Str");
  if (mApplication.cdmaOtaConfigData.otaShowListeningScreen == OTA_SHOW_LISTENING_SCREEN_ON) {
    if (DBG)     log("String_Node_Str");
    if (!isDialerOpened()) {
      otaScreenInitialize();
      mOtaWidgetData.otaTextListenProgress.setVisibility(View.VISIBLE);
      mOtaWidgetData.otaTextListenProgress.setText(R.string.ota_listen);
      mOtaWidgetData.otaDtmfDialerView.setVisibility(View.VISIBLE);
      mOtaWidgetData.callCardOtaButtonsListenProgress.setVisibility(View.VISIBLE);
      mOtaWidgetData.otaSpeakerButton.setVisibility(View.VISIBLE);
    }
 else {
      if (mDialerDrawer != null)       mDialerDrawer.setVisibility(View.VISIBLE);
    }
    mApplication.cdmaOtaScreenState.otaScreenState=CdmaOtaScreenState.OtaScreenState.OTA_STATUS_LISTENING;
    mInCallScreen.updateMenuItems();
  }
 else {
    if (DBG)     log("String_Node_Str");
    otaShowInProgressScreen();
  }
}

Fixed version (ground truth):
/** 
 * Show "Listen for Instruction" screen during OTA call. Shown when OTA Call is initiated and user needs to listen for network instructions and press appropriate DTMF digits to proceed to the "Programming in Progress" phase.
 */
private void otaShowListeningScreen(){
  if (DBG)   log("String_Node_Str");
  if (mApplication.cdmaOtaConfigData.otaShowListeningScreen == OTA_SHOW_LISTENING_SCREEN_ON) {
    if (DBG)     log("String_Node_Str");
    if (!isDialerOpened()) {
      otaScreenInitialize();
      mOtaWidgetData.otaTextListenProgress.setVisibility(View.VISIBLE);
      mOtaWidgetData.otaTextListenProgress.setText(R.string.ota_listen);
      mOtaWidgetData.otaDtmfDialerView.setVisibility(View.VISIBLE);
      mOtaWidgetData.callCardOtaButtonsListenProgress.setVisibility(View.VISIBLE);
      mOtaWidgetData.otaSpeakerButton.setVisibility(View.VISIBLE);
      boolean speakerOn=PhoneUtils.isSpeakerOn(mContext);
      mOtaWidgetData.otaSpeakerButton.setChecked(speakerOn);
    }
 else {
      if (mDialerDrawer != null)       mDialerDrawer.setVisibility(View.VISIBLE);
    }
    mApplication.cdmaOtaScreenState.otaScreenState=CdmaOtaScreenState.OtaScreenState.OTA_STATUS_LISTENING;
    mInCallScreen.updateMenuItems();
  }
 else {
    if (DBG)     log("String_Node_Str");
    otaShowInProgressScreen();
  }
}
Program: 184789
Project: 184789
Buggy source:
private void onClickOtaEndButton(){
  if (DBG)   log("String_Node_Str");
  if (!mApplication.cdmaOtaProvisionData.inOtaSpcState) {
    PhoneUtils.hangup(mApplication.phone);
  }
}

Fixed version (ground truth):
private void onClickOtaEndButton(){
  if (DBG)   log("String_Node_Str");
  if (!mApplication.cdmaOtaProvisionData.inOtaSpcState) {
    if (PhoneUtils.hangup(mApplication.phone) == false) {
      setSpeaker(false);
      mInCallScreen.handleOtaCallEnd();
    }
  }
}
Program: 184790
Project: 184790
Buggy source:
/** 
 * Plays local tone for CDMA.
 */
void startLocalToneCdma(char tone){
  if (mDTMFToneEnabled) {
synchronized (mToneGeneratorLock) {
      if (mToneGenerator == null) {
        if (DBG)         log("String_Node_Str" + tone);
      }
 else {
        if (DBG)         log("String_Node_Str" + tone);
        mToneGenerator.startTone(mToneMap.get(tone));
        if (mDTMFToneType == CallFeaturesSetting.DTMF_TONE_TYPE_NORMAL) {
          mHandler.removeMessages(STOP_DTMF_TONE);
          mHandler.sendEmptyMessageDelayed(STOP_DTMF_TONE,DTMF_DURATION_MS);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Plays local tone for CDMA.
 */
void startLocalToneCdma(char tone){
  if (mDTMFToneEnabled) {
synchronized (mToneGeneratorLock) {
      if (mToneGenerator == null) {
        if (DBG)         log("String_Node_Str" + tone);
      }
 else {
        if (DBG)         log("String_Node_Str" + tone);
        int toneDuration=-1;
        if (mDTMFToneType == CallFeaturesSetting.DTMF_TONE_TYPE_NORMAL) {
          toneDuration=DTMF_DURATION_MS;
        }
        mToneGenerator.startTone(mToneMap.get(tone),toneDuration);
      }
    }
  }
}
Program: 184791
Project: 184791
Buggy source:
/** 
 * Stops the dtmf from being sent over the network for Long DTMF case and stops local DTMF key feedback tone.
 */
private void stopToneCdma(){
  if (DBG)   log("String_Node_Str");
  if (mDTMFToneType == CallFeaturesSetting.DTMF_TONE_TYPE_LONG) {
    mPhone.stopDtmf();
  }
  stopLocalToneCdma();
}

Fixed version (ground truth):
/** 
 * Stops the dtmf from being sent over the network for Long DTMF case and stops local DTMF key feedback tone.
 */
private void stopToneCdma(){
  if (DBG)   log("String_Node_Str");
  mPhone.stopDtmf();
  stopLocalToneCdma();
}
Program: 184792
Project: 184792
Buggy source:
/** 
 * Null out our reference to the InCallScreen activity. This indicates that the InCallScreen activity has been destroyed. At the same time, get rid of listeners since we're not going to be valid anymore.
 */
void clearInCallScreenReference(){
  mInCallScreen=null;
  mDialerKeyListener=null;
  if (mDialerContainer != null) {
    mDialerContainer.setOnDrawerOpenListener(null);
    mDialerContainer.setOnDrawerCloseListener(null);
  }
  if (mPhone.getPhoneName().equals("String_Node_Str")) {
    mHandler.removeMessages(STOP_DTMF_TONE);
    mHandler.removeMessages(DTMF_SEND_CNF);
synchronized (mDTMFQueue) {
      mDTMFBurstCnfPending=false;
      mDTMFQueue.clear();
    }
  }
  closeDialer(false);
}

Fixed version (ground truth):
/** 
 * Null out our reference to the InCallScreen activity. This indicates that the InCallScreen activity has been destroyed. At the same time, get rid of listeners since we're not going to be valid anymore.
 */
void clearInCallScreenReference(){
  mInCallScreen=null;
  mDialerKeyListener=null;
  if (mDialerContainer != null) {
    mDialerContainer.setOnDrawerOpenListener(null);
    mDialerContainer.setOnDrawerCloseListener(null);
  }
  if (mPhone.getPhoneName().equals("String_Node_Str")) {
    mHandler.removeMessages(DTMF_SEND_CNF);
synchronized (mDTMFQueue) {
      mDTMFBurstCnfPending=false;
      mDTMFQueue.clear();
    }
  }
  closeDialer(false);
}
Program: 184793
Project: 184793
Buggy source:
@Override public void handleMessage(Message msg){
switch (msg.what) {
case PHONE_DISCONNECT:
    if (DBG)     log("String_Node_Str");
  mPhone.unregisterForDisconnect(this);
closeDialer(false);
break;
case DTMF_SEND_CNF:
if (DBG) log("String_Node_Str");
handleBurstDtmfConfirmation();
break;
case STOP_DTMF_TONE:
if (DBG) log("String_Node_Str");
stopToneCdma();
break;
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
switch (msg.what) {
case PHONE_DISCONNECT:
    if (DBG)     log("String_Node_Str");
  mPhone.unregisterForDisconnect(this);
closeDialer(false);
break;
case DTMF_SEND_CNF:
if (DBG) log("String_Node_Str");
handleBurstDtmfConfirmation();
break;
}
}
Program: 184794
Project: 184794
Buggy source:
/** 
 * turn on keyguard on pause.
 */
@Override public void onPause(){
  if (DBG)   Log.d(LOG_TAG,"String_Node_Str");
  PhoneApp app=(PhoneApp)getApplication();
  app.reenableKeyguard();
  app.setScreenTimeout(PhoneApp.ScreenTimeoutDuration.DEFAULT);
  super.onPause();
synchronized (mToneGeneratorLock) {
    if (mToneGenerator != null) {
      mToneStopper.removeMessages(STOP_TONE);
      mToneGenerator.release();
      mToneGenerator=null;
    }
  }
}

Fixed version (ground truth):
/** 
 * turn on keyguard on pause.
 */
@Override public void onPause(){
  if (DBG)   Log.d(LOG_TAG,"String_Node_Str");
  PhoneApp app=(PhoneApp)getApplication();
  app.reenableKeyguard();
  app.setScreenTimeout(PhoneApp.ScreenTimeoutDuration.DEFAULT);
  super.onPause();
synchronized (mToneGeneratorLock) {
    if (mToneGenerator != null) {
      mToneGenerator.release();
      mToneGenerator=null;
    }
  }
}
Program: 184795
Project: 184795
Buggy source:
@Override protected void onDestroy(){
  super.onDestroy();
synchronized (mToneGeneratorLock) {
    if (mToneGenerator != null) {
      mToneStopper.removeMessages(STOP_TONE);
      mToneGenerator.release();
      mToneGenerator=null;
    }
  }
  unregisterReceiver(mBroadcastReceiver);
}

Fixed version (ground truth):
@Override protected void onDestroy(){
  super.onDestroy();
synchronized (mToneGeneratorLock) {
    if (mToneGenerator != null) {
      mToneGenerator.release();
      mToneGenerator=null;
    }
  }
  unregisterReceiver(mBroadcastReceiver);
}
Program: 184796
Project: 184796
Buggy source:
/** 
 * Plays the specified tone for TONE_LENGTH_MS milliseconds. The tone is played locally, using the audio stream for phone calls. Tones are played only if the "Audible touch tones" user preference is checked, and are NOT played if the device is in silent mode.
 * @param tone a tone code from {@link ToneGenerator}
 */
void playTone(int tone){
  if (!mDTMFToneEnabled) {
    return;
  }
  AudioManager audioManager=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
  int ringerMode=audioManager.getRingerMode();
  if ((ringerMode == AudioManager.RINGER_MODE_SILENT) || (ringerMode == AudioManager.RINGER_MODE_VIBRATE)) {
    return;
  }
synchronized (mToneGeneratorLock) {
    if (mToneGenerator == null) {
      Log.w(LOG_TAG,"String_Node_Str" + tone);
      return;
    }
    mToneStopper.removeMessages(STOP_TONE);
    mToneGenerator.startTone(tone);
    mToneStopper.sendEmptyMessageDelayed(STOP_TONE,TONE_LENGTH_MS);
  }
}

Fixed version (ground truth):
/** 
 * Plays the specified tone for TONE_LENGTH_MS milliseconds. The tone is played locally, using the audio stream for phone calls. Tones are played only if the "Audible touch tones" user preference is checked, and are NOT played if the device is in silent mode.
 * @param tone a tone code from {@link ToneGenerator}
 */
void playTone(int tone){
  if (!mDTMFToneEnabled) {
    return;
  }
  AudioManager audioManager=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
  int ringerMode=audioManager.getRingerMode();
  if ((ringerMode == AudioManager.RINGER_MODE_SILENT) || (ringerMode == AudioManager.RINGER_MODE_VIBRATE)) {
    return;
  }
synchronized (mToneGeneratorLock) {
    if (mToneGenerator == null) {
      Log.w(LOG_TAG,"String_Node_Str" + tone);
      return;
    }
    mToneGenerator.startTone(tone,TONE_LENGTH_MS);
  }
}
Program: 184797
Project: 184797
Buggy source:
/** 
 * Show "Programming In Progress" screen during OTA call. Shown when OTA provisioning is in progress after user has selected an option.
 */
private void otaShowInProgressScreen(){
  if (DBG)   log("String_Node_Str");
  if (!isDialerOpened()) {
    otaScreenInitialize();
    mOtaWidgetData.otaTextListenProgress.setVisibility(View.VISIBLE);
    mOtaWidgetData.otaTextListenProgress.setText(R.string.ota_progress);
    mOtaWidgetData.otaTextProgressBar.setVisibility(View.VISIBLE);
    mOtaWidgetData.callCardOtaButtonsListenProgress.setVisibility(View.VISIBLE);
    mOtaWidgetData.otaSpeakerButton.setVisibility(View.VISIBLE);
  }
 else {
    if (mDialerDrawer != null)     mDialerDrawer.setVisibility(View.VISIBLE);
  }
  mApplication.cdmaOtaScreenState.otaScreenState=CdmaOtaScreenState.OtaScreenState.OTA_STATUS_PROGRESS;
  mInCallScreen.updateMenuItems();
}

Fixed version (ground truth):
/** 
 * Show "Programming In Progress" screen during OTA call. Shown when OTA provisioning is in progress after user has selected an option.
 */
private void otaShowInProgressScreen(){
  if (DBG)   log("String_Node_Str");
  if (!isDialerOpened()) {
    otaScreenInitialize();
    mOtaWidgetData.otaTextListenProgress.setVisibility(View.VISIBLE);
    mOtaWidgetData.otaTextListenProgress.setText(R.string.ota_progress);
    mOtaWidgetData.otaTextProgressBar.setVisibility(View.VISIBLE);
    mOtaWidgetData.callCardOtaButtonsListenProgress.setVisibility(View.VISIBLE);
    mOtaWidgetData.otaSpeakerButton.setVisibility(View.VISIBLE);
    boolean speakerOn=PhoneUtils.isSpeakerOn(mContext);
    mOtaWidgetData.otaSpeakerButton.setChecked(speakerOn);
  }
 else {
    if (mDialerDrawer != null)     mDialerDrawer.setVisibility(View.VISIBLE);
  }
  mApplication.cdmaOtaScreenState.otaScreenState=CdmaOtaScreenState.OtaScreenState.OTA_STATUS_PROGRESS;
  mInCallScreen.updateMenuItems();
}
Program: 184799
Project: 184799
Buggy source:
/** 
 * Clear out all OTA UI widget elements. Needs to get called when OTA call ends or InCallScreen is destroyed.
 */
public void cleanOtaScreen(){
  if (DBG)   log("String_Node_Str");
  mApplication.cdmaOtaScreenState.otaScreenState=CdmaOtaScreenState.OtaScreenState.OTA_STATUS_UNDEFINED;
  mApplication.cdmaOtaProvisionData.isOtaCallCommitted=false;
  mApplication.cdmaOtaProvisionData.isOtaCallIntentProcessed=false;
  mApplication.cdmaOtaProvisionData.inOtaSpcState=false;
  mApplication.cdmaOtaProvisionData.activationCount=0;
  mApplication.cdmaOtaProvisionData.otaSpcUptime=0;
  if (mInCallPanel != null)   mInCallPanel.setVisibility(View.VISIBLE);
  if (mCallCard != null)   mCallCard.hideCallCardElements();
  if (mDialerDrawer != null)   mDialerDrawer.setVisibility(View.VISIBLE);
  mOtaWidgetData.otaTextActivate.setVisibility(View.GONE);
  mOtaWidgetData.otaTextListenProgress.setVisibility(View.GONE);
  mOtaWidgetData.otaTextProgressBar.setVisibility(View.GONE);
  mOtaWidgetData.otaTextSuccessFail.setVisibility(View.GONE);
  mOtaWidgetData.callCardOtaButtonsActivate.setVisibility(View.GONE);
  mOtaWidgetData.callCardOtaButtonsListenProgress.setVisibility(View.GONE);
  mOtaWidgetData.callCardOtaButtonsFailSuccess.setVisibility(View.GONE);
  mOtaWidgetData.otaCallCardBase.setVisibility(View.GONE);
  mOtaWidgetData.otaDtmfDialerView.setVisibility(View.GONE);
  mOtaWidgetData.otaNextButton.setVisibility(View.GONE);
  mOtaWidgetData.otaTryAgainButton.setVisibility(View.GONE);
}

Fixed version (ground truth):
/** 
 * Clear out all OTA UI widget elements. Needs to get called when OTA call ends or InCallScreen is destroyed.
 */
public void cleanOtaScreen(){
  if (DBG)   log("String_Node_Str");
  mApplication.cdmaOtaScreenState.otaScreenState=CdmaOtaScreenState.OtaScreenState.OTA_STATUS_UNDEFINED;
  mApplication.cdmaOtaProvisionData.isOtaCallCommitted=false;
  mApplication.cdmaOtaProvisionData.isOtaCallIntentProcessed=false;
  mApplication.cdmaOtaProvisionData.inOtaSpcState=false;
  mApplication.cdmaOtaProvisionData.activationCount=0;
  mApplication.cdmaOtaProvisionData.otaSpcUptime=0;
  if (mInCallPanel != null)   mInCallPanel.setVisibility(View.VISIBLE);
  if (mCallCard != null)   mCallCard.hideCallCardElements();
  if (mDialerDrawer != null)   mDialerDrawer.setVisibility(View.VISIBLE);
  mOtaWidgetData.otaTextActivate.setVisibility(View.GONE);
  mOtaWidgetData.otaTextListenProgress.setVisibility(View.GONE);
  mOtaWidgetData.otaTextProgressBar.setVisibility(View.GONE);
  mOtaWidgetData.otaTextSuccessFail.setVisibility(View.GONE);
  mOtaWidgetData.callCardOtaButtonsActivate.setVisibility(View.GONE);
  mOtaWidgetData.callCardOtaButtonsListenProgress.setVisibility(View.GONE);
  mOtaWidgetData.callCardOtaButtonsFailSuccess.setVisibility(View.GONE);
  mOtaWidgetData.otaCallCardBase.setVisibility(View.GONE);
  mOtaWidgetData.otaDtmfDialerView.setVisibility(View.GONE);
  mOtaWidgetData.otaNextButton.setVisibility(View.GONE);
  mOtaWidgetData.otaTryAgainButton.setVisibility(View.GONE);
  setSpeaker(false);
}
Program: 184800
Project: 184800
Buggy source:
/** 
 * Show "Listen for Instruction" screen during OTA call. Shown when OTA Call is initiated and user needs to listen for network instructions and press appropriate DTMF digits to proceed to the "Programming in Progress" phase.
 */
private void otaShowListeningScreen(){
  if (DBG)   log("String_Node_Str");
  if (mApplication.cdmaOtaConfigData.otaShowListeningScreen == OTA_SHOW_LISTENING_SCREEN_ON) {
    if (DBG)     log("String_Node_Str");
    if (!isDialerOpened()) {
      otaScreenInitialize();
      mOtaWidgetData.otaTextListenProgress.setVisibility(View.VISIBLE);
      mOtaWidgetData.otaTextListenProgress.setText(R.string.ota_listen);
      mOtaWidgetData.otaDtmfDialerView.setVisibility(View.VISIBLE);
      mOtaWidgetData.callCardOtaButtonsListenProgress.setVisibility(View.VISIBLE);
      mOtaWidgetData.otaSpeakerButton.setVisibility(View.VISIBLE);
    }
 else {
      if (mDialerDrawer != null)       mDialerDrawer.setVisibility(View.VISIBLE);
    }
    mApplication.cdmaOtaScreenState.otaScreenState=CdmaOtaScreenState.OtaScreenState.OTA_STATUS_LISTENING;
    mInCallScreen.updateMenuItems();
  }
 else {
    if (DBG)     log("String_Node_Str");
    otaShowInProgressScreen();
  }
}

Fixed version (ground truth):
/** 
 * Show "Listen for Instruction" screen during OTA call. Shown when OTA Call is initiated and user needs to listen for network instructions and press appropriate DTMF digits to proceed to the "Programming in Progress" phase.
 */
private void otaShowListeningScreen(){
  if (DBG)   log("String_Node_Str");
  if (mApplication.cdmaOtaConfigData.otaShowListeningScreen == OTA_SHOW_LISTENING_SCREEN_ON) {
    if (DBG)     log("String_Node_Str");
    if (!isDialerOpened()) {
      otaScreenInitialize();
      mOtaWidgetData.otaTextListenProgress.setVisibility(View.VISIBLE);
      mOtaWidgetData.otaTextListenProgress.setText(R.string.ota_listen);
      mOtaWidgetData.otaDtmfDialerView.setVisibility(View.VISIBLE);
      mOtaWidgetData.callCardOtaButtonsListenProgress.setVisibility(View.VISIBLE);
      mOtaWidgetData.otaSpeakerButton.setVisibility(View.VISIBLE);
      boolean speakerOn=PhoneUtils.isSpeakerOn(mContext);
      mOtaWidgetData.otaSpeakerButton.setChecked(speakerOn);
    }
 else {
      if (mDialerDrawer != null)       mDialerDrawer.setVisibility(View.VISIBLE);
    }
    mApplication.cdmaOtaScreenState.otaScreenState=CdmaOtaScreenState.OtaScreenState.OTA_STATUS_LISTENING;
    mInCallScreen.updateMenuItems();
  }
 else {
    if (DBG)     log("String_Node_Str");
    otaShowInProgressScreen();
  }
}
Program: 184801
Project: 184801
Buggy source:
private void onClickOtaEndButton(){
  if (DBG)   log("String_Node_Str");
  if (!mApplication.cdmaOtaProvisionData.inOtaSpcState) {
    PhoneUtils.hangup(mApplication.phone);
  }
}

Fixed version (ground truth):
private void onClickOtaEndButton(){
  if (DBG)   log("String_Node_Str");
  if (!mApplication.cdmaOtaProvisionData.inOtaSpcState) {
    if (PhoneUtils.hangup(mApplication.phone) == false) {
      setSpeaker(false);
      mInCallScreen.handleOtaCallEnd();
    }
  }
}
Program: 184802
Project: 184802
Buggy source:
/** 
 * Plays local tone for CDMA.
 */
void startLocalToneCdma(char tone){
  if (mDTMFToneEnabled) {
synchronized (mToneGeneratorLock) {
      if (mToneGenerator == null) {
        if (DBG)         log("String_Node_Str" + tone);
      }
 else {
        if (DBG)         log("String_Node_Str" + tone);
        mToneGenerator.startTone(mToneMap.get(tone));
        if (mDTMFToneType == CallFeaturesSetting.DTMF_TONE_TYPE_NORMAL) {
          mHandler.removeMessages(STOP_DTMF_TONE);
          mHandler.sendEmptyMessageDelayed(STOP_DTMF_TONE,DTMF_DURATION_MS);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Plays local tone for CDMA.
 */
void startLocalToneCdma(char tone){
  if (mDTMFToneEnabled) {
synchronized (mToneGeneratorLock) {
      if (mToneGenerator == null) {
        if (DBG)         log("String_Node_Str" + tone);
      }
 else {
        if (DBG)         log("String_Node_Str" + tone);
        int toneDuration=-1;
        if (mDTMFToneType == CallFeaturesSetting.DTMF_TONE_TYPE_NORMAL) {
          toneDuration=DTMF_DURATION_MS;
        }
        mToneGenerator.startTone(mToneMap.get(tone),toneDuration);
      }
    }
  }
}
Program: 184803
Project: 184803
Buggy source:
/** 
 * Stops the dtmf from being sent over the network for Long DTMF case and stops local DTMF key feedback tone.
 */
private void stopToneCdma(){
  if (DBG)   log("String_Node_Str");
  if (mDTMFToneType == CallFeaturesSetting.DTMF_TONE_TYPE_LONG) {
    mPhone.stopDtmf();
  }
  stopLocalToneCdma();
}

Fixed version (ground truth):
/** 
 * Stops the dtmf from being sent over the network for Long DTMF case and stops local DTMF key feedback tone.
 */
private void stopToneCdma(){
  if (DBG)   log("String_Node_Str");
  mPhone.stopDtmf();
  stopLocalToneCdma();
}
Program: 184804
Project: 184804
Buggy source:
/** 
 * Null out our reference to the InCallScreen activity. This indicates that the InCallScreen activity has been destroyed. At the same time, get rid of listeners since we're not going to be valid anymore.
 */
void clearInCallScreenReference(){
  mInCallScreen=null;
  mDialerKeyListener=null;
  if (mDialerContainer != null) {
    mDialerContainer.setOnDrawerOpenListener(null);
    mDialerContainer.setOnDrawerCloseListener(null);
  }
  if (mPhone.getPhoneName().equals("String_Node_Str")) {
    mHandler.removeMessages(STOP_DTMF_TONE);
    mHandler.removeMessages(DTMF_SEND_CNF);
synchronized (mDTMFQueue) {
      mDTMFBurstCnfPending=false;
      mDTMFQueue.clear();
    }
  }
  closeDialer(false);
}

Fixed version (ground truth):
/** 
 * Null out our reference to the InCallScreen activity. This indicates that the InCallScreen activity has been destroyed. At the same time, get rid of listeners since we're not going to be valid anymore.
 */
void clearInCallScreenReference(){
  mInCallScreen=null;
  mDialerKeyListener=null;
  if (mDialerContainer != null) {
    mDialerContainer.setOnDrawerOpenListener(null);
    mDialerContainer.setOnDrawerCloseListener(null);
  }
  if (mPhone.getPhoneName().equals("String_Node_Str")) {
    mHandler.removeMessages(DTMF_SEND_CNF);
synchronized (mDTMFQueue) {
      mDTMFBurstCnfPending=false;
      mDTMFQueue.clear();
    }
  }
  closeDialer(false);
}
Program: 184805
Project: 184805
Buggy source:
@Override public void handleMessage(Message msg){
switch (msg.what) {
case PHONE_DISCONNECT:
    if (DBG)     log("String_Node_Str");
  mPhone.unregisterForDisconnect(this);
closeDialer(false);
break;
case DTMF_SEND_CNF:
if (DBG) log("String_Node_Str");
handleBurstDtmfConfirmation();
break;
case STOP_DTMF_TONE:
if (DBG) log("String_Node_Str");
stopToneCdma();
break;
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
switch (msg.what) {
case PHONE_DISCONNECT:
    if (DBG)     log("String_Node_Str");
  mPhone.unregisterForDisconnect(this);
closeDialer(false);
break;
case DTMF_SEND_CNF:
if (DBG) log("String_Node_Str");
handleBurstDtmfConfirmation();
break;
}
}
Program: 184806
Project: 184806
Buggy source:
/** 
 * turn on keyguard on pause.
 */
@Override public void onPause(){
  if (DBG)   Log.d(LOG_TAG,"String_Node_Str");
  PhoneApp app=(PhoneApp)getApplication();
  app.reenableKeyguard();
  app.setScreenTimeout(PhoneApp.ScreenTimeoutDuration.DEFAULT);
  super.onPause();
synchronized (mToneGeneratorLock) {
    if (mToneGenerator != null) {
      mToneStopper.removeMessages(STOP_TONE);
      mToneGenerator.release();
      mToneGenerator=null;
    }
  }
}

Fixed version (ground truth):
/** 
 * turn on keyguard on pause.
 */
@Override public void onPause(){
  if (DBG)   Log.d(LOG_TAG,"String_Node_Str");
  PhoneApp app=(PhoneApp)getApplication();
  app.reenableKeyguard();
  app.setScreenTimeout(PhoneApp.ScreenTimeoutDuration.DEFAULT);
  super.onPause();
synchronized (mToneGeneratorLock) {
    if (mToneGenerator != null) {
      mToneGenerator.release();
      mToneGenerator=null;
    }
  }
}
Program: 184807
Project: 184807
Buggy source:
@Override protected void onDestroy(){
  super.onDestroy();
synchronized (mToneGeneratorLock) {
    if (mToneGenerator != null) {
      mToneStopper.removeMessages(STOP_TONE);
      mToneGenerator.release();
      mToneGenerator=null;
    }
  }
  unregisterReceiver(mBroadcastReceiver);
}

Fixed version (ground truth):
@Override protected void onDestroy(){
  super.onDestroy();
synchronized (mToneGeneratorLock) {
    if (mToneGenerator != null) {
      mToneGenerator.release();
      mToneGenerator=null;
    }
  }
  unregisterReceiver(mBroadcastReceiver);
}
Program: 184808
Project: 184808
Buggy source:
/** 
 * Plays the specified tone for TONE_LENGTH_MS milliseconds. The tone is played locally, using the audio stream for phone calls. Tones are played only if the "Audible touch tones" user preference is checked, and are NOT played if the device is in silent mode.
 * @param tone a tone code from {@link ToneGenerator}
 */
void playTone(int tone){
  if (!mDTMFToneEnabled) {
    return;
  }
  AudioManager audioManager=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
  int ringerMode=audioManager.getRingerMode();
  if ((ringerMode == AudioManager.RINGER_MODE_SILENT) || (ringerMode == AudioManager.RINGER_MODE_VIBRATE)) {
    return;
  }
synchronized (mToneGeneratorLock) {
    if (mToneGenerator == null) {
      Log.w(LOG_TAG,"String_Node_Str" + tone);
      return;
    }
    mToneStopper.removeMessages(STOP_TONE);
    mToneGenerator.startTone(tone);
    mToneStopper.sendEmptyMessageDelayed(STOP_TONE,TONE_LENGTH_MS);
  }
}

Fixed version (ground truth):
/** 
 * Plays the specified tone for TONE_LENGTH_MS milliseconds. The tone is played locally, using the audio stream for phone calls. Tones are played only if the "Audible touch tones" user preference is checked, and are NOT played if the device is in silent mode.
 * @param tone a tone code from {@link ToneGenerator}
 */
void playTone(int tone){
  if (!mDTMFToneEnabled) {
    return;
  }
  AudioManager audioManager=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
  int ringerMode=audioManager.getRingerMode();
  if ((ringerMode == AudioManager.RINGER_MODE_SILENT) || (ringerMode == AudioManager.RINGER_MODE_VIBRATE)) {
    return;
  }
synchronized (mToneGeneratorLock) {
    if (mToneGenerator == null) {
      Log.w(LOG_TAG,"String_Node_Str" + tone);
      return;
    }
    mToneGenerator.startTone(tone,TONE_LENGTH_MS);
  }
}
Program: 184809
Project: 184809
Buggy source:
/** 
 * Plays local tone for CDMA.
 */
void startLocalToneCdma(char tone){
  if (mDTMFToneEnabled) {
synchronized (mToneGeneratorLock) {
      if (mToneGenerator == null) {
        if (DBG)         log("String_Node_Str" + tone);
      }
 else {
        if (DBG)         log("String_Node_Str" + tone);
        mToneGenerator.startTone(mToneMap.get(tone));
        if (mDTMFToneType == CallFeaturesSetting.DTMF_TONE_TYPE_NORMAL) {
          mHandler.removeMessages(STOP_DTMF_TONE);
          mHandler.sendEmptyMessageDelayed(STOP_DTMF_TONE,DTMF_DURATION_MS);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Plays local tone for CDMA.
 */
void startLocalToneCdma(char tone){
  if (mDTMFToneEnabled) {
synchronized (mToneGeneratorLock) {
      if (mToneGenerator == null) {
        if (DBG)         log("String_Node_Str" + tone);
      }
 else {
        if (DBG)         log("String_Node_Str" + tone);
        int toneDuration=-1;
        if (mDTMFToneType == CallFeaturesSetting.DTMF_TONE_TYPE_NORMAL) {
          toneDuration=DTMF_DURATION_MS;
        }
        mToneGenerator.startTone(mToneMap.get(tone),toneDuration);
      }
    }
  }
}
Program: 184810
Project: 184810
Buggy source:
/** 
 * Stops the dtmf from being sent over the network for Long DTMF case and stops local DTMF key feedback tone.
 */
private void stopToneCdma(){
  if (DBG)   log("String_Node_Str");
  if (mDTMFToneType == CallFeaturesSetting.DTMF_TONE_TYPE_LONG) {
    mPhone.stopDtmf();
  }
  stopLocalToneCdma();
}

Fixed version (ground truth):
/** 
 * Stops the dtmf from being sent over the network for Long DTMF case and stops local DTMF key feedback tone.
 */
private void stopToneCdma(){
  if (DBG)   log("String_Node_Str");
  mPhone.stopDtmf();
  stopLocalToneCdma();
}
Program: 184811
Project: 184811
Buggy source:
/** 
 * Null out our reference to the InCallScreen activity. This indicates that the InCallScreen activity has been destroyed. At the same time, get rid of listeners since we're not going to be valid anymore.
 */
void clearInCallScreenReference(){
  mInCallScreen=null;
  mDialerKeyListener=null;
  if (mDialerContainer != null) {
    mDialerContainer.setOnDrawerOpenListener(null);
    mDialerContainer.setOnDrawerCloseListener(null);
  }
  if (mPhone.getPhoneName().equals("String_Node_Str")) {
    mHandler.removeMessages(STOP_DTMF_TONE);
    mHandler.removeMessages(DTMF_SEND_CNF);
synchronized (mDTMFQueue) {
      mDTMFBurstCnfPending=false;
      mDTMFQueue.clear();
    }
  }
  closeDialer(false);
}

Fixed version (ground truth):
/** 
 * Null out our reference to the InCallScreen activity. This indicates that the InCallScreen activity has been destroyed. At the same time, get rid of listeners since we're not going to be valid anymore.
 */
void clearInCallScreenReference(){
  mInCallScreen=null;
  mDialerKeyListener=null;
  if (mDialerContainer != null) {
    mDialerContainer.setOnDrawerOpenListener(null);
    mDialerContainer.setOnDrawerCloseListener(null);
  }
  if (mPhone.getPhoneName().equals("String_Node_Str")) {
    mHandler.removeMessages(DTMF_SEND_CNF);
synchronized (mDTMFQueue) {
      mDTMFBurstCnfPending=false;
      mDTMFQueue.clear();
    }
  }
  closeDialer(false);
}
Program: 184812
Project: 184812
Buggy source:
@Override public void handleMessage(Message msg){
switch (msg.what) {
case PHONE_DISCONNECT:
    if (DBG)     log("String_Node_Str");
  mPhone.unregisterForDisconnect(this);
closeDialer(false);
break;
case DTMF_SEND_CNF:
if (DBG) log("String_Node_Str");
handleBurstDtmfConfirmation();
break;
case STOP_DTMF_TONE:
if (DBG) log("String_Node_Str");
stopToneCdma();
break;
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
switch (msg.what) {
case PHONE_DISCONNECT:
    if (DBG)     log("String_Node_Str");
  mPhone.unregisterForDisconnect(this);
closeDialer(false);
break;
case DTMF_SEND_CNF:
if (DBG) log("String_Node_Str");
handleBurstDtmfConfirmation();
break;
}
}
Program: 184813
Project: 184813
Buggy source:
/** 
 * turn on keyguard on pause.
 */
@Override public void onPause(){
  if (DBG)   Log.d(LOG_TAG,"String_Node_Str");
  PhoneApp app=(PhoneApp)getApplication();
  app.reenableKeyguard();
  app.setScreenTimeout(PhoneApp.ScreenTimeoutDuration.DEFAULT);
  super.onPause();
synchronized (mToneGeneratorLock) {
    if (mToneGenerator != null) {
      mToneStopper.removeMessages(STOP_TONE);
      mToneGenerator.release();
      mToneGenerator=null;
    }
  }
}

Fixed version (ground truth):
/** 
 * turn on keyguard on pause.
 */
@Override public void onPause(){
  if (DBG)   Log.d(LOG_TAG,"String_Node_Str");
  PhoneApp app=(PhoneApp)getApplication();
  app.reenableKeyguard();
  app.setScreenTimeout(PhoneApp.ScreenTimeoutDuration.DEFAULT);
  super.onPause();
synchronized (mToneGeneratorLock) {
    if (mToneGenerator != null) {
      mToneGenerator.release();
      mToneGenerator=null;
    }
  }
}
Program: 184814
Project: 184814
Buggy source:
@Override protected void onDestroy(){
  super.onDestroy();
synchronized (mToneGeneratorLock) {
    if (mToneGenerator != null) {
      mToneStopper.removeMessages(STOP_TONE);
      mToneGenerator.release();
      mToneGenerator=null;
    }
  }
  unregisterReceiver(mBroadcastReceiver);
}

Fixed version (ground truth):
@Override protected void onDestroy(){
  super.onDestroy();
synchronized (mToneGeneratorLock) {
    if (mToneGenerator != null) {
      mToneGenerator.release();
      mToneGenerator=null;
    }
  }
  unregisterReceiver(mBroadcastReceiver);
}
Program: 184815
Project: 184815
Buggy source:
/** 
 * Plays the specified tone for TONE_LENGTH_MS milliseconds. The tone is played locally, using the audio stream for phone calls. Tones are played only if the "Audible touch tones" user preference is checked, and are NOT played if the device is in silent mode.
 * @param tone a tone code from {@link ToneGenerator}
 */
void playTone(int tone){
  if (!mDTMFToneEnabled) {
    return;
  }
  AudioManager audioManager=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
  int ringerMode=audioManager.getRingerMode();
  if ((ringerMode == AudioManager.RINGER_MODE_SILENT) || (ringerMode == AudioManager.RINGER_MODE_VIBRATE)) {
    return;
  }
synchronized (mToneGeneratorLock) {
    if (mToneGenerator == null) {
      Log.w(LOG_TAG,"String_Node_Str" + tone);
      return;
    }
    mToneStopper.removeMessages(STOP_TONE);
    mToneGenerator.startTone(tone);
    mToneStopper.sendEmptyMessageDelayed(STOP_TONE,TONE_LENGTH_MS);
  }
}

Fixed version (ground truth):
/** 
 * Plays the specified tone for TONE_LENGTH_MS milliseconds. The tone is played locally, using the audio stream for phone calls. Tones are played only if the "Audible touch tones" user preference is checked, and are NOT played if the device is in silent mode.
 * @param tone a tone code from {@link ToneGenerator}
 */
void playTone(int tone){
  if (!mDTMFToneEnabled) {
    return;
  }
  AudioManager audioManager=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
  int ringerMode=audioManager.getRingerMode();
  if ((ringerMode == AudioManager.RINGER_MODE_SILENT) || (ringerMode == AudioManager.RINGER_MODE_VIBRATE)) {
    return;
  }
synchronized (mToneGeneratorLock) {
    if (mToneGenerator == null) {
      Log.w(LOG_TAG,"String_Node_Str" + tone);
      return;
    }
    mToneGenerator.startTone(tone,TONE_LENGTH_MS);
  }
}
Program: 184816
Project: 184816
Buggy source:
/** 
 * Saves the new VM number associating it with the currently selected provider if the number is different than the one already stored for this provider. Later on this number will be used when the user switches a provider.
 */
private void maybeSaveNumberForVoicemailProvider(String newVMNumber){
  final String key=mVoicemailProviders.getValue();
  final String curNumber=loadNumberForVoiceMailProvider(key);
  if (newVMNumber.equals(curNumber)) {
    return;
  }
  mPerProviderSavedVMNumbers.edit().putString(key,newVMNumber).commit();
}

Fixed version (ground truth):
/** 
 * Saves the new VM number associating it with the currently selected provider if the number is different than the one already stored for this provider. Later on this number will be used when the user switches a provider.
 */
private void maybeSaveNumberForVoicemailProvider(String newVMNumber){
  if (mVoicemailProviders == null) {
    return;
  }
  final String key=mVoicemailProviders.getValue();
  final String curNumber=loadNumberForVoiceMailProvider(key);
  if (newVMNumber.equals(curNumber)) {
    return;
  }
  mPerProviderSavedVMNumbers.edit().putString(key,newVMNumber).commit();
}