nus-yam/ex-repair huggingface dataset:
Program: 184818
Project: 184818
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();
}
Program: 184821
Project: 184821
Buggy source:
/** 
 * Helper function used to show a missed call notification.
 */
private void showMissedCallNotification(Connection c,final long date){
  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);
  }
}

Fixed version (ground truth):
/** 
 * Helper function used to show a missed call notification.
 */
private void showMissedCallNotification(Connection c,final long date){
  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;
      String name=ci.name;
      String number=ci.phoneNumber;
      if (ci.numberPresentation == Connection.PRESENTATION_RESTRICTED) {
        name=mPhone.getContext().getString(R.string.private_num);
      }
 else       if (ci.numberPresentation != Connection.PRESENTATION_ALLOWED) {
        name=mPhone.getContext().getString(R.string.unknown);
      }
 else {
        number=PhoneUtils.modifyForSpecialCnapCases(mPhone.getContext(),ci,number,ci.numberPresentation);
      }
      NotificationMgr.getDefault().notifyMissedCall(name,number,ci.phoneLabel,date);
    }
  }
 else {
    Log.w(LOG_TAG,"String_Node_Str" + c);
  }
}
Program: 184822
Project: 184822
Buggy source:
public void run(){
  Calls.addCall(ci,mApplication,number,presentation,callLogType,date,(int)duration / 1000);
  if (DBG)   log("String_Node_Str");
}

Fixed version (ground truth):
public void run(){
  Calls.addCall(ci,mApplication,logNumber,newPresentation,callLogType,date,(int)duration / 1000);
  if (DBG)   log("String_Node_Str");
}
Program: 184823
Project: 184823
Buggy source:
/** 
 * Performs Call logging based on Timeout or Ignore Call Waiting Call for CDMA, and finally calls Hangup on the Call Waiting connection.
 */
void onCdmaCallWaitingReject(){
  final Call ringingCall=mPhone.getRingingCall();
  if (ringingCall.getState() == Call.State.WAITING) {
    Connection c=ringingCall.getLatestConnection();
    if (c != null) {
      final String number=c.getAddress();
      final int presentation=c.getNumberPresentation();
      final long date=c.getCreateTime();
      final long duration=c.getDurationMillis();
      final int callLogType=mCallWaitingTimeOut ? CallLog.Calls.MISSED_TYPE : CallLog.Calls.INCOMING_TYPE;
      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);
          if (DBG)           log("String_Node_Str");
        }
      }
;
      t.start();
      if (callLogType == CallLog.Calls.MISSED_TYPE) {
        showMissedCallNotification(c,date);
      }
 else {
        removeMessages(CALLWAITING_CALLERINFO_DISPLAY_DONE);
      }
      PhoneUtils.hangup(c);
    }
    mCallWaitingTimeOut=false;
  }
}

Fixed version (ground truth):
/** 
 * Performs Call logging based on Timeout or Ignore Call Waiting Call for CDMA, and finally calls Hangup on the Call Waiting connection.
 */
void onCdmaCallWaitingReject(){
  final Call ringingCall=mPhone.getRingingCall();
  if (ringingCall.getState() == Call.State.WAITING) {
    Connection c=ringingCall.getLatestConnection();
    if (c != null) {
      String number=c.getAddress();
      int presentation=c.getNumberPresentation();
      final long date=c.getCreateTime();
      final long duration=c.getDurationMillis();
      final int callLogType=mCallWaitingTimeOut ? CallLog.Calls.MISSED_TYPE : CallLog.Calls.INCOMING_TYPE;
      Object o=c.getUserData();
      final CallerInfo ci;
      if ((o == null) || (o instanceof CallerInfo)) {
        ci=(CallerInfo)o;
      }
 else {
        ci=((PhoneUtils.CallerInfoToken)o).currentInfo;
      }
      final String logNumber=PhoneUtils.modifyForSpecialCnapCases(mPhone.getContext(),ci,number,presentation);
      final int newPresentation=(ci != null) ? ci.numberPresentation : presentation;
      if (DBG)       log("String_Node_Str" + logNumber + "String_Node_Str"+ newPresentation);
      Thread t=new Thread(){
        public void run(){
          Calls.addCall(ci,mApplication,logNumber,newPresentation,callLogType,date,(int)duration / 1000);
          if (DBG)           log("String_Node_Str");
        }
      }
;
      t.start();
      if (callLogType == CallLog.Calls.MISSED_TYPE) {
        showMissedCallNotification(c,date);
      }
 else {
        removeMessages(CALLWAITING_CALLERINFO_DISPLAY_DONE);
      }
      PhoneUtils.hangup(c);
    }
    mCallWaitingTimeOut=false;
  }
}
Program: 184826
Project: 184826
Buggy source:
/** 
 * Returns a single "name" for the specified given a CallerInfo object. If the name is null, return defaultString as the default value, usually context.getString(R.string.unknown).
 */
static String getCompactNameFromCallerInfo(CallerInfo ci,Context context){
  if (DBG)   log("String_Node_Str" + ci);
  String compactName=null;
  if (ci != null) {
    compactName=ci.name;
    if ((compactName == null) || (TextUtils.isEmpty(compactName))) {
      compactName=ci.phoneNumber;
    }
  }
  if ((compactName == null) || (TextUtils.isEmpty(compactName))) {
    compactName=context.getString(R.string.unknown);
  }
  return compactName;
}

Fixed version (ground truth):
/** 
 * Returns a single "name" for the specified given a CallerInfo object. If the name is null, return defaultString as the default value, usually context.getString(R.string.unknown).
 */
