nus-yam/ex-repair huggingface dataset:
Program: 41440
Project: 41440
Buggy source:
public void dump(Printer pw,String prefix){
  pw.println(prefix + this);
  pw.println(prefix + "String_Node_Str" + mRun);
  pw.println(prefix + "String_Node_Str" + mThread);
  pw.println(prefix + "String_Node_Str" + ((mQueue != null) ? mQueue : "String_Node_Str"));
  if (mQueue != null) {
synchronized (mQueue) {
      Message msg=mQueue.mMessages;
      int n=0;
      while (msg != null) {
        pw.println(prefix + "String_Node_Str" + n+ "String_Node_Str"+ msg);
        n++;
        msg=msg.next;
      }
      pw.println(prefix + "String_Node_Str" + n+ "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public void dump(Printer pw,String prefix){
  pw.println(prefix + this);
  pw.println(prefix + "String_Node_Str" + mRun);
  pw.println(prefix + "String_Node_Str" + mThread);
  pw.println(prefix + "String_Node_Str" + ((mQueue != null) ? mQueue : "String_Node_Str"));
  if (mQueue != null) {
synchronized (mQueue) {
      long now=SystemClock.uptimeMillis();
      Message msg=mQueue.mMessages;
      int n=0;
      while (msg != null) {
        pw.println(prefix + "String_Node_Str" + n+ "String_Node_Str"+ msg.toString(now));
        n++;
        msg=msg.next;
      }
      pw.println(prefix + "String_Node_Str" + n+ "String_Node_Str");
    }
  }
}
Program: 41441
Project: 41441
Buggy source:
public String toString(){
  StringBuilder b=new StringBuilder();
  b.append("String_Node_Str");
  b.append(what);
  b.append("String_Node_Str");
  b.append(when);
  if (arg1 != 0) {
    b.append("String_Node_Str");
    b.append(arg1);
  }
  if (arg2 != 0) {
    b.append("String_Node_Str");
    b.append(arg2);
  }
  if (obj != null) {
    b.append("String_Node_Str");
    b.append(obj);
  }
  b.append("String_Node_Str");
  return b.toString();
}

Fixed version (ground truth):
String toString(long now){
  StringBuilder b=new StringBuilder();
  b.append("String_Node_Str");
  b.append(what);
  b.append("String_Node_Str");
  TimeUtils.formatDuration(when - now,b);
  if (arg1 != 0) {
    b.append("String_Node_Str");
    b.append(arg1);
  }
  if (arg2 != 0) {
    b.append("String_Node_Str");
    b.append(arg2);
  }
  if (obj != null) {
    b.append("String_Node_Str");
    b.append(obj);
  }
  b.append("String_Node_Str");
  return b.toString();
}
Program: 41442
Project: 41442
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  ImageView content=new ImageView(this);
  content.setImageResource(com.android.internal.R.drawable.platlogo);
  content.setScaleType(ImageView.ScaleType.FIT_CENTER);
  setContentView(content);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mToast=Toast.makeText(this,"String_Node_Str",Toast.LENGTH_SHORT);
  ImageView content=new ImageView(this);
  content.setImageResource(com.android.internal.R.drawable.platlogo);
  content.setScaleType(ImageView.ScaleType.FIT_CENTER);
  setContentView(content);
}
Program: 41443
Project: 41443
Buggy source:
public void noteScreenOnLocked(){
  if (!mScreenOn) {
    mHistoryCur.states|=HistoryItem.STATE_SCREEN_ON_FLAG;
    if (DEBUG_HISTORY)     Slog.v(TAG,"String_Node_Str" + Integer.toHexString(mHistoryCur.states));
    addHistoryRecordLocked(SystemClock.elapsedRealtime());
    mScreenOn=true;
    mScreenOnTimer.startRunningLocked(this);
    if (mScreenBrightnessBin >= 0) {
      mScreenBrightnessTimer[mScreenBrightnessBin].startRunningLocked(this);
    }
    noteStartWakeLocked(-1,-1,"String_Node_Str",0);
  }
}

Fixed version (ground truth):
public void noteScreenOnLocked(){
  if (!mScreenOn) {
    mHistoryCur.states|=HistoryItem.STATE_SCREEN_ON_FLAG;
    if (DEBUG_HISTORY)     Slog.v(TAG,"String_Node_Str" + Integer.toHexString(mHistoryCur.states));
    addHistoryRecordLocked(SystemClock.elapsedRealtime());
    mScreenOn=true;
    mScreenOnTimer.startRunningLocked(this);
    if (mScreenBrightnessBin >= 0) {
      mScreenBrightnessTimer[mScreenBrightnessBin].startRunningLocked(this);
    }
    noteStartWakeLocked(-1,-1,"String_Node_Str",WAKE_TYPE_PARTIAL);
  }
}
Program: 41444
Project: 41444
Buggy source:
public void noteStartWakeLocked(int pid,String name,int type){
  StopwatchTimer t=getWakeTimerLocked(name,type);
  if (t != null) {
    t.startRunningLocked(BatteryStatsImpl.this);
  }
  if (pid >= 0) {
    Pid p=getPidStatsLocked(pid);
    p.mWakeStart=SystemClock.elapsedRealtime();
  }
}

Fixed version (ground truth):
public void noteStartWakeLocked(int pid,String name,int type){
  StopwatchTimer t=getWakeTimerLocked(name,type);
  if (t != null) {
    t.startRunningLocked(BatteryStatsImpl.this);
  }
  if (pid >= 0 && type == WAKE_TYPE_PARTIAL) {
    Pid p=getPidStatsLocked(pid);
    p.mWakeStart=SystemClock.elapsedRealtime();
  }
}
Program: 41445
Project: 41445
Buggy source:
public void noteStopWakeLocked(int pid,String name,int type){
  StopwatchTimer t=getWakeTimerLocked(name,type);
  if (t != null) {
    t.stopRunningLocked(BatteryStatsImpl.this);
  }
  if (pid >= 0) {
    Pid p=mPids.get(pid);
    if (p != null) {
      p.mWakeSum+=SystemClock.elapsedRealtime() - p.mWakeStart;
      p.mWakeStart=0;
    }
  }
}

Fixed version (ground truth):
public void noteStopWakeLocked(int pid,String name,int type){
  StopwatchTimer t=getWakeTimerLocked(name,type);
  if (t != null) {
    t.stopRunningLocked(BatteryStatsImpl.this);
  }
  if (pid >= 0 && type == WAKE_TYPE_PARTIAL) {
    Pid p=mPids.get(pid);
    if (p != null) {
      p.mWakeSum+=SystemClock.elapsedRealtime() - p.mWakeStart;
      p.mWakeStart=0;
    }
  }
}
Program: 41446
Project: 41446
Buggy source:
public void noteScreenOffLocked(){
  if (mScreenOn) {
    mHistoryCur.states&=~HistoryItem.STATE_SCREEN_ON_FLAG;
    if (DEBUG_HISTORY)     Slog.v(TAG,"String_Node_Str" + Integer.toHexString(mHistoryCur.states));
    addHistoryRecordLocked(SystemClock.elapsedRealtime());
    mScreenOn=false;
    mScreenOnTimer.stopRunningLocked(this);
    if (mScreenBrightnessBin >= 0) {
      mScreenBrightnessTimer[mScreenBrightnessBin].stopRunningLocked(this);
    }
    noteStopWakeLocked(-1,-1,"String_Node_Str",0);
  }
}

Fixed version (ground truth):
public void noteScreenOffLocked(){
  if (mScreenOn) {
    mHistoryCur.states&=~HistoryItem.STATE_SCREEN_ON_FLAG;
    if (DEBUG_HISTORY)     Slog.v(TAG,"String_Node_Str" + Integer.toHexString(mHistoryCur.states));
    addHistoryRecordLocked(SystemClock.elapsedRealtime());
    mScreenOn=false;
    mScreenOnTimer.stopRunningLocked(this);
    if (mScreenBrightnessBin >= 0) {
      mScreenBrightnessTimer[mScreenBrightnessBin].stopRunningLocked(this);
    }
    noteStopWakeLocked(-1,-1,"String_Node_Str",WAKE_TYPE_PARTIAL);
  }
}
Program: 41447
Project: 41447
Buggy source:
/** 
 * Get an SMS-SUBMIT PDU for a data message to a destination address &amp; port
 * @param destAddr the address of the destination for the message
 * @param userDara the data for the message
 * @param statusReportRequested Indicates whether a report is requested for this message.
 * @return a <code>SubmitPdu</code> containing the encoded SCaddress, if applicable, and the encoded message. Returns null on encode error.
 */
public static SubmitPdu getSubmitPdu(String destAddr,UserData userData,boolean statusReportRequested){
  return privateGetSubmitPdu(destAddr,statusReportRequested,userData);
}

Fixed version (ground truth):
/** 
 * Get an SMS-SUBMIT PDU for a data message to a destination address &amp; port
 * @param destAddr the address of the destination for the message
 * @param userData the data for the message
 * @param statusReportRequested Indicates whether a report is requested for this message.
 * @return a <code>SubmitPdu</code> containing the encoded SCaddress, if applicable, and the encoded message. Returns null on encode error.
 */
public static SubmitPdu getSubmitPdu(String destAddr,UserData userData,boolean statusReportRequested){
  return privateGetSubmitPdu(destAddr,statusReportRequested,userData);
}
Program: 41448
Project: 41448
Buggy source:
/** 
 * Calculate the number of septets needed to encode the message.
 * @param messageBody the message to encode
 * @param use7bitOnly ignore (but still count) illegal characters if true
 * @return TextEncodingDetails
 */
public static TextEncodingDetails calculateLength(CharSequence messageBody,boolean use7bitOnly){
  return BearerData.calcTextEncodingDetails(messageBody.toString(),use7bitOnly);
}

Fixed version (ground truth):
/** 
 * Calculate the number of septets needed to encode the message.
 * @param messageBody the message to encode
 * @param use7bitOnly ignore (but still count) illegal characters if true
 * @return TextEncodingDetails
 */
public static TextEncodingDetails calculateLength(CharSequence messageBody,boolean use7bitOnly){
  return BearerData.calcTextEncodingDetails(messageBody,use7bitOnly);
}
Program: 41450
Project: 41450
Buggy source:
/** 
 * Calculate the message text encoding length, fragmentation, and other details.
 * @param force ignore (but still count) illegal characters if true
 * @return septet count, or -1 on failure
 */
public static TextEncodingDetails calcTextEncodingDetails(CharSequence msg,boolean force7BitEncoding){
  TextEncodingDetails ted;
  int septets=countAsciiSeptets(msg,force7BitEncoding);
  if (septets != -1 && septets <= SmsMessage.MAX_USER_DATA_SEPTETS) {
    ted=new TextEncodingDetails();
    ted.msgCount=1;
    ted.codeUnitCount=septets;
    ted.codeUnitsRemaining=SmsMessage.MAX_USER_DATA_SEPTETS - septets;
    ted.codeUnitSize=SmsMessage.ENCODING_7BIT;
  }
 else {
    ted=com.android.internal.telephony.gsm.SmsMessage.calculateLength(msg,force7BitEncoding);
    if (ted.msgCount == 1 && ted.codeUnitSize == SmsMessage.ENCODING_7BIT) {
      ted.codeUnitCount=msg.length();
      int octets=ted.codeUnitCount * 2;
      if (octets > MAX_USER_DATA_BYTES) {
        ted.msgCount=(octets / MAX_USER_DATA_BYTES_WITH_HEADER) + 1;
        ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES_WITH_HEADER - (octets % MAX_USER_DATA_BYTES_WITH_HEADER)) / 2;
      }
 else {
        ted.msgCount=1;
        ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES - octets) / 2;
      }
      ted.codeUnitSize=ENCODING_16BIT;
    }
  }
  return ted;
}

