nus-yam/ex-repair huggingface dataset:
Program: 181494
Project: 181494
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: 181495
Project: 181495
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: 181496
Project: 181496
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: 181497
Project: 181497
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: 181499
Project: 181499
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: 181500
Project: 181500
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: 181501
Project: 181501
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: 181502
Project: 181502
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: 181503
Project: 181503
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: 181504
Project: 181504
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: 181505
Project: 181505
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: 181506
Project: 181506
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: 181507
Project: 181507
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: 181508
Project: 181508
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: 181509
Project: 181509
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: 181510
Project: 181510
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: 181512
Project: 181512
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: 181513
Project: 181513
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: 181514
Project: 181514
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: 181515
Project: 181515
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: 181516
Project: 181516
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: 181517
Project: 181517
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: 181519
Project: 181519
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: 181520
Project: 181520
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: 181521
Project: 181521
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: 181522
Project: 181522
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: 181523
Project: 181523
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: 181524
Project: 181524
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: 181525
Project: 181525
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: 181526
Project: 181526
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: 181527
Project: 181527
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: 181528
Project: 181528
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: 181529
Project: 181529
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: 181530
Project: 181530
Buggy source:
@SuppressWarnings("String_Node_Str") private static void dispatchMotionEvent(InputHandler inputHandler,MotionEvent event,long finishedToken){
  Runnable finishedCallback=new FinishedCallback(finishedToken);
  inputHandler.handleMotion(event,finishedCallback);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private static void dispatchMotionEvent(InputHandler inputHandler,MotionEvent event,long finishedToken){
  Runnable finishedCallback=FinishedCallback.obtain(finishedToken);
  inputHandler.handleMotion(event,finishedCallback);
}
Program: 181531
Project: 181531
Buggy source:
@SuppressWarnings("String_Node_Str") private static void dispatchKeyEvent(InputHandler inputHandler,KeyEvent event,long finishedToken){
  Runnable finishedCallback=new FinishedCallback(finishedToken);
  inputHandler.handleKey(event,finishedCallback);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private static void dispatchKeyEvent(InputHandler inputHandler,KeyEvent event,long finishedToken){
  Runnable finishedCallback=FinishedCallback.obtain(finishedToken);
  inputHandler.handleKey(event,finishedCallback);
}
Program: 181532
Project: 181532
Buggy source:
public void run(){
synchronized (sLock) {
    nativeFinished(mFinishedToken);
  }
}

Fixed version (ground truth):
public void run(){
synchronized (sLock) {
    if (mFinishedToken == -1) {
      throw new IllegalStateException("String_Node_Str");
    }
    nativeFinished(mFinishedToken);
    mFinishedToken=-1;
    if (sRecycleCount < RECYCLE_MAX_COUNT) {
      mRecycleNext=sRecycleHead;
      sRecycleHead=this;
      sRecycleCount+=1;
      if (DEBUG_RECYCLING) {
        Slog.d(TAG,"String_Node_Str" + sRecycleCount);
      }
    }
  }
}
Program: 181533
Project: 181533
Buggy source:
public FinishedCallback(long finishedToken){
  mFinishedToken=finishedToken;
}

Fixed version (ground truth):
private FinishedCallback(){
}
Program: 181535
Project: 181535
Buggy source:
@SuppressWarnings("String_Node_Str") private static void dispatchMotionEvent(InputHandler inputHandler,MotionEvent event,long finishedToken){
  Runnable finishedCallback=new FinishedCallback(finishedToken);
  inputHandler.handleMotion(event,finishedCallback);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private static void dispatchMotionEvent(InputHandler inputHandler,MotionEvent event,long finishedToken){
  Runnable finishedCallback=FinishedCallback.obtain(finishedToken);
  inputHandler.handleMotion(event,finishedCallback);
}
Program: 181536
Project: 181536
Buggy source:
@SuppressWarnings("String_Node_Str") private static void dispatchKeyEvent(InputHandler inputHandler,KeyEvent event,long finishedToken){
  Runnable finishedCallback=new FinishedCallback(finishedToken);
  inputHandler.handleKey(event,finishedCallback);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private static void dispatchKeyEvent(InputHandler inputHandler,KeyEvent event,long finishedToken){
  Runnable finishedCallback=FinishedCallback.obtain(finishedToken);
  inputHandler.handleKey(event,finishedCallback);
}
Program: 181537
Project: 181537
Buggy source:
public void run(){
synchronized (sLock) {
    nativeFinished(mFinishedToken);
  }
}

Fixed version (ground truth):
public void run(){
synchronized (sLock) {
    if (mFinishedToken == -1) {
      throw new IllegalStateException("String_Node_Str");
    }
    nativeFinished(mFinishedToken);
    mFinishedToken=-1;
    if (sRecycleCount < RECYCLE_MAX_COUNT) {
      mRecycleNext=sRecycleHead;
      sRecycleHead=this;
      sRecycleCount+=1;
      if (DEBUG_RECYCLING) {
        Slog.d(TAG,"String_Node_Str" + sRecycleCount);
      }
    }
  }
}
Program: 181538
Project: 181538
Buggy source:
public FinishedCallback(long finishedToken){
  mFinishedToken=finishedToken;
}

Fixed version (ground truth):
private FinishedCallback(){
}