static String getCompactNameFromCallerInfo(CallerInfo ci,Context context){
  if (DBG)   log("String_Node_Str" + ci);
  String compactName=null;
  if (ci != null) {
    compactName=ci.name;
    if ((compactName == null) || (TextUtils.isEmpty(compactName))) {
      compactName=ci.phoneNumber;
    }
    compactName=modifyForSpecialCnapCases(context,ci,compactName,ci.numberPresentation);
  }
  if ((compactName == null) || (TextUtils.isEmpty(compactName))) {
    if (ci != null && ci.numberPresentation == Connection.PRESENTATION_RESTRICTED) {
      compactName=context.getString(R.string.private_num);
    }
 else     if (ci != null && ci.numberPresentation == Connection.PRESENTATION_PAYPHONE) {
      compactName=context.getString(R.string.payphone);
    }
 else {
      compactName=context.getString(R.string.unknown);
    }
  }
  if (DBG)   log("String_Node_Str" + compactName);
  return compactName;
}
Program: 184827
Project: 184827
Buggy source:
private void saveVoiceMailNumber(String newVMNumber){
  if (newVMNumber == null) {
    newVMNumber="String_Node_Str";
  }
  if (newVMNumber.equals(mOldVmNumber)) {
    showVMDialog(MSG_VM_NOCHANGE);
    return;
  }
  if (DBG)   log("String_Node_Str" + newVMNumber);
  mPhone.setVoiceMailNumber(mPhone.getVoiceMailAlphaTag().toString(),newVMNumber,Message.obtain(mSetOptionComplete,EVENT_VOICEMAIL_CHANGED));
}

Fixed version (ground truth):
private void saveVoiceMailNumber(String newVMNumber){
  if (newVMNumber == null) {
    newVMNumber="String_Node_Str";
  }
  if (newVMNumber.equals(mOldVmNumber)) {
    showVMDialog(MSG_VM_NOCHANGE);
    return;
  }
  maybeSaveNumberForVoicemailProvider(newVMNumber);
  if (DBG)   log("String_Node_Str" + newVMNumber);
  mPhone.setVoiceMailNumber(mPhone.getVoiceMailAlphaTag().toString(),newVMNumber,Message.obtain(mSetOptionComplete,EVENT_VOICEMAIL_CHANGED));
}
Program: 184828
Project: 184828
Buggy source:
/** 
 * Implemented to support onPreferenceChangeListener to look for preference changes.
 * @param preference is the preference to be changed
 * @param objValue should be the value of the selection, NOT its localizeddisplay value.
 */
public boolean onPreferenceChange(Preference preference,Object objValue){
  if (preference == mButtonDTMF) {
    int index=mButtonDTMF.findIndexOfValue((String)objValue);
    Settings.System.putInt(mPhone.getContext().getContentResolver(),Settings.System.DTMF_TONE_TYPE_WHEN_DIALING,index);
  }
 else   if (preference == mButtonTTY) {
    handleTTYChange(preference,objValue);
  }
 else   if (preference == mVoicemailProviders) {
    updateVMPreferenceWidgets((String)objValue);
    simulatePreferenceClick(mVoicemailSettings);
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Implemented to support onPreferenceChangeListener to look for preference changes.
 * @param preference is the preference to be changed
 * @param objValue should be the value of the selection, NOT its localizeddisplay value.
 */
public boolean onPreferenceChange(Preference preference,Object objValue){
  if (preference == mButtonDTMF) {
    int index=mButtonDTMF.findIndexOfValue((String)objValue);
    Settings.System.putInt(mPhone.getContext().getContentResolver(),Settings.System.DTMF_TONE_TYPE_WHEN_DIALING,index);
  }
 else   if (preference == mButtonTTY) {
    handleTTYChange(preference,objValue);
  }
 else   if (preference == mVoicemailProviders) {
    updateVMPreferenceWidgets((String)objValue);
    final String providerVMNumber=loadNumberForVoiceMailProvider((String)objValue);
    if (providerVMNumber == null) {
      simulatePreferenceClick(mVoicemailSettings);
    }
 else {
      saveVoiceMailNumber(providerVMNumber);
    }
  }
  return true;
}
Program: 184831
Project: 184831
Buggy source:
/** 
 * Helper function used to show a missed call notification.
 */
private void showMissedCallNotification(Connection c,final long date){
  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);
  }
}

Fixed version (ground truth):
/** 
 * Helper function used to show a missed call notification.
 */
private void showMissedCallNotification(Connection c,final long date){
  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;
      String name=ci.name;
      String number=ci.phoneNumber;
      if (ci.numberPresentation == Connection.PRESENTATION_RESTRICTED) {
        name=mPhone.getContext().getString(R.string.private_num);
      }
 else       if (ci.numberPresentation != Connection.PRESENTATION_ALLOWED) {
        name=mPhone.getContext().getString(R.string.unknown);
      }
 else {
        number=PhoneUtils.modifyForSpecialCnapCases(mPhone.getContext(),ci,number,ci.numberPresentation);
      }
      NotificationMgr.getDefault().notifyMissedCall(name,number,ci.phoneLabel,date);
    }
  }
 else {
    Log.w(LOG_TAG,"String_Node_Str" + c);
  }
}
Program: 184832
Project: 184832
Buggy source:
public void run(){
  Calls.addCall(ci,mApplication,number,presentation,callLogType,date,(int)duration / 1000);
  if (DBG)   log("String_Node_Str");
}

Fixed version (ground truth):
public void run(){
  Calls.addCall(ci,mApplication,logNumber,newPresentation,callLogType,date,(int)duration / 1000);
  if (DBG)   log("String_Node_Str");
}
Program: 184833
Project: 184833
Buggy source:
/** 
 * Performs Call logging based on Timeout or Ignore Call Waiting Call for CDMA, and finally calls Hangup on the Call Waiting connection.
 */
void onCdmaCallWaitingReject(){
  final Call ringingCall=mPhone.getRingingCall();
  if (ringingCall.getState() == Call.State.WAITING) {
    Connection c=ringingCall.getLatestConnection();
    if (c != null) {
      final String number=c.getAddress();
      final int presentation=c.getNumberPresentation();
      final long date=c.getCreateTime();
      final long duration=c.getDurationMillis();
      final int callLogType=mCallWaitingTimeOut ? CallLog.Calls.MISSED_TYPE : CallLog.Calls.INCOMING_TYPE;
      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);
          if (DBG)           log("String_Node_Str");
        }
      }