Fixed version (ground truth):
/** 
 * Calculate the message text encoding length, fragmentation, and other details.
 * @param msg message text
 * @param force7BitEncoding ignore (but still count) illegal characters if true
 * @return septet count, or -1 on failure
 */
public static TextEncodingDetails calcTextEncodingDetails(CharSequence msg,boolean force7BitEncoding){
  TextEncodingDetails ted;
  int septets=countAsciiSeptets(msg,force7BitEncoding);
  if (septets != -1 && septets <= SmsMessage.MAX_USER_DATA_SEPTETS) {
    ted=new TextEncodingDetails();
    ted.msgCount=1;
    ted.codeUnitCount=septets;
    ted.codeUnitsRemaining=SmsMessage.MAX_USER_DATA_SEPTETS - septets;
    ted.codeUnitSize=SmsMessage.ENCODING_7BIT;
  }
 else {
    ted=com.android.internal.telephony.gsm.SmsMessage.calculateLength(msg,force7BitEncoding);
    if (ted.msgCount == 1 && ted.codeUnitSize == SmsMessage.ENCODING_7BIT) {
      ted.codeUnitCount=msg.length();
      int octets=ted.codeUnitCount * 2;
      if (octets > MAX_USER_DATA_BYTES) {
        ted.msgCount=(octets + (MAX_USER_DATA_BYTES_WITH_HEADER - 1)) / MAX_USER_DATA_BYTES_WITH_HEADER;
        ted.codeUnitsRemaining=((ted.msgCount * MAX_USER_DATA_BYTES_WITH_HEADER) - octets) / 2;
      }
 else {
        ted.msgCount=1;
        ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES - octets) / 2;
      }
      ted.codeUnitSize=ENCODING_16BIT;
    }
  }
  return ted;
}
Program: 41451
Project: 41451
Buggy source:
/** 
 * Calculate the number of septets needed to encode the message.
 * @param msgBody the message to encode
 * @param use7bitOnly ignore (but still count) illegal characters if true
 * @return TextEncodingDetails
 */
public static TextEncodingDetails calculateLength(CharSequence msgBody,boolean use7bitOnly){
  TextEncodingDetails ted=new TextEncodingDetails();
  try {
    int septets=GsmAlphabet.countGsmSeptets(msgBody,!use7bitOnly);
    ted.codeUnitCount=septets;
    if (septets > MAX_USER_DATA_SEPTETS) {
      ted.msgCount=(septets / MAX_USER_DATA_SEPTETS_WITH_HEADER) + 1;
      ted.codeUnitsRemaining=MAX_USER_DATA_SEPTETS_WITH_HEADER - (septets % MAX_USER_DATA_SEPTETS_WITH_HEADER);
    }
 else {
      ted.msgCount=1;
      ted.codeUnitsRemaining=MAX_USER_DATA_SEPTETS - septets;
    }
    ted.codeUnitSize=ENCODING_7BIT;
  }
 catch (  EncodeException ex) {
    int octets=msgBody.length() * 2;
    ted.codeUnitCount=msgBody.length();
    if (octets > MAX_USER_DATA_BYTES) {
      ted.msgCount=(octets / MAX_USER_DATA_BYTES_WITH_HEADER) + 1;
      ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES_WITH_HEADER - (octets % MAX_USER_DATA_BYTES_WITH_HEADER)) / 2;
    }
 else {
      ted.msgCount=1;
      ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES - octets) / 2;
    }
    ted.codeUnitSize=ENCODING_16BIT;
  }
  return ted;
}

Fixed version (ground truth):
/** 
 * Calculate the number of septets needed to encode the message.
 * @param msgBody the message to encode
 * @param use7bitOnly ignore (but still count) illegal characters if true
 * @return TextEncodingDetails
 */
public static TextEncodingDetails calculateLength(CharSequence msgBody,boolean use7bitOnly){
  TextEncodingDetails ted=new TextEncodingDetails();
  try {
    int septets=GsmAlphabet.countGsmSeptets(msgBody,!use7bitOnly);
    ted.codeUnitCount=septets;
    if (septets > MAX_USER_DATA_SEPTETS) {
      ted.msgCount=(septets + (MAX_USER_DATA_SEPTETS_WITH_HEADER - 1)) / MAX_USER_DATA_SEPTETS_WITH_HEADER;
      ted.codeUnitsRemaining=(ted.msgCount * MAX_USER_DATA_SEPTETS_WITH_HEADER) - septets;
    }
 else {
      ted.msgCount=1;
      ted.codeUnitsRemaining=MAX_USER_DATA_SEPTETS - septets;
    }
    ted.codeUnitSize=ENCODING_7BIT;
  }
 catch (  EncodeException ex) {
    int octets=msgBody.length() * 2;
    ted.codeUnitCount=msgBody.length();
    if (octets > MAX_USER_DATA_BYTES) {
      ted.msgCount=(octets + (MAX_USER_DATA_BYTES_WITH_HEADER - 1)) / MAX_USER_DATA_BYTES_WITH_HEADER;
      ted.codeUnitsRemaining=((ted.msgCount * MAX_USER_DATA_BYTES_WITH_HEADER) - octets) / 2;
    }
 else {
      ted.msgCount=1;
      ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES - octets) / 2;
    }
    ted.codeUnitSize=ENCODING_16BIT;
  }
  return ted;
}
Program: 41452
Project: 41452
Buggy source:
/** 
 * Retrieves the compelete voice mail number.
 * @hide
 */
public String getCompleteVoiceMailNumber(){
  mContext.enforceCallingOrSelfPermission(CALL_PRIVILEGED,"String_Node_Str");
  String number=mPhone.getVoiceMailNumber();
  Log.d(LOG_TAG,"String_Node_Str");
  return number;
}

Fixed version (ground truth):
/** 
 * Retrieves the complete voice mail number.
 * @hide
 */
public String getCompleteVoiceMailNumber(){
  mContext.enforceCallingOrSelfPermission(CALL_PRIVILEGED,"String_Node_Str");
  String number=mPhone.getVoiceMailNumber();
  Log.d(LOG_TAG,"String_Node_Str");
  return number;
}
Program: 41453
Project: 41453
Buggy source:
/** 
 * response.obj.result is an String[14] See ril.h for details Please note that registration state 4 ("unknown") is treated as "out of service" above
 */
public void getRegistrationState(Message result){
  String ret[]=new String[14];
  ret[0]="String_Node_Str";
  ret[1]=null;
  ret[2]=null;
  ret[3]=null;
  ret[4]=null;
  ret[5]=null;
  ret[6]=null;
  ret[7]=null;
  ret[8]=null;
  ret[9]=null;
  ret[10]=null;
  ret[11]=null;
  ret[12]=null;
  ret[13]=null;
  ret[14]=null;
  resultSuccess(result,ret);
}

Fixed version (ground truth):
/** 
 * response.obj.result is an String[14] See ril.h for details Please note that registration state 4 ("unknown") is treated as "out of service" above
 */
public void getRegistrationState(Message result){
  String ret[]=new String[14];
  ret[0]="String_Node_Str";
  ret[1]=null;
  ret[2]=null;
  ret[3]=null;
  ret[4]=null;
  ret[5]=null;
  ret[6]=null;
  ret[7]=null;
  ret[8]=null;
  ret[9]=null;
  ret[10]=null;
  ret[11]=null;
  ret[12]=null;
  ret[13]=null;
  resultSuccess(result,ret);
}
Program: 41454
Project: 41454
Buggy source:
/** 
 * Retrieves the compelete voice mail number.
 * @hide
 */
public String getCompleteVoiceMailNumber(){
  mContext.enforceCallingOrSelfPermission(CALL_PRIVILEGED,"String_Node_Str");
  String number=mPhone.getVoiceMailNumber();
  Log.d(LOG_TAG,"String_Node_Str");
  return number;
}

Fixed version (ground truth):
/** 
 * Retrieves the complete voice mail number.
 * @hide
 */
public String getCompleteVoiceMailNumber(){
  mContext.enforceCallingOrSelfPermission(CALL_PRIVILEGED,"String_Node_Str");
  String number=mPhone.getVoiceMailNumber();
  Log.d(LOG_TAG,"String_Node_Str");
  return number;
}
Program: 41455
Project: 41455
Buggy source:
/** 
 * response.obj.result is an String[14] See ril.h for details Please note that registration state 4 ("unknown") is treated as "out of service" above
 */
public void getRegistrationState(Message result){
  String ret[]=new String[14];
  ret[0]="String_Node_Str";
  ret[1]=null;
  ret[2]=null;
  ret[3]=null;
  ret[4]=null;
  ret[5]=null;
  ret[6]=null;
  ret[7]=null;
  ret[8]=null;
  ret[9]=null;
  ret[10]=null;
  ret[11]=null;
  ret[12]=null;
  ret[13]=null;
  ret[14]=null;
  resultSuccess(result,ret);
}

Fixed version (ground truth):
/** 
 * response.obj.result is an String[14] See ril.h for details Please note that registration state 4 ("unknown") is treated as "out of service" above
 */