;
      t.start();
      if (callLogType == CallLog.Calls.MISSED_TYPE) {
        showMissedCallNotification(c,date);
      }
 else {
        removeMessages(CALLWAITING_CALLERINFO_DISPLAY_DONE);
      }
      PhoneUtils.hangup(c);
    }
    mCallWaitingTimeOut=false;
  }
}

Fixed version (ground truth):
/** 
 * Performs Call logging based on Timeout or Ignore Call Waiting Call for CDMA, and finally calls Hangup on the Call Waiting connection.
 */
void onCdmaCallWaitingReject(){
  final Call ringingCall=mPhone.getRingingCall();
  if (ringingCall.getState() == Call.State.WAITING) {
    Connection c=ringingCall.getLatestConnection();
    if (c != null) {
      String number=c.getAddress();
      int presentation=c.getNumberPresentation();
      final long date=c.getCreateTime();
      final long duration=c.getDurationMillis();
      final int callLogType=mCallWaitingTimeOut ? CallLog.Calls.MISSED_TYPE : CallLog.Calls.INCOMING_TYPE;
      Object o=c.getUserData();
      final CallerInfo ci;
      if ((o == null) || (o instanceof CallerInfo)) {
        ci=(CallerInfo)o;
      }
 else {
        ci=((PhoneUtils.CallerInfoToken)o).currentInfo;
      }
      final String logNumber=PhoneUtils.modifyForSpecialCnapCases(mPhone.getContext(),ci,number,presentation);
      final int newPresentation=(ci != null) ? ci.numberPresentation : presentation;
      if (DBG)       log("String_Node_Str" + logNumber + "String_Node_Str"+ newPresentation);
      Thread t=new Thread(){
        public void run(){
          Calls.addCall(ci,mApplication,logNumber,newPresentation,callLogType,date,(int)duration / 1000);
          if (DBG)           log("String_Node_Str");
        }
      }
;
      t.start();
      if (callLogType == CallLog.Calls.MISSED_TYPE) {
        showMissedCallNotification(c,date);
      }
 else {
        removeMessages(CALLWAITING_CALLERINFO_DISPLAY_DONE);
      }
      PhoneUtils.hangup(c);
    }
    mCallWaitingTimeOut=false;
  }
}
Program: 184836
Project: 184836
Buggy source:
/** 
 * Returns a single "name" for the specified given a CallerInfo object. If the name is null, return defaultString as the default value, usually context.getString(R.string.unknown).
 */
static String getCompactNameFromCallerInfo(CallerInfo ci,Context context){
  if (DBG)   log("String_Node_Str" + ci);
  String compactName=null;
  if (ci != null) {
    compactName=ci.name;
    if ((compactName == null) || (TextUtils.isEmpty(compactName))) {
      compactName=ci.phoneNumber;
    }
  }
  if ((compactName == null) || (TextUtils.isEmpty(compactName))) {
    compactName=context.getString(R.string.unknown);
  }
  return compactName;
}

Fixed version (ground truth):
/** 
 * Returns a single "name" for the specified given a CallerInfo object. If the name is null, return defaultString as the default value, usually context.getString(R.string.unknown).
 */
static String getCompactNameFromCallerInfo(CallerInfo ci,Context context){
  if (DBG)   log("String_Node_Str" + ci);
  String compactName=null;
  if (ci != null) {
    compactName=ci.name;
    if ((compactName == null) || (TextUtils.isEmpty(compactName))) {
      compactName=ci.phoneNumber;
    }
    compactName=modifyForSpecialCnapCases(context,ci,compactName,ci.numberPresentation);
  }
  if ((compactName == null) || (TextUtils.isEmpty(compactName))) {
    if (ci != null && ci.numberPresentation == Connection.PRESENTATION_RESTRICTED) {
      compactName=context.getString(R.string.private_num);
    }
 else     if (ci != null && ci.numberPresentation == Connection.PRESENTATION_PAYPHONE) {
      compactName=context.getString(R.string.payphone);
    }
 else {
      compactName=context.getString(R.string.unknown);
    }
  }
  if (DBG)   log("String_Node_Str" + compactName);
  return compactName;
}
Program: 184838
Project: 184838
Buggy source:
/** 
 * Helper function used to show a missed call notification.
 */
private void showMissedCallNotification(Connection c,final long date){
  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);
  }
}

Fixed version (ground truth):
/** 
 * Helper function used to show a missed call notification.
 */
private void showMissedCallNotification(Connection c,final long date){
  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;
      String name=ci.name;
      String number=ci.phoneNumber;
      if (ci.numberPresentation == Connection.PRESENTATION_RESTRICTED) {
        name=mPhone.getContext().getString(R.string.private_num);
      }
 else       if (ci.numberPresentation != Connection.PRESENTATION_ALLOWED) {
        name=mPhone.getContext().getString(R.string.unknown);
      }
 else {
        number=PhoneUtils.modifyForSpecialCnapCases(mPhone.getContext(),ci,number,ci.numberPresentation);
      }
      NotificationMgr.getDefault().notifyMissedCall(name,number,ci.phoneLabel,date);
    }
  }
 else {
    Log.w(LOG_TAG,"String_Node_Str" + c);
  }
}
Program: 184839
Project: 184839
Buggy source:
public void run(){
  Calls.addCall(ci,mApplication,number,presentation,callLogType,date,(int)duration / 1000);
  if (DBG)   log("String_Node_Str");
}

Fixed version (ground truth):
public void run(){
  Calls.addCall(ci,mApplication,logNumber,newPresentation,callLogType,date,(int)duration / 1000);
  if (DBG)   log("String_Node_Str");
}
Program: 184840
Project: 184840
Buggy source:
/** 
 * Performs Call logging based on Timeout or Ignore Call Waiting Call for CDMA, and finally calls Hangup on the Call Waiting connection.
 */