public void getRegistrationState(Message result){
  String ret[]=new String[14];
  ret[0]="String_Node_Str";
  ret[1]=null;
  ret[2]=null;
  ret[3]=null;
  ret[4]=null;
  ret[5]=null;
  ret[6]=null;
  ret[7]=null;
  ret[8]=null;
  ret[9]=null;
  ret[10]=null;
  ret[11]=null;
  ret[12]=null;
  ret[13]=null;
  resultSuccess(result,ret);
}
Program: 41456
Project: 41456
Buggy source:
public void dispatchKey(KeyEvent event){
  if (event.getAction() == KeyEvent.ACTION_DOWN) {
    if (false && event.getKeyCode() == KeyEvent.KEYCODE_CAMERA) {
      if (Config.LOGD)       Log.d("String_Node_Str","String_Node_Str");
      if (Config.LOGD)       Log.d("String_Node_Str","String_Node_Str");
      debug();
      if (Config.LOGD)       Log.d("String_Node_Str","String_Node_Str");
    }
  }
  Message msg=obtainMessage(DISPATCH_KEY);
  msg.obj=event;
  if (LOCAL_LOGV)   Log.v(TAG,"String_Node_Str" + event + "String_Node_Str"+ mView);
  sendMessageAtTime(msg,event.getEventTime());
}

Fixed version (ground truth):
private void dispatchKey(KeyEvent event,boolean sendDone){
  if (false && event.getAction() == KeyEvent.ACTION_DOWN) {
    if (event.getKeyCode() == KeyEvent.KEYCODE_CAMERA) {
      if (Config.LOGD)       Log.d("String_Node_Str","String_Node_Str");
      if (Config.LOGD)       Log.d("String_Node_Str","String_Node_Str");
      debug();
      if (Config.LOGD)       Log.d("String_Node_Str","String_Node_Str");
    }
  }
  Message msg=obtainMessage(DISPATCH_KEY);
  msg.obj=event;
  msg.arg1=sendDone ? 1 : 0;
  if (LOCAL_LOGV)   Log.v(TAG,"String_Node_Str" + event + "String_Node_Str"+ mView);
  sendMessageAtTime(msg,event.getEventTime());
}
Program: 41457
Project: 41457
Buggy source:
private void deliverKeyEvent(KeyEvent event,boolean sendDone){
  boolean handled=mView != null ? mView.dispatchKeyEventPreIme(event) : true;
  if (handled) {
    if (sendDone) {
      if (LOCAL_LOGV)       Log.v(TAG,"String_Node_Str");
      finishKeyEvent(event);
    }
    return;
  }
  if (mLastWasImTarget) {
    InputMethodManager imm=InputMethodManager.peekInstance();
    if (imm != null && mView != null) {
      int seq=enqueuePendingEvent(event,sendDone);
      if (DEBUG_IMF)       Log.v(TAG,"String_Node_Str" + seq + "String_Node_Str"+ event);
      imm.dispatchKeyEvent(mView.getContext(),seq,event,mInputMethodCallback);
      return;
    }
  }
  deliverKeyEventToViewHierarchy(event,sendDone);
}

Fixed version (ground truth):
private void deliverKeyEvent(KeyEvent event,boolean sendDone){
  boolean handled=mView != null ? mView.dispatchKeyEventPreIme(event) : true;
  if (handled) {
    if (sendDone) {
      finishKeyEvent(event);
    }
    return;
  }
  if (mLastWasImTarget) {
    InputMethodManager imm=InputMethodManager.peekInstance();
    if (imm != null && mView != null) {
      int seq=enqueuePendingEvent(event,sendDone);
      if (DEBUG_IMF)       Log.v(TAG,"String_Node_Str" + seq + "String_Node_Str"+ event);
      imm.dispatchKeyEvent(mView.getContext(),seq,event,mInputMethodCallback);
      return;
    }
  }
  deliverKeyEventToViewHierarchy(event,sendDone);
}
Program: 41458
Project: 41458
Buggy source:
void handleFinishedEvent(int seq,boolean handled){
  final KeyEvent event=(KeyEvent)retrievePendingEvent(seq);
  if (DEBUG_IMF)   Log.v(TAG,"String_Node_Str" + seq + "String_Node_Str"+ handled+ "String_Node_Str"+ event);
  if (event != null) {
    final boolean sendDone=seq >= 0;
    if (!handled) {
      deliverKeyEventToViewHierarchy(event,sendDone);
      return;
    }
 else     if (sendDone) {
      if (LOCAL_LOGV)       Log.v(TAG,"String_Node_Str");
      finishKeyEvent(event);
    }
 else {
      Log.w(TAG,"String_Node_Str" + seq + "String_Node_Str"+ handled+ "String_Node_Str"+ event+ "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
void handleFinishedEvent(int seq,boolean handled){
  final KeyEvent event=(KeyEvent)retrievePendingEvent(seq);
  if (DEBUG_IMF)   Log.v(TAG,"String_Node_Str" + seq + "String_Node_Str"+ handled+ "String_Node_Str"+ event);
  if (event != null) {
    final boolean sendDone=seq >= 0;
    if (!handled) {
      deliverKeyEventToViewHierarchy(event,sendDone);
      return;
    }
 else     if (sendDone) {
      finishKeyEvent(event);
    }
 else {
      Log.w(TAG,"String_Node_Str" + seq + "String_Node_Str"+ handled+ "String_Node_Str"+ event+ "String_Node_Str");
    }
  }
}
Program: 41459
Project: 41459
Buggy source:
private void finishKeyEvent(KeyEvent event){
  if (mFinishedCallback != null) {
    mFinishedCallback.run();
    mFinishedCallback=null;
  }
}

Fixed version (ground truth):
private void finishKeyEvent(KeyEvent event){
  if (LOCAL_LOGV)   Log.v(TAG,"String_Node_Str");
  if (mFinishedCallback != null) {
    mFinishedCallback.run();
    mFinishedCallback=null;
  }
 else {
    Slog.w(TAG,"String_Node_Str" + "String_Node_Str");
  }
}
Program: 41460
Project: 41460
Buggy source:
public void handleKey(KeyEvent event,Runnable finishedCallback){
  mFinishedCallback=finishedCallback;
  dispatchKey(event);
}

Fixed version (ground truth):
public void handleKey(KeyEvent event,Runnable finishedCallback){
  if (mFinishedCallback != null) {
    Slog.w(TAG,"String_Node_Str" + "String_Node_Str");
  }
  mFinishedCallback=finishedCallback;
  dispatchKey(event,true);
}
Program: 41461
Project: 41461
Buggy source:
private void deliverKeyEventToViewHierarchy(KeyEvent event,boolean sendDone){
  try {
    if (mView != null && mAdded) {
      final int action=event.getAction();
      boolean isDown=(action == KeyEvent.ACTION_DOWN);
      if (checkForLeavingTouchModeAndConsume(event)) {
        return;
      }
      if (Config.LOGV) {
        captureKeyLog("String_Node_Str",event);
      }
      boolean keyHandled=mView.dispatchKeyEvent(event);
      if (!keyHandled && isDown) {
        int direction=0;
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_DPAD_LEFT:
          direction=View.FOCUS_LEFT;
        break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
      direction=View.FOCUS_RIGHT;
    break;
case KeyEvent.KEYCODE_DPAD_UP:
  direction=View.FOCUS_UP;
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
direction=View.FOCUS_DOWN;
break;
}
if (direction != 0) {
View focused=mView != null ? mView.findFocus() : null;
if (focused != null) {
View v=focused.focusSearch(direction);
boolean focusPassed=false;
if (v != null && v != focused) {
focused.getFocusedRect(mTempRect);
if (mView instanceof ViewGroup) {
((ViewGroup)mView).offsetDescendantRectToMyCoords(focused,mTempRect);
((ViewGroup)mView).offsetRectIntoDescendantCoords(v,mTempRect);
}
focusPassed=v.requestFocus(direction,mTempRect);
}
if (!focusPassed) {
mView.dispatchUnhandledMove(focused,direction);
}
 else {
playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction));
}
}
}
}
}
}
  finally {
if (sendDone) {
if (LOCAL_LOGV) Log.v(TAG,"String_Node_Str");
finishKeyEvent(event);
}
}
}

Fixed version (ground truth):
private void deliverKeyEventToViewHierarchy(KeyEvent event,boolean sendDone){
  try {
    if (mView != null && mAdded) {
      final int action=event.getAction();
      boolean isDown=(action == KeyEvent.ACTION_DOWN);
      if (checkForLeavingTouchModeAndConsume(event)) {
        return;
      }
      if (Config.LOGV) {
        captureKeyLog("String_Node_Str",event);
      }
      boolean keyHandled=mView.dispatchKeyEvent(event);
      if (!keyHandled && isDown) {
        int direction=0;
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_DPAD_LEFT:
          direction=View.FOCUS_LEFT;
        break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
      direction=View.FOCUS_RIGHT;
    break;
case KeyEvent.KEYCODE_DPAD_UP:
  direction=View.FOCUS_UP;
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
direction=View.FOCUS_DOWN;
break;
}
if (direction != 0) {
View focused=mView != null ? mView.findFocus() : null;
if (focused != null) {
View v=focused.focusSearch(direction);
boolean focusPassed=false;
if (v != null && v != focused) {
focused.getFocusedRect(mTempRect);
if (mView instanceof ViewGroup) {
((ViewGroup)mView).offsetDescendantRectToMyCoords(focused,mTempRect);
((ViewGroup)mView).offsetRectIntoDescendantCoords(v,mTempRect);
}
focusPassed=v.requestFocus(direction,mTempRect);
}
if (!focusPassed) {
mView.dispatchUnhandledMove(focused,direction);
}
 else {
playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction));
}
}
}
}
}
}
  finally {
if (sendDone) {
finishKeyEvent(event);
}
}
}
Program: 41463
Project: 41463
Buggy source:
public void dispatchKey(KeyEvent event){
  if (event.getAction() == KeyEvent.ACTION_DOWN) {
    if (false && event.getKeyCode() == KeyEvent.KEYCODE_CAMERA) {
      if (Config.LOGD)       Log.d("String_Node_Str","String_Node_Str");
      if (Config.LOGD)       Log.d("String_Node_Str","String_Node_Str");
      debug();
      if (Config.LOGD)       Log.d("String_Node_Str","String_Node_Str");
    }
  }
  Message msg=obtainMessage(DISPATCH_KEY);
  msg.obj=event;
  if (LOCAL_LOGV)   Log.v(TAG,"String_Node_Str" + event + "String_Node_Str"+ mView);
  sendMessageAtTime(msg,event.getEventTime());
}

Fixed version (ground truth):
private void dispatchKey(KeyEvent event,boolean sendDone){
  if (false && event.getAction() == KeyEvent.ACTION_DOWN) {
    if (event.getKeyCode() == KeyEvent.KEYCODE_CAMERA) {
      if (Config.LOGD)       Log.d("String_Node_Str","String_Node_Str");
      if (Config.LOGD)       Log.d("String_Node_Str","String_Node_Str");
      debug();
      if (Config.LOGD)       Log.d("String_Node_Str","String_Node_Str");
    }
  }
  Message msg=obtainMessage(DISPATCH_KEY);
  msg.obj=event;
  msg.arg1=sendDone ? 1 : 0;
  if (LOCAL_LOGV)   Log.v(TAG,"String_Node_Str" + event + "String_Node_Str"+ mView);
  sendMessageAtTime(msg,event.getEventTime());
}
Program: 41464
Project: 41464
Buggy source:
private void deliverKeyEvent(KeyEvent event,boolean sendDone){
  boolean handled=mView != null ? mView.dispatchKeyEventPreIme(event) : true;
  if (handled) {
    if (sendDone) {
      if (LOCAL_LOGV)       Log.v(TAG,"String_Node_Str");
      finishKeyEvent(event);
    }
    return;
  }
  if (mLastWasImTarget) {
    InputMethodManager imm=InputMethodManager.peekInstance();
    if (imm != null && mView != null) {
      int seq=enqueuePendingEvent(event,sendDone);
      if (DEBUG_IMF)       Log.v(TAG,"String_Node_Str" + seq + "String_Node_Str"+ event);
      imm.dispatchKeyEvent(mView.getContext(),seq,event,mInputMethodCallback);
      return;
    }
  }
  deliverKeyEventToViewHierarchy(event,sendDone);
}