void onCdmaCallWaitingReject(){
  final Call ringingCall=mPhone.getRingingCall();
  if (ringingCall.getState() == Call.State.WAITING) {
    Connection c=ringingCall.getLatestConnection();
    if (c != null) {
      final String number=c.getAddress();
      final int presentation=c.getNumberPresentation();
      final long date=c.getCreateTime();
      final long duration=c.getDurationMillis();
      final int callLogType=mCallWaitingTimeOut ? CallLog.Calls.MISSED_TYPE : CallLog.Calls.INCOMING_TYPE;
      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);
          if (DBG)           log("String_Node_Str");
        }
      }
;
      t.start();
      if (callLogType == CallLog.Calls.MISSED_TYPE) {
        showMissedCallNotification(c,date);
      }
 else {
        removeMessages(CALLWAITING_CALLERINFO_DISPLAY_DONE);
      }
      PhoneUtils.hangup(c);
    }
    mCallWaitingTimeOut=false;
  }
}

Fixed version (ground truth):
/** 
 * Performs Call logging based on Timeout or Ignore Call Waiting Call for CDMA, and finally calls Hangup on the Call Waiting connection.
 */
void onCdmaCallWaitingReject(){
  final Call ringingCall=mPhone.getRingingCall();
  if (ringingCall.getState() == Call.State.WAITING) {
    Connection c=ringingCall.getLatestConnection();
    if (c != null) {
      String number=c.getAddress();
      int presentation=c.getNumberPresentation();
      final long date=c.getCreateTime();
      final long duration=c.getDurationMillis();
      final int callLogType=mCallWaitingTimeOut ? CallLog.Calls.MISSED_TYPE : CallLog.Calls.INCOMING_TYPE;
      Object o=c.getUserData();
      final CallerInfo ci;
      if ((o == null) || (o instanceof CallerInfo)) {
        ci=(CallerInfo)o;
      }
 else {
        ci=((PhoneUtils.CallerInfoToken)o).currentInfo;
      }
      final String logNumber=PhoneUtils.modifyForSpecialCnapCases(mPhone.getContext(),ci,number,presentation);
      final int newPresentation=(ci != null) ? ci.numberPresentation : presentation;
      if (DBG)       log("String_Node_Str" + logNumber + "String_Node_Str"+ newPresentation);
      Thread t=new Thread(){
        public void run(){
          Calls.addCall(ci,mApplication,logNumber,newPresentation,callLogType,date,(int)duration / 1000);
          if (DBG)           log("String_Node_Str");
        }
      }
;
      t.start();
      if (callLogType == CallLog.Calls.MISSED_TYPE) {
        showMissedCallNotification(c,date);
      }
 else {
        removeMessages(CALLWAITING_CALLERINFO_DISPLAY_DONE);
      }
      PhoneUtils.hangup(c);
    }
    mCallWaitingTimeOut=false;
  }
}
Program: 184843
Project: 184843
Buggy source:
/** 
 * Returns a single "name" for the specified given a CallerInfo object. If the name is null, return defaultString as the default value, usually context.getString(R.string.unknown).
 */
static String getCompactNameFromCallerInfo(CallerInfo ci,Context context){
  if (DBG)   log("String_Node_Str" + ci);
  String compactName=null;
  if (ci != null) {
    compactName=ci.name;
    if ((compactName == null) || (TextUtils.isEmpty(compactName))) {
      compactName=ci.phoneNumber;
    }
  }
  if ((compactName == null) || (TextUtils.isEmpty(compactName))) {
    compactName=context.getString(R.string.unknown);
  }
  return compactName;
}

Fixed version (ground truth):
/** 
 * Returns a single "name" for the specified given a CallerInfo object. If the name is null, return defaultString as the default value, usually context.getString(R.string.unknown).
 */
static String getCompactNameFromCallerInfo(CallerInfo ci,Context context){
  if (DBG)   log("String_Node_Str" + ci);
  String compactName=null;
  if (ci != null) {
    compactName=ci.name;
    if ((compactName == null) || (TextUtils.isEmpty(compactName))) {
      compactName=ci.phoneNumber;
    }
    compactName=modifyForSpecialCnapCases(context,ci,compactName,ci.numberPresentation);
  }
  if ((compactName == null) || (TextUtils.isEmpty(compactName))) {
    if (ci != null && ci.numberPresentation == Connection.PRESENTATION_RESTRICTED) {
      compactName=context.getString(R.string.private_num);
    }
 else     if (ci != null && ci.numberPresentation == Connection.PRESENTATION_PAYPHONE) {
      compactName=context.getString(R.string.payphone);
    }
 else {
      compactName=context.getString(R.string.unknown);
    }
  }
  if (DBG)   log("String_Node_Str" + compactName);
  return compactName;
}
Program: 184844
Project: 184844
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();
}
Program: 184846
Project: 184846
Buggy source:
/** 
 * Implemented to support onPreferenceChangeListener to look for preference changes.
 * @param preference is the preference to be changed
 * @param objValue should be the value of the selection, NOT its localizeddisplay value.
 */
public boolean onPreferenceChange(Preference preference,Object objValue){
  if (preference == mButtonDTMF) {
    int index=mButtonDTMF.findIndexOfValue((String)objValue);
    Settings.System.putInt(mPhone.getContext().getContentResolver(),Settings.System.DTMF_TONE_TYPE_WHEN_DIALING,index);
  }
 else   if (preference == mButtonTTY) {
    handleTTYChange(preference,objValue);
  }
 else   if (preference == mVoicemailProviders) {
    updateVMPreferenceWidgets((String)objValue);
    if (getIntent().getAction().equals(ACTION_ADD_VOICEMAIL)) {
      simulatePreferenceClick(mVoicemailSettings);
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Implemented to support onPreferenceChangeListener to look for preference changes.
 * @param preference is the preference to be changed
 * @param objValue should be the value of the selection, NOT its localizeddisplay value.
 */
public boolean onPreferenceChange(Preference preference,Object objValue){
  if (preference == mButtonDTMF) {
    int index=mButtonDTMF.findIndexOfValue((String)objValue);
    Settings.System.putInt(mPhone.getContext().getContentResolver(),Settings.System.DTMF_TONE_TYPE_WHEN_DIALING,index);
  }
 else   if (preference == mButtonTTY) {
    handleTTYChange(preference,objValue);
  }
 else   if (preference == mVoicemailProviders) {
    updateVMPreferenceWidgets((String)objValue);
    simulatePreferenceClick(mVoicemailSettings);
  }
  return true;
}
Program: 184847
Project: 184847
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);
  }
  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();
  }
  if (PhoneUtils.isSpeakerOn(mPhone.getContext())) {
    PhoneUtils.turnOnSpeaker(mPhone.getContext(),false,true);
  }
  PhoneUtils.setAudioMode(mPhone.getContext(),AudioManager.MODE_NORMAL);
}
Program: 184850
Project: 184850
Buggy source:
private void onSpeakerClick(){
  if (VDBG)   log("String_Node_Str");
  boolean newSpeakerState=!PhoneUtils.isSpeakerOn(this);
  if (newSpeakerState && isBluetoothAvailable() && isBluetoothAudioConnected()) {
    disconnectBluetoothAudio();
  }
  PhoneUtils.turnOnSpeaker(this,newSpeakerState);
  if (newSpeakerState) {
    enableTouchLock(false);
  }
 else {
    if (mDialer.isOpened() && !isTouchLocked()) {
      resetTouchLockTimer();
    }
  }
}

Fixed version (ground truth):
private void onSpeakerClick(){
  if (VDBG)   log("String_Node_Str");
  boolean newSpeakerState=!PhoneUtils.isSpeakerOn(this);
  if (newSpeakerState && isBluetoothAvailable() && isBluetoothAudioConnected()) {
    disconnectBluetoothAudio();
  }
  PhoneUtils.turnOnSpeaker(this,newSpeakerState,true);
  if (newSpeakerState) {
    enableTouchLock(false);
  }
 else {
    if (mDialer.isOpened() && !isTouchLocked()) {
      resetTouchLockTimer();
    }
  }
}
Program: 184851
Project: 184851
Buggy source:
private void onBluetoothClick(){
  if (VDBG)   log("String_Node_Str");
  if (isBluetoothAvailable()) {
    if (isBluetoothAudioConnected()) {
      disconnectBluetoothAudio();
    }
 else {
      if (PhoneUtils.isSpeakerOn(this)) {
        PhoneUtils.turnOnSpeaker(this,false);
      }
      connectBluetoothAudio();
    }
  }
 else {
    Log.w(LOG_TAG,"String_Node_Str");
  }
}

Fixed version (ground truth):
private void onBluetoothClick(){
  if (VDBG)   log("String_Node_Str");
  if (isBluetoothAvailable()) {
    if (isBluetoothAudioConnected()) {
      disconnectBluetoothAudio();
    }
 else {
      if (PhoneUtils.isSpeakerOn(this)) {
        PhoneUtils.turnOnSpeaker(this,false,true);
      }
      connectBluetoothAudio();
    }
  }
 else {
    Log.w(LOG_TAG,"String_Node_Str");
  }
}
Program: 184852
Project: 184852
Buggy source:
private void setSpeaker(boolean state){
  if (DBG)   log("String_Node_Str" + state);
  if (state == PhoneUtils.isSpeakerOn(mContext)) {
    if (DBG)     log("String_Node_Str");
    return;
  }
  if (state && mInCallScreen.isBluetoothAvailable() && mInCallScreen.isBluetoothAudioConnected()) {
    mInCallScreen.disconnectBluetoothAudio();
  }
  PhoneUtils.turnOnSpeaker(mContext,state);
}

Fixed version (ground truth):
private void setSpeaker(boolean state){
  if (DBG)   log("String_Node_Str" + state);
  if (state == PhoneUtils.isSpeakerOn(mContext)) {
    if (DBG)     log("String_Node_Str");
    return;
  }
  if (state && mInCallScreen.isBluetoothAvailable() && mInCallScreen.isBluetoothAudioConnected()) {
    mInCallScreen.disconnectBluetoothAudio();
  }
  PhoneUtils.turnOnSpeaker(mContext,state,true);
}
Program: 184853
Project: 184853
Buggy source:
/** 
 * Restore the speaker mode, called after a wired headset disconnect event.
 */
static void restoreSpeakerMode(Context context){
  if (DBG)   log("String_Node_Str" + sIsSpeakerEnabled);
  if (isSpeakerOn(context) != sIsSpeakerEnabled) {
    turnOnSpeaker(context,sIsSpeakerEnabled);
  }
}

Fixed version (ground truth):
/** 
 * Restore the speaker mode, called after a wired headset disconnect event.
 */