Fixed version (ground truth):
private void deliverKeyEvent(KeyEvent event,boolean sendDone){
  boolean handled=mView != null ? mView.dispatchKeyEventPreIme(event) : true;
  if (handled) {
    if (sendDone) {
      finishKeyEvent(event);
    }
    return;
  }
  if (mLastWasImTarget) {
    InputMethodManager imm=InputMethodManager.peekInstance();
    if (imm != null && mView != null) {
      int seq=enqueuePendingEvent(event,sendDone);
      if (DEBUG_IMF)       Log.v(TAG,"String_Node_Str" + seq + "String_Node_Str"+ event);
      imm.dispatchKeyEvent(mView.getContext(),seq,event,mInputMethodCallback);
      return;
    }
  }
  deliverKeyEventToViewHierarchy(event,sendDone);
}
Program: 41465
Project: 41465
Buggy source:
void handleFinishedEvent(int seq,boolean handled){
  final KeyEvent event=(KeyEvent)retrievePendingEvent(seq);
  if (DEBUG_IMF)   Log.v(TAG,"String_Node_Str" + seq + "String_Node_Str"+ handled+ "String_Node_Str"+ event);
  if (event != null) {
    final boolean sendDone=seq >= 0;
    if (!handled) {
      deliverKeyEventToViewHierarchy(event,sendDone);
      return;
    }
 else     if (sendDone) {
      if (LOCAL_LOGV)       Log.v(TAG,"String_Node_Str");
      finishKeyEvent(event);
    }
 else {
      Log.w(TAG,"String_Node_Str" + seq + "String_Node_Str"+ handled+ "String_Node_Str"+ event+ "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
void handleFinishedEvent(int seq,boolean handled){
  final KeyEvent event=(KeyEvent)retrievePendingEvent(seq);
  if (DEBUG_IMF)   Log.v(TAG,"String_Node_Str" + seq + "String_Node_Str"+ handled+ "String_Node_Str"+ event);
  if (event != null) {
    final boolean sendDone=seq >= 0;
    if (!handled) {
      deliverKeyEventToViewHierarchy(event,sendDone);
      return;
    }
 else     if (sendDone) {
      finishKeyEvent(event);
    }
 else {
      Log.w(TAG,"String_Node_Str" + seq + "String_Node_Str"+ handled+ "String_Node_Str"+ event+ "String_Node_Str");
    }
  }
}
Program: 41466
Project: 41466
Buggy source:
private void finishKeyEvent(KeyEvent event){
  if (mFinishedCallback != null) {
    mFinishedCallback.run();
    mFinishedCallback=null;
  }
}

Fixed version (ground truth):
private void finishKeyEvent(KeyEvent event){
  if (LOCAL_LOGV)   Log.v(TAG,"String_Node_Str");
  if (mFinishedCallback != null) {
    mFinishedCallback.run();
    mFinishedCallback=null;
  }
 else {
    Slog.w(TAG,"String_Node_Str" + "String_Node_Str");
  }
}
Program: 41467
Project: 41467
Buggy source:
public void handleKey(KeyEvent event,Runnable finishedCallback){
  mFinishedCallback=finishedCallback;
  dispatchKey(event);
}

Fixed version (ground truth):
public void handleKey(KeyEvent event,Runnable finishedCallback){
  if (mFinishedCallback != null) {
    Slog.w(TAG,"String_Node_Str" + "String_Node_Str");
  }
  mFinishedCallback=finishedCallback;
  dispatchKey(event,true);
}
Program: 41468
Project: 41468
Buggy source:
private void deliverKeyEventToViewHierarchy(KeyEvent event,boolean sendDone){
  try {
    if (mView != null && mAdded) {
      final int action=event.getAction();
      boolean isDown=(action == KeyEvent.ACTION_DOWN);
      if (checkForLeavingTouchModeAndConsume(event)) {
        return;
      }
      if (Config.LOGV) {
        captureKeyLog("String_Node_Str",event);
      }
      boolean keyHandled=mView.dispatchKeyEvent(event);
      if (!keyHandled && isDown) {
        int direction=0;
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_DPAD_LEFT:
          direction=View.FOCUS_LEFT;
        break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
      direction=View.FOCUS_RIGHT;
    break;
case KeyEvent.KEYCODE_DPAD_UP:
  direction=View.FOCUS_UP;
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
direction=View.FOCUS_DOWN;
break;
}
if (direction != 0) {
View focused=mView != null ? mView.findFocus() : null;
if (focused != null) {
View v=focused.focusSearch(direction);
boolean focusPassed=false;
if (v != null && v != focused) {
focused.getFocusedRect(mTempRect);
if (mView instanceof ViewGroup) {
((ViewGroup)mView).offsetDescendantRectToMyCoords(focused,mTempRect);
((ViewGroup)mView).offsetRectIntoDescendantCoords(v,mTempRect);
}
focusPassed=v.requestFocus(direction,mTempRect);
}
if (!focusPassed) {
mView.dispatchUnhandledMove(focused,direction);
}
 else {
playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction));
}
}
}
}
}
}
  finally {
if (sendDone) {
if (LOCAL_LOGV) Log.v(TAG,"String_Node_Str");
finishKeyEvent(event);
}
}
}

Fixed version (ground truth):
private void deliverKeyEventToViewHierarchy(KeyEvent event,boolean sendDone){
  try {
    if (mView != null && mAdded) {
      final int action=event.getAction();
      boolean isDown=(action == KeyEvent.ACTION_DOWN);
      if (checkForLeavingTouchModeAndConsume(event)) {
        return;
      }
      if (Config.LOGV) {
        captureKeyLog("String_Node_Str",event);
      }
      boolean keyHandled=mView.dispatchKeyEvent(event);
      if (!keyHandled && isDown) {
        int direction=0;
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_DPAD_LEFT:
          direction=View.FOCUS_LEFT;
        break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
      direction=View.FOCUS_RIGHT;
    break;
case KeyEvent.KEYCODE_DPAD_UP:
  direction=View.FOCUS_UP;
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
direction=View.FOCUS_DOWN;
break;
}
if (direction != 0) {
View focused=mView != null ? mView.findFocus() : null;
if (focused != null) {
View v=focused.focusSearch(direction);
boolean focusPassed=false;
if (v != null && v != focused) {
focused.getFocusedRect(mTempRect);
if (mView instanceof ViewGroup) {
((ViewGroup)mView).offsetDescendantRectToMyCoords(focused,mTempRect);
((ViewGroup)mView).offsetRectIntoDescendantCoords(v,mTempRect);
}
focusPassed=v.requestFocus(direction,mTempRect);
}
if (!focusPassed) {
mView.dispatchUnhandledMove(focused,direction);
}
 else {
playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction));
}
}
}
}
}
}
  finally {
if (sendDone) {
finishKeyEvent(event);
}
}
}
Program: 41470
Project: 41470
Buggy source:
/** 
 * unregister phone from CallManager
 * @param phone
 */
public void unregisterPhone(Phone phone){
  if (phone != null && !mPhones.contains(phone)) {
    mPhones.remove(phone);
    mRingingCalls.remove(phone.getRingingCall());
    mBackgroundCalls.remove(phone.getBackgroundCall());
    mForegroundCalls.remove(phone.getForegroundCall());
    unregisterForPhoneStates(phone);
    if (phone == mDefaultPhone) {
      if (mPhones.isEmpty()) {
        mDefaultPhone=null;
      }
 else {
        mDefaultPhone=mPhones.get(0);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * unregister phone from CallManager
 * @param phone
 */
public void unregisterPhone(Phone phone){
  if (phone != null && mPhones.contains(phone)) {
    mPhones.remove(phone);
    mRingingCalls.remove(phone.getRingingCall());
    mBackgroundCalls.remove(phone.getBackgroundCall());
    mForegroundCalls.remove(phone.getForegroundCall());
    unregisterForPhoneStates(phone);
    if (phone == mDefaultPhone) {
      if (mPhones.isEmpty()) {
        mDefaultPhone=null;
      }
 else {
        mDefaultPhone=mPhones.get(0);
      }
    }
  }
}
Program: 41471
Project: 41471
Buggy source:
/** 
 * MotionEvent has no getRawX(int) method; simulate it pending future API approval. 
 */
private static float getRawX(MotionEvent event,int pointerIndex){
  float offset=event.getX() - event.getRawX();
  return event.getX(pointerIndex) + offset;
}

Fixed version (ground truth):
/** 
 * MotionEvent has no getRawX(int) method; simulate it pending future API approval. 
 */
private static float getRawX(MotionEvent event,int pointerIndex){
  float offset=event.getRawX() - event.getX();
  return event.getX(pointerIndex) + offset;
}
Program: 41472
Project: 41472
Buggy source:
/** 
 * MotionEvent has no getRawY(int) method; simulate it pending future API approval. 
 */
private static float getRawY(MotionEvent event,int pointerIndex){
  float offset=event.getY() - event.getRawY();
  return event.getY(pointerIndex) + offset;
}

Fixed version (ground truth):
/** 
 * MotionEvent has no getRawY(int) method; simulate it pending future API approval. 
 */
private static float getRawY(MotionEvent event,int pointerIndex){
  float offset=event.getRawY() - event.getY();
  return event.getY(pointerIndex) + offset;
}
Program: 41473
Project: 41473
Buggy source:
/** 
 * MotionEvent has no getRawX(int) method; simulate it pending future API approval. 
 */
private static float getRawX(MotionEvent event,int pointerIndex){
  float offset=event.getX() - event.getRawX();
  return event.getX(pointerIndex) + offset;
}

Fixed version (ground truth):
/** 
 * MotionEvent has no getRawX(int) method; simulate it pending future API approval. 
 */
private static float getRawX(MotionEvent event,int pointerIndex){
  float offset=event.getRawX() - event.getX();
  return event.getX(pointerIndex) + offset;
}
Program: 41474
Project: 41474
Buggy source:
/** 
 * MotionEvent has no getRawY(int) method; simulate it pending future API approval. 
 */
private static float getRawY(MotionEvent event,int pointerIndex){
  float offset=event.getY() - event.getRawY();
  return event.getY(pointerIndex) + offset;
}

Fixed version (ground truth):
/** 
 * MotionEvent has no getRawY(int) method; simulate it pending future API approval. 
 */
private static float getRawY(MotionEvent event,int pointerIndex){
  float offset=event.getRawY() - event.getY();
  return event.getY(pointerIndex) + offset;
}
Program: 41475
Project: 41475
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  String action=intent.getAction();
  if (!Intent.ACTION_MEDIA_BUTTON.equals(action)) {
    return;
  }
  KeyEvent event=(KeyEvent)intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
  if (event != null) {
    if ((getMode() == AudioSystem.MODE_IN_CALL) || (getMode() == AudioSystem.MODE_RINGTONE)) {
      return;
    }
synchronized (mRCStack) {
      if (!mRCStack.empty()) {
        Intent targetedIntent=new Intent(Intent.ACTION_MEDIA_BUTTON);
        targetedIntent.putExtras(intent.getExtras());
        targetedIntent.setComponent(mRCStack.peek().mReceiverComponent);
        abortBroadcast();
        context.sendBroadcast(targetedIntent,null);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  String action=intent.getAction();
  if (!Intent.ACTION_MEDIA_BUTTON.equals(action)) {
    return;
  }
  KeyEvent event=(KeyEvent)intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
  if (event != null) {
synchronized (mRingingLock) {
      if (mIsRinging || (getMode() == AudioSystem.MODE_IN_CALL) || (getMode() == AudioSystem.MODE_RINGTONE)) {
        return;
      }
    }
synchronized (mRCStack) {
      if (!mRCStack.empty()) {
        Intent targetedIntent=new Intent(Intent.ACTION_MEDIA_BUTTON);
        targetedIntent.putExtras(intent.getExtras());
        targetedIntent.setComponent(mRCStack.peek().mReceiverComponent);
        abortBroadcast();
        context.sendBroadcast(targetedIntent,null);
      }
    }
  }
}
Program: 41476
Project: 41476
Buggy source:
@Override public void onCallStateChanged(int state,String incomingNumber){
  if (state == TelephonyManager.CALL_STATE_RINGING) {
    int ringVolume=AudioService.this.getStreamVolume(AudioManager.STREAM_RING);
    if (ringVolume > 0) {
      requestAudioFocus(AudioManager.STREAM_RING,AudioManager.AUDIOFOCUS_GAIN_TRANSIENT,null,null,IN_VOICE_COMM_FOCUS_ID);
    }
  }
 else   if (state == TelephonyManager.CALL_STATE_OFFHOOK) {
    requestAudioFocus(AudioManager.STREAM_RING,AudioManager.AUDIOFOCUS_GAIN_TRANSIENT,null,null,IN_VOICE_COMM_FOCUS_ID);
  }
 else   if (state == TelephonyManager.CALL_STATE_IDLE) {
    abandonAudioFocus(null,IN_VOICE_COMM_FOCUS_ID);
  }
}

Fixed version (ground truth):
@Override public void onCallStateChanged(int state,String incomingNumber){
  if (state == TelephonyManager.CALL_STATE_RINGING) {
synchronized (mRingingLock) {
      mIsRinging=true;
    }
    int ringVolume=AudioService.this.getStreamVolume(AudioManager.STREAM_RING);
    if (ringVolume > 0) {
      requestAudioFocus(AudioManager.STREAM_RING,AudioManager.AUDIOFOCUS_GAIN_TRANSIENT,null,null,IN_VOICE_COMM_FOCUS_ID);
    }
  }
 else   if (state == TelephonyManager.CALL_STATE_OFFHOOK) {
synchronized (mRingingLock) {
      mIsRinging=false;
    }
    requestAudioFocus(AudioManager.STREAM_RING,AudioManager.AUDIOFOCUS_GAIN_TRANSIENT,null,null,IN_VOICE_COMM_FOCUS_ID);
  }
 else   if (state == TelephonyManager.CALL_STATE_IDLE) {
synchronized (mRingingLock) {
      mIsRinging=false;
    }
    abandonAudioFocus(null,IN_VOICE_COMM_FOCUS_ID);
  }
}
Program: 41477
Project: 41477
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  String action=intent.getAction();
  if (!Intent.ACTION_MEDIA_BUTTON.equals(action)) {
    return;
  }
  KeyEvent event=(KeyEvent)intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
  if (event != null) {
    if ((getMode() == AudioSystem.MODE_IN_CALL) || (getMode() == AudioSystem.MODE_RINGTONE)) {
      return;
    }
synchronized (mRCStack) {
      if (!mRCStack.empty()) {
        Intent targetedIntent=new Intent(Intent.ACTION_MEDIA_BUTTON);
        targetedIntent.putExtras(intent.getExtras());
        targetedIntent.setComponent(mRCStack.peek().mReceiverComponent);
        abortBroadcast();
        context.sendBroadcast(targetedIntent,null);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  String action=intent.getAction();
  if (!Intent.ACTION_MEDIA_BUTTON.equals(action)) {
    return;
  }
  KeyEvent event=(KeyEvent)intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
  if (event != null) {
synchronized (mRingingLock) {
      if (mIsRinging || (getMode() == AudioSystem.MODE_IN_CALL) || (getMode() == AudioSystem.MODE_RINGTONE)) {
        return;
      }
    }
synchronized (mRCStack) {
      if (!mRCStack.empty()) {
        Intent targetedIntent=new Intent(Intent.ACTION_MEDIA_BUTTON);
        targetedIntent.putExtras(intent.getExtras());
        targetedIntent.setComponent(mRCStack.peek().mReceiverComponent);
        abortBroadcast();
        context.sendBroadcast(targetedIntent,null);
      }
    }
  }
}
Program: 41478
Project: 41478
Buggy source:
@Override public void onCallStateChanged(int state,String incomingNumber){
  if (state == TelephonyManager.CALL_STATE_RINGING) {
    int ringVolume=AudioService.this.getStreamVolume(AudioManager.STREAM_RING);
    if (ringVolume > 0) {
      requestAudioFocus(AudioManager.STREAM_RING,AudioManager.AUDIOFOCUS_GAIN_TRANSIENT,null,null,IN_VOICE_COMM_FOCUS_ID);
    }
  }
 else   if (state == TelephonyManager.CALL_STATE_OFFHOOK) {
    requestAudioFocus(AudioManager.STREAM_RING,AudioManager.AUDIOFOCUS_GAIN_TRANSIENT,null,null,IN_VOICE_COMM_FOCUS_ID);
  }
 else   if (state == TelephonyManager.CALL_STATE_IDLE) {
    abandonAudioFocus(null,IN_VOICE_COMM_FOCUS_ID);
  }
}

Fixed version (ground truth):
@Override public void onCallStateChanged(int state,String incomingNumber){
  if (state == TelephonyManager.CALL_STATE_RINGING) {
synchronized (mRingingLock) {
      mIsRinging=true;
    }
    int ringVolume=AudioService.this.getStreamVolume(AudioManager.STREAM_RING);
    if (ringVolume > 0) {
      requestAudioFocus(AudioManager.STREAM_RING,AudioManager.AUDIOFOCUS_GAIN_TRANSIENT,null,null,IN_VOICE_COMM_FOCUS_ID);
    }
  }
 else   if (state == TelephonyManager.CALL_STATE_OFFHOOK) {
synchronized (mRingingLock) {
      mIsRinging=false;
    }
    requestAudioFocus(AudioManager.STREAM_RING,AudioManager.AUDIOFOCUS_GAIN_TRANSIENT,null,null,IN_VOICE_COMM_FOCUS_ID);
  }
 else   if (state == TelephonyManager.CALL_STATE_IDLE) {
synchronized (mRingingLock) {
      mIsRinging=false;
    }
    abandonAudioFocus(null,IN_VOICE_COMM_FOCUS_ID);
  }
}
Program: 41479
Project: 41479
Buggy source:
/** 
 * Call this when you want to know the new location.  If it returns true, the animation is not yet finished.  loc will be altered to provide the new location.
 */
public boolean computeScrollOffset(){
  if (mFinished) {
    return false;
  }
  int timePassed=(int)(AnimationUtils.currentAnimationTimeMillis() - mStartTime);
  if (timePassed < mDuration) {
switch (mMode) {
case SCROLL_MODE:
      float x=(float)timePassed * mDurationReciprocal;
    if (mInterpolator == null)     x=viscousFluid(x);
 else     x=mInterpolator.getInterpolation(x);
  mCurrX=mStartX + Math.round(x * mDeltaX);
mCurrY=mStartY + Math.round(x * mDeltaY);
break;
case FLING_MODE:
float timePassedSeconds=timePassed / 1000.0f;
float distance=(mVelocity * timePassedSeconds) - (mDeceleration * timePassedSeconds * timePassedSeconds / 2.0f);
mCurrX=mStartX + Math.round(distance * mCoeffX);
mCurrX=Math.min(mCurrX,mMaxX);
mCurrX=Math.max(mCurrX,mMinX);
mCurrY=mStartY + Math.round(distance * mCoeffY);
mCurrY=Math.min(mCurrY,mMaxY);
mCurrY=Math.max(mCurrY,mMinY);
break;
}
}
 else {
mCurrX=mFinalX;
mCurrY=mFinalY;
mFinished=true;
}
return true;
}

Fixed version (ground truth):
/** 
 * Call this when you want to know the new location.  If it returns true, the animation is not yet finished.  loc will be altered to provide the new location.
 */
public boolean computeScrollOffset(){
  if (mFinished) {
    return false;
  }
  int timePassed=(int)(AnimationUtils.currentAnimationTimeMillis() - mStartTime);
  if (timePassed < mDuration) {
switch (mMode) {
case SCROLL_MODE:
      float x=(float)timePassed * mDurationReciprocal;
    if (mInterpolator == null)     x=viscousFluid(x);
 else     x=mInterpolator.getInterpolation(x);
  mCurrX=mStartX + Math.round(x * mDeltaX);
mCurrY=mStartY + Math.round(x * mDeltaY);
break;
case FLING_MODE:
float timePassedSeconds=timePassed / 1000.0f;
float distance=(mVelocity * timePassedSeconds) - (mDeceleration * timePassedSeconds * timePassedSeconds / 2.0f);
mCurrX=mStartX + Math.round(distance * mCoeffX);
mCurrX=Math.min(mCurrX,mMaxX);
mCurrX=Math.max(mCurrX,mMinX);
mCurrY=mStartY + Math.round(distance * mCoeffY);
mCurrY=Math.min(mCurrY,mMaxY);
mCurrY=Math.max(mCurrY,mMinY);
if (mCurrX == mFinalX && mCurrY == mFinalY) {
mFinished=true;
}
break;
}
}
 else {
mCurrX=mFinalX;
mCurrY=mFinalY;
mFinished=true;
}
return true;
}
Program: 41480
Project: 41480
Buggy source:
/** 
 * Call this when you want to know the new location.  If it returns true, the animation is not yet finished.  loc will be altered to provide the new location.
 */
public boolean computeScrollOffset(){
  if (mFinished) {
    return false;
  }
  int timePassed=(int)(AnimationUtils.currentAnimationTimeMillis() - mStartTime);
  if (timePassed < mDuration) {
switch (mMode) {
case SCROLL_MODE:
      float x=(float)timePassed * mDurationReciprocal;
    if (mInterpolator == null)     x=viscousFluid(x);
 else     x=mInterpolator.getInterpolation(x);
  mCurrX=mStartX + Math.round(x * mDeltaX);
mCurrY=mStartY + Math.round(x * mDeltaY);
break;
case FLING_MODE:
float timePassedSeconds=timePassed / 1000.0f;
float distance=(mVelocity * timePassedSeconds) - (mDeceleration * timePassedSeconds * timePassedSeconds / 2.0f);
mCurrX=mStartX + Math.round(distance * mCoeffX);
mCurrX=Math.min(mCurrX,mMaxX);
mCurrX=Math.max(mCurrX,mMinX);
mCurrY=mStartY + Math.round(distance * mCoeffY);
mCurrY=Math.min(mCurrY,mMaxY);
mCurrY=Math.max(mCurrY,mMinY);
break;
}
}
 else {
mCurrX=mFinalX;
mCurrY=mFinalY;
mFinished=true;
}
return true;
}

Fixed version (ground truth):
/** 
 * Call this when you want to know the new location.  If it returns true, the animation is not yet finished.  loc will be altered to provide the new location.
 */
public boolean computeScrollOffset(){
  if (mFinished) {
    return false;
  }
  int timePassed=(int)(AnimationUtils.currentAnimationTimeMillis() - mStartTime);
  if (timePassed < mDuration) {
switch (mMode) {
case SCROLL_MODE:
      float x=(float)timePassed * mDurationReciprocal;
    if (mInterpolator == null)     x=viscousFluid(x);
 else     x=mInterpolator.getInterpolation(x);
  mCurrX=mStartX + Math.round(x * mDeltaX);
mCurrY=mStartY + Math.round(x * mDeltaY);
break;
case FLING_MODE:
float timePassedSeconds=timePassed / 1000.0f;
float distance=(mVelocity * timePassedSeconds) - (mDeceleration * timePassedSeconds * timePassedSeconds / 2.0f);
mCurrX=mStartX + Math.round(distance * mCoeffX);
mCurrX=Math.min(mCurrX,mMaxX);
mCurrX=Math.max(mCurrX,mMinX);
mCurrY=mStartY + Math.round(distance * mCoeffY);
mCurrY=Math.min(mCurrY,mMaxY);
mCurrY=Math.max(mCurrY,mMinY);
if (mCurrX == mFinalX && mCurrY == mFinalY) {
mFinished=true;
}
break;
}
}
 else {
mCurrX=mFinalX;
mCurrY=mFinalY;
mFinished=true;
}
return true;
}