static void restoreSpeakerMode(Context context){
  if (DBG)   log("String_Node_Str" + sIsSpeakerEnabled);
  if (isSpeakerOn(context) != sIsSpeakerEnabled) {
    turnOnSpeaker(context,sIsSpeakerEnabled,false);
  }
}
Program: 184854
Project: 184854
Buggy source:
static void turnOnSpeaker(Context context,boolean flag){
  if (DBG)   log("String_Node_Str" + flag);
  AudioManager audioManager=(AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
  audioManager.setSpeakerphoneOn(flag);
  sIsSpeakerEnabled=flag;
  if (flag) {
    NotificationMgr.getDefault().notifySpeakerphone();
  }
 else {
    NotificationMgr.getDefault().cancelSpeakerphone();
  }
  PhoneApp app=PhoneApp.getInstance();
  app.updateWakeState();
  app.updateProximitySensorMode(app.phone.getState());
}

Fixed version (ground truth):
static void turnOnSpeaker(Context context,boolean flag,boolean store){
  if (DBG)   log("String_Node_Str" + flag);
  AudioManager audioManager=(AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
  audioManager.setSpeakerphoneOn(flag);
  if (store) {
    sIsSpeakerEnabled=flag;
  }
  if (flag) {
    NotificationMgr.getDefault().notifySpeakerphone();
  }
 else {
    NotificationMgr.getDefault().cancelSpeakerphone();
  }
  PhoneApp app=PhoneApp.getInstance();
  app.updateWakeState();
  app.updateProximitySensorMode(app.phone.getState());
}
Program: 184857
Project: 184857
Buggy source:
public void onReceive(Context context,Intent intent){
  PhoneApp app=PhoneApp.getInstance();
  Phone mPhone=app.phone;
  if (!mPhone.getPhoneName().equals("String_Node_Str")) {
    if (DBG)     log("String_Node_Str");
    return;
  }
  mMin_string=mPhone.getCdmaMin();
  if (DBG)   log("String_Node_Str" + mMin_string);
  if ((mMin_string != null) && (mMin_string.length() > 3)) {
    mMin2_string=mMin_string.substring(0,3);
    if (DBG)     log("String_Node_Str" + mMin2_string);
  }
 else {
    if (DBG)     log("String_Node_Str");
    return;
  }
  if ((mMin2_string.equals(UNACTIVATED_MIN2_VALUE)) || (mMin_string.equals(UNACTIVATED_MIN_VALUE))) {
    mPhoneNeedActivation=true;
    if (DBG)     log("String_Node_Str");
  }
 else {
    if (DBG)     log("String_Node_Str");
  }
  mTmpOtaShowActivationScreen=context.getResources().getInteger(R.integer.OtaShowActivationScreen);
  if (DBG)   log("String_Node_Str" + mTmpOtaShowActivationScreen);
  mOtaShowActivationScreen=mTmpOtaShowActivationScreen;
  if (DBG)   log("String_Node_Str" + mOtaShowActivationScreen);
  if ((mPhoneNeedActivation) && (mOtaShowActivationScreen == OtaUtils.OTA_SHOW_ACTIVATION_SCREEN_ON)) {
    if (DBG)     log("String_Node_Str");
    app.cdmaOtaProvisionData.isOtaCallIntentProcessed=false;
    Intent newIntent=new Intent(InCallScreen.ACTION_SHOW_ACTIVATION);
    newIntent.setClass(context,InCallScreen.class);
    newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(newIntent);
  }
 else {
    if (DBG)     log("String_Node_Str");
  }
}

Fixed version (ground truth):
public void onReceive(Context context,Intent intent){
  if (DBG)   log("String_Node_Str");
  mApp=PhoneApp.getInstance();
  mPhone=mApp.phone;
  mContext=context;
  if (!mPhone.getPhoneName().equals("String_Node_Str")) {
    if (DBG)     log("String_Node_Str");
    return;
  }
  tryInit();
}
Program: 184864
Project: 184864
Buggy source:
NotificationMgr(Context context){
  mContext=context;
  mNotificationMgr=(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
  mStatusBar=(StatusBarManager)context.getSystemService(Context.STATUS_BAR_SERVICE);
  PhoneApp app=PhoneApp.getInstance();
  mPhone=app.phone;
  mPhone.registerForInCallVoicePrivacyOn(mEnhancedVPHandler,EVENT_ENHANCED_VP_ON,null);
  mPhone.registerForInCallVoicePrivacyOff(mEnhancedVPHandler,EVENT_ENHANCED_VP_OFF,null);
}

Fixed version (ground truth):
NotificationMgr(Context context){
  mContext=context;
  mNotificationMgr=(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
  mStatusBar=(StatusBarManager)context.getSystemService(Context.STATUS_BAR_SERVICE);
  PhoneApp app=PhoneApp.getInstance();
  mPhone=app.phone;
}
Program: 184866
Project: 184866
Buggy source:
/** 
 * Implemented for CallerInfoAsyncQuery.OnQueryCompleteListener interface. refreshes the CallCard data when it called.
 */
public void onQueryComplete(int token,Object cookie,CallerInfo ci){
  if (DBG)   log("String_Node_Str" + token + "String_Node_Str"+ cookie+ "String_Node_Str"+ ci);
  if (cookie instanceof Call) {
    if (DBG)     log("String_Node_Str");
    Call call=(Call)cookie;
    Connection conn=call.getEarliestConnection();
    PhoneUtils.CallerInfoToken cit=PhoneUtils.startGetCallerInfo(getContext(),conn,this,null);
    int presentation=conn.getNumberPresentation();
    if (DBG)     log("String_Node_Str" + presentation + "String_Node_Str"+ ci.contactExists);
    if (ci.contactExists) {
      updateDisplayForPerson(ci,Connection.PRESENTATION_ALLOWED,false,call);
    }
 else {
      updateDisplayForPerson(cit.currentInfo,presentation,false,call);
    }
    updatePhotoForCallState(call);
  }
 else   if (cookie instanceof TextView) {
    if (DBG)     log("String_Node_Str");
    ((TextView)cookie).setText(PhoneUtils.getCompactNameFromCallerInfo(ci,mContext));
  }
}

Fixed version (ground truth):
/** 
 * Implemented for CallerInfoAsyncQuery.OnQueryCompleteListener interface. refreshes the CallCard data when it called.
 */
public void onQueryComplete(int token,Object cookie,CallerInfo ci){
  if (DBG)   log("String_Node_Str" + token + "String_Node_Str"+ cookie+ "String_Node_Str"+ ci);
  if (cookie instanceof Call) {
    if (DBG)     log("String_Node_Str");
    Call call=(Call)cookie;
    Connection conn=call.getEarliestConnection();
    PhoneUtils.CallerInfoToken cit=PhoneUtils.startGetCallerInfo(getContext(),conn,this,null);
    int presentation=Connection.PRESENTATION_ALLOWED;
    if (conn != null)     presentation=conn.getNumberPresentation();
    if (DBG)     log("String_Node_Str" + presentation + "String_Node_Str"+ ci.contactExists);
    if (ci.contactExists) {
      updateDisplayForPerson(ci,Connection.PRESENTATION_ALLOWED,false,call);
    }
 else {
      updateDisplayForPerson(cit.currentInfo,presentation,false,call);
    }
    updatePhotoForCallState(call);
  }
 else   if (cookie instanceof TextView) {
    if (DBG)     log("String_Node_Str");
    ((TextView)cookie).setText(PhoneUtils.getCompactNameFromCallerInfo(ci,mContext));
  }
}
Program: 184870
Project: 184870
Buggy source:
/** 
 * Implemented for CallerInfoAsyncQuery.OnQueryCompleteListener interface. refreshes the CallCard data when it called.
 */
public void onQueryComplete(int token,Object cookie,CallerInfo ci){
  if (DBG)   log("String_Node_Str" + token + "String_Node_Str"+ cookie+ "String_Node_Str"+ ci);
  if (cookie instanceof Call) {
    if (DBG)     log("String_Node_Str");
    Call call=(Call)cookie;
    Connection conn=call.getEarliestConnection();
    PhoneUtils.CallerInfoToken cit=PhoneUtils.startGetCallerInfo(getContext(),conn,this,null);
    int presentation=conn.getNumberPresentation();
    if (DBG)     log("String_Node_Str" + presentation + "String_Node_Str"+ ci.contactExists);
    if (ci.contactExists) {
      updateDisplayForPerson(ci,Connection.PRESENTATION_ALLOWED,false,call);
    }
 else {
      updateDisplayForPerson(cit.currentInfo,presentation,false,call);
    }
    updatePhotoForCallState(call);
  }
 else   if (cookie instanceof TextView) {
    if (DBG)     log("String_Node_Str");
    ((TextView)cookie).setText(PhoneUtils.getCompactNameFromCallerInfo(ci,mContext));
  }
}

Fixed version (ground truth):
/** 
 * Implemented for CallerInfoAsyncQuery.OnQueryCompleteListener interface. refreshes the CallCard data when it called.
 */
public void onQueryComplete(int token,Object cookie,CallerInfo ci){
  if (DBG)   log("String_Node_Str" + token + "String_Node_Str"+ cookie+ "String_Node_Str"+ ci);
  if (cookie instanceof Call) {
    if (DBG)     log("String_Node_Str");
    Call call=(Call)cookie;
    Connection conn=call.getEarliestConnection();
    PhoneUtils.CallerInfoToken cit=PhoneUtils.startGetCallerInfo(getContext(),conn,this,null);
    int presentation=Connection.PRESENTATION_ALLOWED;
    if (conn != null)     presentation=conn.getNumberPresentation();
    if (DBG)     log("String_Node_Str" + presentation + "String_Node_Str"+ ci.contactExists);
    if (ci.contactExists) {
      updateDisplayForPerson(ci,Connection.PRESENTATION_ALLOWED,false,call);
    }
 else {
      updateDisplayForPerson(cit.currentInfo,presentation,false,call);
    }
    updatePhotoForCallState(call);
  }
 else   if (cookie instanceof TextView) {
    if (DBG)     log("String_Node_Str");
    ((TextView)cookie).setText(PhoneUtils.getCompactNameFromCallerInfo(ci,mContext));
  }
}
Program: 184871
Project: 184871
Buggy source:
/** 
 * Request to disconnect SCO (audio) connection to bluetooth headset/handsfree, if one is connected. Does not block.
 */
synchronized void audioOff(){
  if (VDBG)   log("String_Node_Str");
  if (mConnectedSco != null) {
    mAudioManager.setBluetoothScoOn(false);
    broadcastAudioStateIntent(BluetoothHeadset.AUDIO_STATE_DISCONNECTED);
    mConnectedSco.close();
    mConnectedSco=null;
  }
  if (mOutgoingSco != null) {
    mOutgoingSco.close();
    mOutgoingSco=null;
  }
}

Fixed version (ground truth):
/** 
 * Request to disconnect SCO (audio) connection to bluetooth headset/handsfree, if one is connected. Does not block.
 */
synchronized void audioOff(){
  if (VDBG)   log("String_Node_Str");
  if (mConnectedSco != null) {
    mAudioManager.setBluetoothScoOn(false);
    broadcastAudioStateIntent(BluetoothHeadset.AUDIO_STATE_DISCONNECTED,mHeadset.getAddress());
    mConnectedSco.close();
    mConnectedSco=null;
  }
  if (mOutgoingSco != null) {
    mOutgoingSco.close();
    mOutgoingSco=null;
  }
}
Program: 184872
Project: 184872
Buggy source:
private void broadcastAudioStateIntent(int state){
  if (VDBG)   log("String_Node_Str" + state + "String_Node_Str");
  Intent intent=new Intent(BluetoothIntent.HEADSET_AUDIO_STATE_CHANGED_ACTION);
  intent.putExtra(BluetoothIntent.HEADSET_AUDIO_STATE,state);
  mContext.sendBroadcast(intent,android.Manifest.permission.BLUETOOTH);
}

Fixed version (ground truth):
private void broadcastAudioStateIntent(int state,String address){
  if (VDBG)   log("String_Node_Str" + state + "String_Node_Str");
  Intent intent=new Intent(BluetoothIntent.HEADSET_AUDIO_STATE_CHANGED_ACTION);
  intent.putExtra(BluetoothIntent.HEADSET_AUDIO_STATE,state);
  intent.putExtra(BluetoothIntent.ADDRESS,address);
  mContext.sendBroadcast(intent,android.Manifest.permission.BLUETOOTH);
}
Program: 184874
Project: 184874
Buggy source:
private void configAudioParameters(){
  String name=mHeadset.getName();
  if (name == null) {
    name="String_Node_Str";
  }
  mAudioManager.setParameter(HEADSET_NAME,name);
  mAudioManager.setParameter(HEADSET_NREC,"String_Node_Str");
}

Fixed version (ground truth):
private void configAudioParameters(){
  String name=mHeadset.getName();
  if (name == null) {
    name="String_Node_Str";
  }
  mAudioManager.setParameters(HEADSET_NAME + "String_Node_Str" + name+ "String_Node_Str"+ HEADSET_NREC+ "String_Node_Str");
}
Program: 184876
Project: 184876
Buggy source:
synchronized void onBluetoothDisabled(){
  if (mConnectedSco != null) {
    mAudioManager.setBluetoothScoOn(false);
    broadcastAudioStateIntent(BluetoothHeadset.AUDIO_STATE_DISCONNECTED);
    mConnectedSco.close();
    mConnectedSco=null;
  }
  if (mOutgoingSco != null) {
    mOutgoingSco.close();
    mOutgoingSco=null;
  }
  if (mIncomingSco != null) {
    mIncomingSco.close();
    mIncomingSco=null;
  }
}

Fixed version (ground truth):
synchronized void onBluetoothDisabled(){
  if (mConnectedSco != null) {
    mAudioManager.setBluetoothScoOn(false);
    broadcastAudioStateIntent(BluetoothHeadset.AUDIO_STATE_DISCONNECTED,mHeadset.getAddress());
    mConnectedSco.close();
    mConnectedSco=null;
  }
  if (mOutgoingSco != null) {
    mOutgoingSco.close();
    mOutgoingSco=null;
  }
  if (mIncomingSco != null) {
    mIncomingSco.close();
    mIncomingSco=null;
  }
}
Program: 184877
Project: 184877
Buggy source:
/** 
 * Setup the local tone generator.  Should have corresponding calls to  {@link onDialerPause}.
 */
public void startDialerSession(){
  mDTMFToneEnabled=Settings.System.getInt(mInCallScreen.getContentResolver(),Settings.System.DTMF_TONE_WHEN_DIALING,1) == 1;
  if (mDTMFToneEnabled) {
synchronized (mToneGeneratorLock) {
      if (mToneGenerator == null) {
        try {
          mToneGenerator=new ToneGenerator(AudioManager.STREAM_VOICE_CALL,80);
        }
 catch (        RuntimeException e) {
          if (DBG)           log("String_Node_Str" + e);
          mToneGenerator=null;
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Setup the local tone generator.  Should have corresponding calls to  {@link onDialerPause}.
 */
public void startDialerSession(){
  mDTMFToneEnabled=Settings.System.getInt(mInCallScreen.getContentResolver(),Settings.System.DTMF_TONE_WHEN_DIALING,1) == 1;
  if (mDTMFToneEnabled) {
synchronized (mToneGeneratorLock) {
      if (mToneGenerator == null) {
        try {
          mToneGenerator=new ToneGenerator(AudioManager.STREAM_DTMF,80);
        }
 catch (        RuntimeException e) {
          if (DBG)           log("String_Node_Str" + e);
          mToneGenerator=null;
        }
      }
    }
  }
}
Program: 184879
Project: 184879
Buggy source:
/** 
 * Brings up the UI used to handle an incoming call. Originally, this brought up an IncomingCallPanel instance (which was a subclass of Dialog) on top of whatever app was currently running.  Now, we take you directly to the in-call screen, whose CallCard automatically does the right thing if there's a Call that's currently ringing.
 */
static void showIncomingCallUi(){
  if (DBG)   log("String_Node_Str");
  PhoneApp app=PhoneApp.getInstance();
  app.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
  app.preventScreenOn(true);
  app.requestWakeState(PhoneApp.WakeState.FULL);
  app.displayCallScreen();
}

Fixed version (ground truth):
/** 
 * Brings up the UI used to handle an incoming call. Originally, this brought up an IncomingCallPanel instance (which was a subclass of Dialog) on top of whatever app was currently running.  Now, we take you directly to the in-call screen, whose CallCard automatically does the right thing if there's a Call that's currently ringing.
 */
static void showIncomingCallUi(){
  if (DBG)   log("String_Node_Str");
  PhoneApp app=PhoneApp.getInstance();
  try {
    ActivityManagerNative.getDefault().closeSystemDialogs("String_Node_Str");
  }
 catch (  RemoteException e) {
  }
  app.preventScreenOn(true);
  app.requestWakeState(PhoneApp.WakeState.FULL);
  app.displayCallScreen();
}
Program: 184880
Project: 184880
Buggy source:
/** 
 * Brings up the UI used to handle an incoming call. Originally, this brought up an IncomingCallPanel instance (which was a subclass of Dialog) on top of whatever app was currently running.  Now, we take you directly to the in-call screen, whose CallCard automatically does the right thing if there's a Call that's currently ringing.
 */
static void showIncomingCallUi(){
  if (DBG)   log("String_Node_Str");
  PhoneApp app=PhoneApp.getInstance();
  app.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
  app.preventScreenOn(true);
  app.requestWakeState(PhoneApp.WakeState.FULL);
  app.displayCallScreen();
}

Fixed version (ground truth):
/** 
 * Brings up the UI used to handle an incoming call. Originally, this brought up an IncomingCallPanel instance (which was a subclass of Dialog) on top of whatever app was currently running.  Now, we take you directly to the in-call screen, whose CallCard automatically does the right thing if there's a Call that's currently ringing.
 */
static void showIncomingCallUi(){
  if (DBG)   log("String_Node_Str");
  PhoneApp app=PhoneApp.getInstance();
  try {
    ActivityManagerNative.getDefault().closeSystemDialogs("String_Node_Str");
  }
 catch (  RemoteException e) {
  }
  app.preventScreenOn(true);
  app.requestWakeState(PhoneApp.WakeState.FULL);
  app.displayCallScreen();
}
Program: 184882
Project: 184882
Buggy source:
@Override public void run(){
  if (DBG)   log("String_Node_Str" + mToneId + "String_Node_Str");
  if (mSignalInfoToneGenerator != null) {
    mSignalInfoToneGenerator.stopTone();
    mSignalInfoToneGenerator.startTone(mToneId);
  }
}

Fixed version (ground truth):
public void run(){
  Calls.addCall(ci,mApplication,number,presentation,callLogType,date,(int)duration / 1000);
  if (DBG)   log("String_Node_Str");
}