nus-yam/ex-repair huggingface dataset:
Program: 181142
Project: 181142
Buggy source:
public void setJSONObject(JSONObject jsonObject){
  Iterator itr=jsonObject.keys();
  while (itr.hasNext()) {
    try {
      String key=(String)itr.next();
      Object value=jsonObject.opt(key);
      Field field=this.getClass().getField(key);
      Class type=field.getType();
      int fieldModifiers=field.getModifiers();
      if (type.isPrimitive()) {
        if (type.equals(Integer.class)) {
          field.setInt(this,jsonObject.getInt(key));
        }
 else         if (type.equals(Double.class)) {
          field.setDouble(this,jsonObject.getDouble(key));
        }
      }
 else       if (type.isArray() && value instanceof JSONArray) {
        JSONArray jsonArray=(JSONArray)value;
        Object[] values=(Object[])Array.newInstance(type,jsonArray.length());
        for (int j=0; j < jsonArray.length(); j++) {
          Resource resource=(Resource)type.newInstance();
          resource.setJSONObject(jsonArray.getJSONObject(j));
          values[j]=resource;
        }
        field.set(this,values);
      }
 else       if (Resource.class.isAssignableFrom(type) && value instanceof JSONObject) {
        Resource resource=(Resource)type.newInstance();
        resource.setJSONObject((JSONObject)value);
        field.set(this,resource);
      }
 else       if (type.equals(String.class) && value instanceof String) {
        field.set(this,(String)value);
      }
    }
 catch (    Exception nsfe) {
      System.err.println("String_Node_Str" + nsfe.getMessage());
    }
  }
}

Fixed version (ground truth):
public void setJSONObject(JSONObject jsonObject){
  Iterator itr=jsonObject.keys();
  while (itr.hasNext()) {
    String key=(String)itr.next();
    Object value=jsonObject.opt(key);
    try {
      Field field=this.getClass().getField(key);
      Class type=field.getType();
      int fieldModifiers=field.getModifiers();
      if (type.isPrimitive()) {
        if (type.equals(Integer.class)) {
          field.setInt(this,jsonObject.getInt(key));
        }
 else         if (type.equals(Double.class)) {
          field.setDouble(this,jsonObject.getDouble(key));
        }
      }
 else       if (type.isArray() && value instanceof JSONArray) {
        JSONArray jsonArray=(JSONArray)value;
        Object[] values=(Object[])Array.newInstance(type,jsonArray.length());
        for (int j=0; j < jsonArray.length(); j++) {
          Resource resource=(Resource)type.newInstance();
          resource.setJSONObject(jsonArray.getJSONObject(j));
          values[j]=resource;
        }
        field.set(this,values);
      }
 else       if (Resource.class.isAssignableFrom(type) && value instanceof JSONObject) {
        Resource resource=(Resource)type.newInstance();
        resource.setJSONObject((JSONObject)value);
        field.set(this,resource);
      }
 else       if (type.equals(String.class) && value instanceof String) {
        field.set(this,(String)value);
      }
    }
 catch (    Exception nsfe) {
      System.err.println("String_Node_Str" + key + "String_Node_Str"+ value+ "String_Node_Str"+ nsfe.getMessage());
    }
  }
}
Program: 181143
Project: 181143
Buggy source:
public static void main(String[] args) throws IOException, TrafficspacesAPIException {
  args=new String[]{"String_Node_Str","String_Node_Str"};
  if (args == null || args.length != 2) {
    System.out.println("String_Node_Str" + APITest.class.getName() + "String_Node_Str");
    System.exit(-1);
  }
  ConnectorFactory factory=new ConnectorFactory(args[0],args[1]);
  Properties props=null;
  props=new java.util.Properties();
  props.put("String_Node_Str","String_Node_Str");
  props.put("String_Node_Str","String_Node_Str");
  List zones=factory.getZoneConnector().find(props);
  System.out.println("String_Node_Str" + zones.size() + "String_Node_Str");
  List ads=factory.getAdConnector().find(props);
  System.out.println("String_Node_Str" + ads.size() + "String_Node_Str");
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException, TrafficspacesAPIException {
  if (args == null || args.length != 2) {
    System.out.println("String_Node_Str" + APITest.class.getName() + "String_Node_Str");
    System.exit(-1);
  }
  ConnectorFactory factory=new ConnectorFactory(args[0],args[1]);
  Properties props=null;
  props=new java.util.Properties();
  props.put("String_Node_Str","String_Node_Str");
  props.put("String_Node_Str","String_Node_Str");
  List zones=factory.getZoneConnector().find(props);
  System.out.println("String_Node_Str" + zones.size() + "String_Node_Str");
  List ads=factory.getAdConnector().find(props);
  System.out.println("String_Node_Str" + ads.size() + "String_Node_Str");
}
Program: 181144
Project: 181144
Buggy source:
/** 
 * UTILITY FUNCTIONS       
 */
protected String sendRequest(String path,String format,String method,String data) throws IOException, TrafficspacesAPIException {
}

Fixed version (ground truth):
/** 
 * UTILITY FUNCTIONS       
 */
protected String sendRequest(String path,String format,String method,String data) throws IOException, TrafficspacesAPIException {
  URL url=new URL(endPoint.baseURI + path);
  HttpURLConnection httpCon=(HttpURLConnection)url.openConnection();
  httpCon.setDoOutput(true);
  httpCon.setRequestMethod(method.toUpperCase());
  String basicAuth="String_Node_Str" + Base64.encode((endPoint.username + "String_Node_Str" + endPoint.password).getBytes());
  httpCon.setRequestProperty("String_Node_Str",basicAuth);
  String contentType=format.equalsIgnoreCase("String_Node_Str") ? "String_Node_Str" : "String_Node_Str";
  httpCon.setRequestProperty("String_Node_Str",contentType + "String_Node_Str");
  httpCon.setRequestProperty("String_Node_Str",contentType);
  if (method.equalsIgnoreCase("String_Node_Str") || method.equalsIgnoreCase("String_Node_Str")) {
    httpCon.setRequestProperty("String_Node_Str",data.length());
    OutputStreamWriter out=new OutputStreamWriter(httpCon.getOutputStream());
    out.write(data);
    out.close();
  }
 else {
    httpCon.connect();
  }
  String responseData=readResponseData(httpCon.getInputStream());
  int responseCode=httpCon.getResponseCode();
  if (responseCode != HttpURLConnection.HTTP_OK && responseCode != HttpURLConnection.HTTP_CREATED) {
    throw new TrafficspacesAPIException(responseCode,responseData);
  }
  return responseData;
}
Program: 181146
Project: 181146
Buggy source:
private boolean isBatteryUpdateInteresting(int batteryStatus,int batteryLevel){
  final boolean isPluggedIn=isPluggedIn(batteryStatus);
  final boolean wasPluggedIn=isPluggedIn(mBatteryStatus);
  final boolean stateChangedWhilePluggedIn=wasPluggedIn == true && isPluggedIn == true && (mBatteryStatus != batteryStatus);
  if (wasPluggedIn != isPluggedIn || stateChangedWhilePluggedIn) {
    return true;
  }
  if (isPluggedIn && mBatteryLevel != batteryLevel) {
    return true;
  }
  if (!isPluggedIn) {
    if (isBatteryLow(batteryLevel) && batteryLevel != mBatteryLevel) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean isBatteryUpdateInteresting(int batteryStatus,int batteryLevel){
  final boolean isPluggedIn=isPluggedIn(batteryStatus);
  final boolean wasPluggedIn=isPluggedIn(mBatteryStatus);
  final boolean stateChangedWhilePluggedIn=wasPluggedIn == true && isPluggedIn == true && (mBatteryStatus != batteryStatus);
  if (wasPluggedIn != isPluggedIn || stateChangedWhilePluggedIn) {
    return true;
  }
  if (mBatteryLevel != batteryLevel) {
    return true;
  }
  return false;
}
Program: 181147
Project: 181147
Buggy source:
/** 
 * After a change in the connectivity state of any network, We're mainly concerned with making sure that the list of DNS servers is setupup according to which networks are connected, and ensuring that the right routing table entries exist.
 */
private void handleConnectivityChange(int netType){
  handleDnsConfigurationChange(netType);
  if (mNetTrackers[netType].getNetworkInfo().isConnected()) {
    if (mNetAttributes[netType].isDefault()) {
      mNetTrackers[netType].addDefaultRoute();
    }
 else {
      mNetTrackers[netType].addPrivateDnsRoutes();
    }
  }
 else {
    if (mNetAttributes[netType].isDefault()) {
      mNetTrackers[netType].removeDefaultRoute();
    }
 else {
      mNetTrackers[netType].removePrivateDnsRoutes();
    }
  }
}

Fixed version (ground truth):
/** 
 * After a change in the connectivity state of any network, We're mainly concerned with making sure that the list of DNS servers is setupup according to which networks are connected, and ensuring that the right routing table entries exist.
 */
private void handleConnectivityChange(int netType){
  handleDnsConfigurationChange(netType);
  if (mNetTrackers[netType].getNetworkInfo().isConnected()) {
    if (mNetAttributes[netType].isDefault()) {
      mNetTrackers[netType].addDefaultRoute();
    }
 else {
      if (mActiveDefaultNetwork != -1) {
        String defaultIface=mNetTrackers[mActiveDefaultNetwork].getInterfaceName();
        if (defaultIface != null && !defaultIface.equals(mNetTrackers[netType].getInterfaceName())) {
          mNetTrackers[netType].removeDefaultRoute();
        }
      }
      mNetTrackers[netType].addPrivateDnsRoutes();
    }
  }
 else {
    if (mNetAttributes[netType].isDefault()) {
      mNetTrackers[netType].removeDefaultRoute();
    }
 else {
      mNetTrackers[netType].removePrivateDnsRoutes();
    }
  }
}
Program: 181148
Project: 181148
Buggy source:
/** 
 * Return NetworkInfo for the active (i.e., connected) network interface. It is assumed that at most one network is active at a time. If more than one is active, it is indeterminate which will be returned.
 * @return the info for the active network, or {@code null} if none isactive
 */
public NetworkInfo getActiveNetworkInfo(){
  enforceAccessPermission();
  for (int type=0; type <= ConnectivityManager.MAX_NETWORK_TYPE; type++) {
    if (mNetAttributes[type] == null || !mNetAttributes[type].isDefault()) {
      continue;
    }
    NetworkStateTracker t=mNetTrackers[type];
    NetworkInfo info=t.getNetworkInfo();
    if (info.isConnected()) {
      if (DBG && type != mActiveDefaultNetwork)       Slog.e(TAG,"String_Node_Str" + "String_Node_Str");
      return info;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Return NetworkInfo for the active (i.e., connected) network interface. It is assumed that at most one network is active at a time. If more than one is active, it is indeterminate which will be returned.
 * @return the info for the active network, or {@code null} if none isactive
 */
public NetworkInfo getActiveNetworkInfo(){
  enforceAccessPermission();
  if (mActiveDefaultNetwork != -1) {
    return mNetTrackers[mActiveDefaultNetwork].getNetworkInfo();
  }
  return null;
}
Program: 181149
Project: 181149
Buggy source:
/** 
 * After a change in the connectivity state of any network, We're mainly concerned with making sure that the list of DNS servers is setupup according to which networks are connected, and ensuring that the right routing table entries exist.
 */
private void handleConnectivityChange(int netType){
  handleDnsConfigurationChange(netType);
  if (mNetTrackers[netType].getNetworkInfo().isConnected()) {
    if (mNetAttributes[netType].isDefault()) {
      mNetTrackers[netType].addDefaultRoute();
    }
 else {
      mNetTrackers[netType].addPrivateDnsRoutes();
    }
  }
 else {
    if (mNetAttributes[netType].isDefault()) {
      mNetTrackers[netType].removeDefaultRoute();
    }
 else {
      mNetTrackers[netType].removePrivateDnsRoutes();
    }
  }
}

Fixed version (ground truth):
/** 
 * After a change in the connectivity state of any network, We're mainly concerned with making sure that the list of DNS servers is setupup according to which networks are connected, and ensuring that the right routing table entries exist.
 */
private void handleConnectivityChange(int netType){
  handleDnsConfigurationChange(netType);
  if (mNetTrackers[netType].getNetworkInfo().isConnected()) {
    if (mNetAttributes[netType].isDefault()) {
      mNetTrackers[netType].addDefaultRoute();
    }
 else {
      if (mActiveDefaultNetwork != -1) {
        String defaultIface=mNetTrackers[mActiveDefaultNetwork].getInterfaceName();
        if (defaultIface != null && !defaultIface.equals(mNetTrackers[netType].getInterfaceName())) {
          mNetTrackers[netType].removeDefaultRoute();
        }
      }
      mNetTrackers[netType].addPrivateDnsRoutes();
    }
  }
 else {
    if (mNetAttributes[netType].isDefault()) {
      mNetTrackers[netType].removeDefaultRoute();
    }
 else {
      mNetTrackers[netType].removePrivateDnsRoutes();
    }
  }
}
Program: 181150
Project: 181150
Buggy source:
/** 
 * Return NetworkInfo for the active (i.e., connected) network interface. It is assumed that at most one network is active at a time. If more than one is active, it is indeterminate which will be returned.
 * @return the info for the active network, or {@code null} if none isactive
 */
public NetworkInfo getActiveNetworkInfo(){
  enforceAccessPermission();
  for (int type=0; type <= ConnectivityManager.MAX_NETWORK_TYPE; type++) {
    if (mNetAttributes[type] == null || !mNetAttributes[type].isDefault()) {
      continue;
    }
    NetworkStateTracker t=mNetTrackers[type];
    NetworkInfo info=t.getNetworkInfo();
    if (info.isConnected()) {
      if (DBG && type != mActiveDefaultNetwork)       Slog.e(TAG,"String_Node_Str" + "String_Node_Str");
      return info;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Return NetworkInfo for the active (i.e., connected) network interface. It is assumed that at most one network is active at a time. If more than one is active, it is indeterminate which will be returned.
 * @return the info for the active network, or {@code null} if none isactive
 */
public NetworkInfo getActiveNetworkInfo(){
  enforceAccessPermission();
  if (mActiveDefaultNetwork != -1) {
    return mNetTrackers[mActiveDefaultNetwork].getNetworkInfo();
  }
  return null;
}
Program: 181155
Project: 181155
Buggy source:
/** 
 * {@inheritDoc} 
 */
protected void sendMultipartText(String destinationAddress,String scAddress,ArrayList<String> parts,ArrayList<PendingIntent> sentIntents,ArrayList<PendingIntent> deliveryIntents){
  int refNumber=getNextConcatenatedRef() & 0x00FF;
  int msgCount=parts.size();
  int encoding=android.telephony.SmsMessage.ENCODING_UNKNOWN;
  for (int i=0; i < msgCount; i++) {
    TextEncodingDetails details=SmsMessage.calculateLength(parts.get(i),false);
    if (encoding != details.codeUnitSize && (encoding == android.telephony.SmsMessage.ENCODING_UNKNOWN || encoding == android.telephony.SmsMessage.ENCODING_7BIT)) {
      encoding=details.codeUnitSize;
    }
  }
  for (int i=0; i < msgCount; i++) {
    SmsHeader.ConcatRef concatRef=new SmsHeader.ConcatRef();
    concatRef.refNumber=refNumber;
    concatRef.seqNumber=i + 1;
    concatRef.msgCount=msgCount;
    concatRef.isEightBits=true;
    SmsHeader smsHeader=new SmsHeader();
    smsHeader.concatRef=concatRef;
    PendingIntent sentIntent=null;
    if (sentIntents != null && sentIntents.size() > i) {
      sentIntent=sentIntents.get(i);
    }
    PendingIntent deliveryIntent=null;
    if (deliveryIntents != null && deliveryIntents.size() > i) {
      deliveryIntent=deliveryIntents.get(i);
    }
    SmsMessage.SubmitPdu pdus=SmsMessage.getSubmitPdu(scAddress,destinationAddress,parts.get(i),deliveryIntent != null,SmsHeader.toByteArray(smsHeader),encoding);
    sendRawPdu(pdus.encodedScAddress,pdus.encodedMessage,sentIntent,deliveryIntent);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
protected void sendMultipartText(String destinationAddress,String scAddress,ArrayList<String> parts,ArrayList<PendingIntent> sentIntents,ArrayList<PendingIntent> deliveryIntents){
  int refNumber=getNextConcatenatedRef() & 0x00FF;
  int msgCount=parts.size();
  int encoding=android.telephony.SmsMessage.ENCODING_UNKNOWN;
  mRemainingMessages=msgCount;
  for (int i=0; i < msgCount; i++) {
    TextEncodingDetails details=SmsMessage.calculateLength(parts.get(i),false);
    if (encoding != details.codeUnitSize && (encoding == android.telephony.SmsMessage.ENCODING_UNKNOWN || encoding == android.telephony.SmsMessage.ENCODING_7BIT)) {
      encoding=details.codeUnitSize;
    }
  }
  for (int i=0; i < msgCount; i++) {
    SmsHeader.ConcatRef concatRef=new SmsHeader.ConcatRef();
    concatRef.refNumber=refNumber;
    concatRef.seqNumber=i + 1;
    concatRef.msgCount=msgCount;
    concatRef.isEightBits=true;
    SmsHeader smsHeader=new SmsHeader();
    smsHeader.concatRef=concatRef;
    PendingIntent sentIntent=null;
    if (sentIntents != null && sentIntents.size() > i) {
      sentIntent=sentIntents.get(i);
    }
    PendingIntent deliveryIntent=null;
    if (deliveryIntents != null && deliveryIntents.size() > i) {
      deliveryIntent=deliveryIntents.get(i);
    }
    SmsMessage.SubmitPdu pdus=SmsMessage.getSubmitPdu(scAddress,destinationAddress,parts.get(i),deliveryIntent != null,SmsHeader.toByteArray(smsHeader),encoding);
    sendRawPdu(pdus.encodedScAddress,pdus.encodedMessage,sentIntent,deliveryIntent);
  }
}
Program: 181158
Project: 181158
Buggy source:
/** 
 * {@inheritDoc} 
 */
protected void sendMultipartText(String destinationAddress,String scAddress,ArrayList<String> parts,ArrayList<PendingIntent> sentIntents,ArrayList<PendingIntent> deliveryIntents){
  int refNumber=getNextConcatenatedRef() & 0x00FF;
  int msgCount=parts.size();
  int encoding=android.telephony.SmsMessage.ENCODING_UNKNOWN;
  for (int i=0; i < msgCount; i++) {
    TextEncodingDetails details=SmsMessage.calculateLength(parts.get(i),false);
    if (encoding != details.codeUnitSize && (encoding == android.telephony.SmsMessage.ENCODING_UNKNOWN || encoding == android.telephony.SmsMessage.ENCODING_7BIT)) {
      encoding=details.codeUnitSize;
    }
  }
  for (int i=0; i < msgCount; i++) {
    SmsHeader.ConcatRef concatRef=new SmsHeader.ConcatRef();
    concatRef.refNumber=refNumber;
    concatRef.seqNumber=i + 1;
    concatRef.msgCount=msgCount;
    concatRef.isEightBits=true;
    SmsHeader smsHeader=new SmsHeader();
    smsHeader.concatRef=concatRef;
    PendingIntent sentIntent=null;
    if (sentIntents != null && sentIntents.size() > i) {
      sentIntent=sentIntents.get(i);
    }
    PendingIntent deliveryIntent=null;
    if (deliveryIntents != null && deliveryIntents.size() > i) {
      deliveryIntent=deliveryIntents.get(i);
    }
    SmsMessage.SubmitPdu pdus=SmsMessage.getSubmitPdu(scAddress,destinationAddress,parts.get(i),deliveryIntent != null,SmsHeader.toByteArray(smsHeader),encoding);
    sendRawPdu(pdus.encodedScAddress,pdus.encodedMessage,sentIntent,deliveryIntent);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
protected void sendMultipartText(String destinationAddress,String scAddress,ArrayList<String> parts,ArrayList<PendingIntent> sentIntents,ArrayList<PendingIntent> deliveryIntents){
  int refNumber=getNextConcatenatedRef() & 0x00FF;
  int msgCount=parts.size();
  int encoding=android.telephony.SmsMessage.ENCODING_UNKNOWN;
  mRemainingMessages=msgCount;
  for (int i=0; i < msgCount; i++) {
    TextEncodingDetails details=SmsMessage.calculateLength(parts.get(i),false);
    if (encoding != details.codeUnitSize && (encoding == android.telephony.SmsMessage.ENCODING_UNKNOWN || encoding == android.telephony.SmsMessage.ENCODING_7BIT)) {
      encoding=details.codeUnitSize;
    }
  }
  for (int i=0; i < msgCount; i++) {
    SmsHeader.ConcatRef concatRef=new SmsHeader.ConcatRef();
    concatRef.refNumber=refNumber;
    concatRef.seqNumber=i + 1;
    concatRef.msgCount=msgCount;
    concatRef.isEightBits=true;
    SmsHeader smsHeader=new SmsHeader();
    smsHeader.concatRef=concatRef;
    PendingIntent sentIntent=null;
    if (sentIntents != null && sentIntents.size() > i) {
      sentIntent=sentIntents.get(i);
    }
    PendingIntent deliveryIntent=null;
    if (deliveryIntents != null && deliveryIntents.size() > i) {
      deliveryIntent=deliveryIntents.get(i);
    }
    SmsMessage.SubmitPdu pdus=SmsMessage.getSubmitPdu(scAddress,destinationAddress,parts.get(i),deliveryIntent != null,SmsHeader.toByteArray(smsHeader),encoding);
    sendRawPdu(pdus.encodedScAddress,pdus.encodedMessage,sentIntent,deliveryIntent);
  }
}
Program: 181159
Project: 181159
Buggy source:
/** 
 * Called when a status report is received.  This should correspond to a previously successful SEND.
 * @param ar AsyncResult passed into the message handler.  ar.result shouldbe a String representing the status report PDU, as ASCII hex.
 */
protected void handleStatusReport(AsyncResult ar){
  String pduString=(String)ar.result;
  SmsMessage sms=SmsMessage.newFromCDS(pduString);
  if (sms != null) {
    int messageRef=sms.messageRef;
    for (int i=0, count=deliveryPendingList.size(); i < count; i++) {
      SmsTracker tracker=deliveryPendingList.get(i);
      if (tracker.mMessageRef == messageRef) {
        deliveryPendingList.remove(i);
        PendingIntent intent=tracker.mDeliveryIntent;
        Intent fillIn=new Intent();
        fillIn.putExtra("String_Node_Str",IccUtils.hexStringToBytes(pduString));
        try {
          intent.send(mContext,Activity.RESULT_OK,fillIn);
        }
 catch (        CanceledException ex) {
        }
        break;
      }
    }
  }
  acknowledgeLastIncomingSms(true,Intents.RESULT_SMS_HANDLED,null);
}

Fixed version (ground truth):
/** 
 * Called when a status report is received.  This should correspond to a previously successful SEND.
 * @param ar AsyncResult passed into the message handler.  ar.result shouldbe a String representing the status report PDU, as ASCII hex.
 */
protected void handleStatusReport(AsyncResult ar){
  String pduString=(String)ar.result;
  SmsMessage sms=SmsMessage.newFromCDS(pduString);
  int tpStatus=sms.getStatus();
  if (sms != null) {
    int messageRef=sms.messageRef;
    for (int i=0, count=deliveryPendingList.size(); i < count; i++) {
      SmsTracker tracker=deliveryPendingList.get(i);
      if (tracker.mMessageRef == messageRef) {
        if (tpStatus >= Sms.STATUS_FAILED || tpStatus < Sms.STATUS_PENDING) {
          deliveryPendingList.remove(i);
        }
        PendingIntent intent=tracker.mDeliveryIntent;
        Intent fillIn=new Intent();
        fillIn.putExtra("String_Node_Str",IccUtils.hexStringToBytes(pduString));
        try {
          intent.send(mContext,Activity.RESULT_OK,fillIn);
        }
 catch (        CanceledException ex) {
        }
        break;
      }
    }
  }
  acknowledgeLastIncomingSms(true,Intents.RESULT_SMS_HANDLED,null);
}
Program: 181160
Project: 181160
Buggy source:
@Override public void onDetached(){
  removeCallbacks(mHider);
}

Fixed version (ground truth):
@Override public void onDetached(){
}
Program: 181161
Project: 181161
Buggy source:
/** 
 * Called when a status report is received.  This should correspond to a previously successful SEND.
 * @param ar AsyncResult passed into the message handler.  ar.result shouldbe a String representing the status report PDU, as ASCII hex.
 */
protected void handleStatusReport(AsyncResult ar){
  String pduString=(String)ar.result;
  SmsMessage sms=SmsMessage.newFromCDS(pduString);
  if (sms != null) {
    int messageRef=sms.messageRef;
    for (int i=0, count=deliveryPendingList.size(); i < count; i++) {
      SmsTracker tracker=deliveryPendingList.get(i);
      if (tracker.mMessageRef == messageRef) {
        deliveryPendingList.remove(i);
        PendingIntent intent=tracker.mDeliveryIntent;
        Intent fillIn=new Intent();
        fillIn.putExtra("String_Node_Str",IccUtils.hexStringToBytes(pduString));
        try {
          intent.send(mContext,Activity.RESULT_OK,fillIn);
        }
 catch (        CanceledException ex) {
        }
        break;
      }
    }
  }
  acknowledgeLastIncomingSms(true,Intents.RESULT_SMS_HANDLED,null);
}

Fixed version (ground truth):
/** 
 * Called when a status report is received.  This should correspond to a previously successful SEND.
 * @param ar AsyncResult passed into the message handler.  ar.result shouldbe a String representing the status report PDU, as ASCII hex.
 */
protected void handleStatusReport(AsyncResult ar){
  String pduString=(String)ar.result;
  SmsMessage sms=SmsMessage.newFromCDS(pduString);
  int tpStatus=sms.getStatus();
  if (sms != null) {
    int messageRef=sms.messageRef;
    for (int i=0, count=deliveryPendingList.size(); i < count; i++) {
      SmsTracker tracker=deliveryPendingList.get(i);
      if (tracker.mMessageRef == messageRef) {
        if (tpStatus >= Sms.STATUS_FAILED || tpStatus < Sms.STATUS_PENDING) {
          deliveryPendingList.remove(i);
        }
        PendingIntent intent=tracker.mDeliveryIntent;
        Intent fillIn=new Intent();
        fillIn.putExtra("String_Node_Str",IccUtils.hexStringToBytes(pduString));
        try {
          intent.send(mContext,Activity.RESULT_OK,fillIn);
        }
 catch (        CanceledException ex) {
        }
        break;
      }
    }
  }
  acknowledgeLastIncomingSms(true,Intents.RESULT_SMS_HANDLED,null);
}
Program: 181162
Project: 181162
Buggy source:
public static ApplicationInfo generateApplicationInfo(Package p,int flags){
  if (p == null)   return null;
  if (!copyNeeded(flags,p,null)) {
    if (!sCompatibilityModeEnabled) {
      p.applicationInfo.disableCompatibilityMode();
    }
    return p.applicationInfo;
  }
  ApplicationInfo ai=new ApplicationInfo(p.applicationInfo);
  if ((flags & PackageManager.GET_META_DATA) != 0) {
    ai.metaData=p.mAppMetaData;
  }
  if ((flags & PackageManager.GET_SHARED_LIBRARY_FILES) != 0) {
    ai.sharedLibraryFiles=p.usesLibraryFiles;
  }
  if (!sCompatibilityModeEnabled) {
    ai.disableCompatibilityMode();
  }
  ai.enabled=p.mSetEnabled == PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
  return ai;
}

Fixed version (ground truth):
public static ApplicationInfo generateApplicationInfo(Package p,int flags){
  if (p == null)   return null;
  if (!copyNeeded(flags,p,null)) {
    if (!sCompatibilityModeEnabled) {
      p.applicationInfo.disableCompatibilityMode();
    }
    return p.applicationInfo;
  }
  ApplicationInfo ai=new ApplicationInfo(p.applicationInfo);
  if ((flags & PackageManager.GET_META_DATA) != 0) {
    ai.metaData=p.mAppMetaData;
  }
  if ((flags & PackageManager.GET_SHARED_LIBRARY_FILES) != 0) {
    ai.sharedLibraryFiles=p.usesLibraryFiles;
  }
  if (!sCompatibilityModeEnabled) {
    ai.disableCompatibilityMode();
  }
  if (p.mSetEnabled == PackageManager.COMPONENT_ENABLED_STATE_ENABLED) {
    ai.enabled=true;
  }
 else   if (p.mSetEnabled == PackageManager.COMPONENT_ENABLED_STATE_DISABLED) {
    ai.enabled=false;
  }
  return ai;
}
Program: 181165
Project: 181165
Buggy source:
PackageSetting(String name,String realName,File codePath,File resourcePath,String nativeLibraryPathString,int pVersionCode,int pkgFlags){
  super(name,realName,codePath,resourcePath,nativeLibraryPathString,pVersionCode,pkgFlags);
}

Fixed version (ground truth):
PackageSetting(PackageSetting orig){
  super(orig.name,orig.realName,orig.codePath,orig.resourcePath,orig.nativeLibraryPathString,orig.versionCode,orig.pkgFlags);
  copyFrom(orig);
}
Program: 181167
Project: 181167
Buggy source:
private boolean deleteSystemPackageLI(PackageParser.Package p,int flags,PackageRemovedInfo outInfo,boolean writeSettings){
  ApplicationInfo applicationInfo=p.applicationInfo;
  if (applicationInfo == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName + "String_Node_Str");
    return false;
  }
  PackageSetting ps=null;
synchronized (mPackages) {
    ps=mSettings.getDisabledSystemPkg(p.packageName);
  }
  if (ps == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName);
    return false;
  }
 else {
    Log.i(TAG,"String_Node_Str");
  }
  outInfo.isRemovedPackageSystemUpdate=true;
  final boolean deleteCodeAndResources;
  if (ps.versionCode < p.mVersionCode) {
    deleteCodeAndResources=true;
    flags&=~PackageManager.DONT_DELETE_DATA;
  }
 else {
    deleteCodeAndResources=false;
    flags|=PackageManager.DONT_DELETE_DATA;
  }
  boolean ret=deleteInstalledPackageLI(p,deleteCodeAndResources,flags,outInfo,writeSettings);
  if (!ret) {
    return false;
  }
synchronized (mPackages) {
    mSettings.enableSystemPackageLP(p.packageName);
    NativeLibraryHelper.removeNativeBinariesLI(p.applicationInfo.nativeLibraryDir);
  }
  PackageParser.Package newPkg=scanPackageLI(ps.codePath,PackageParser.PARSE_MUST_BE_APK | PackageParser.PARSE_IS_SYSTEM,SCAN_MONITOR | SCAN_NO_PATHS,0);
  if (newPkg == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName + "String_Node_Str"+ mLastScanError);
    return false;
  }
synchronized (mPackages) {
    updatePermissionsLP(newPkg.packageName,newPkg,true,true,false);
    if (writeSettings) {
      mSettings.writeLP();
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean deleteSystemPackageLI(PackageParser.Package p,int flags,PackageRemovedInfo outInfo,boolean writeSettings){
  ApplicationInfo applicationInfo=p.applicationInfo;
  if (applicationInfo == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName + "String_Node_Str");
    return false;
  }
  PackageSetting ps=null;
synchronized (mPackages) {
    ps=mSettings.getDisabledSystemPkg(p.packageName);
  }
  if (ps == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName);
    return false;
  }
 else {
    Log.i(TAG,"String_Node_Str");
  }
  outInfo.isRemovedPackageSystemUpdate=true;
  if (ps.versionCode < p.mVersionCode) {
    flags&=~PackageManager.DONT_DELETE_DATA;
  }
 else {
    flags|=PackageManager.DONT_DELETE_DATA;
  }
  boolean ret=deleteInstalledPackageLI(p,true,flags,outInfo,writeSettings);
  if (!ret) {
    return false;
  }
synchronized (mPackages) {
    mSettings.enableSystemPackageLP(p.packageName);
    NativeLibraryHelper.removeNativeBinariesLI(p.applicationInfo.nativeLibraryDir);
  }
  PackageParser.Package newPkg=scanPackageLI(ps.codePath,PackageParser.PARSE_MUST_BE_APK | PackageParser.PARSE_IS_SYSTEM,SCAN_MONITOR | SCAN_NO_PATHS,0);
  if (newPkg == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName + "String_Node_Str"+ mLastScanError);
    return false;
  }
synchronized (mPackages) {
    updatePermissionsLP(newPkg.packageName,newPkg,true,true,false);
    if (writeSettings) {
      mSettings.writeLP();
    }
  }
  return true;
}
Program: 181168
Project: 181168
Buggy source:
int disableSystemPackageLP(String name){
  PackageSetting p=mPackages.get(name);
  if (p == null) {
    Log.w(TAG,"String_Node_Str" + name + "String_Node_Str");
    return -1;
  }
  PackageSetting dp=mDisabledSysPackages.get(name);
  if (dp == null) {
    if ((p.pkg != null) && (p.pkg.applicationInfo != null)) {
      p.pkg.applicationInfo.flags|=ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
    }
    mDisabledSysPackages.put(name,p);
  }
  return removePackageLP(name);
}

Fixed version (ground truth):
boolean disableSystemPackageLP(String name){
  PackageSetting p=mPackages.get(name);
  if (p == null) {
    Log.w(TAG,"String_Node_Str" + name + "String_Node_Str");
    return false;
  }
  PackageSetting dp=mDisabledSysPackages.get(name);
  if (dp == null) {
    if ((p.pkg != null) && (p.pkg.applicationInfo != null)) {
      p.pkg.applicationInfo.flags|=ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
    }
    mDisabledSysPackages.put(name,p);
    PackageSetting newp=new PackageSetting(p);
    replacePackageLP(name,newp);
    return true;
  }
  return false;
}
Program: 181170
Project: 181170
Buggy source:
@Override public Parcelable onSaveInstanceState(){
  dismissPopup();
  Parcelable superState=super.onSaveInstanceState();
  SavedState ss=new SavedState(superState);
  boolean haveChildren=getChildCount() > 0 && mItemCount > 0;
  long selectedId=getSelectedItemId();
  ss.selectedId=selectedId;
  ss.height=getHeight();
  if (selectedId >= 0) {
    ss.viewTop=mSelectedTop;
    ss.position=getSelectedItemPosition();
    ss.firstId=INVALID_POSITION;
  }
 else {
    if (haveChildren) {
      View v=getChildAt(0);
      ss.viewTop=v.getTop();
      int firstPos=mFirstPosition;
      if (firstPos >= mItemCount) {
        firstPos=mItemCount - 1;
      }
      ss.position=firstPos;
      ss.firstId=mAdapter.getItemId(firstPos);
    }
 else {
      ss.viewTop=0;
      ss.firstId=INVALID_POSITION;
      ss.position=0;
    }
  }
  ss.filter=null;
  if (mFiltered) {
    final EditText textFilter=mTextFilter;
    if (textFilter != null) {
      Editable filterText=textFilter.getText();
      if (filterText != null) {
        ss.filter=filterText.toString();
      }
    }
  }
  return ss;
}

Fixed version (ground truth):
@Override public Parcelable onSaveInstanceState(){
  dismissPopup();
  Parcelable superState=super.onSaveInstanceState();
  SavedState ss=new SavedState(superState);
  boolean haveChildren=getChildCount() > 0 && mItemCount > 0;
  long selectedId=getSelectedItemId();
  ss.selectedId=selectedId;
  ss.height=getHeight();
  if (selectedId >= 0) {
    ss.viewTop=mSelectedTop;
    ss.position=getSelectedItemPosition();
    ss.firstId=INVALID_POSITION;
  }
 else {
    if (haveChildren && mFirstPosition > 0) {
      View v=getChildAt(0);
      ss.viewTop=v.getTop();
      int firstPos=mFirstPosition;
      if (firstPos >= mItemCount) {
        firstPos=mItemCount - 1;
      }
      ss.position=firstPos;
      ss.firstId=mAdapter.getItemId(firstPos);
    }
 else {
      ss.viewTop=0;
      ss.firstId=INVALID_POSITION;
      ss.position=0;
    }
  }
  ss.filter=null;
  if (mFiltered) {
    final EditText textFilter=mTextFilter;
    if (textFilter != null) {
      Editable filterText=textFilter.getText();
      if (filterText != null) {
        ss.filter=filterText.toString();
      }
    }
  }
  return ss;
}
Program: 181172
Project: 181172
Buggy source:
static private int printField(char[] formatStr,int amt,char suffix,int pos,boolean always,int zeropad){
  if (always || amt > 0) {
    if ((always && zeropad >= 3) || amt > 99) {
      int dig=amt / 100;
      formatStr[pos]=(char)(dig + '0');
      pos++;
      always=true;
      amt-=(dig * 100);
    }
    if ((always && zeropad >= 2) || amt > 9) {
      int dig=amt / 10;
      formatStr[pos]=(char)(dig + '0');
      pos++;
      always=true;
      amt-=(dig * 10);
    }
    formatStr[pos]=(char)(amt + '0');
    pos++;
    formatStr[pos]=suffix;
    pos++;
  }
  return pos;
}

Fixed version (ground truth):
static private int printField(char[] formatStr,int amt,char suffix,int pos,boolean always,int zeropad){
  if (always || amt > 0) {
    final int startPos=pos;
    if ((always && zeropad >= 3) || amt > 99) {
      int dig=amt / 100;
      formatStr[pos]=(char)(dig + '0');
      pos++;
      amt-=(dig * 100);
    }
    if ((always && zeropad >= 2) || amt > 9 || startPos != pos) {
      int dig=amt / 10;
      formatStr[pos]=(char)(dig + '0');
      pos++;
      amt-=(dig * 10);
    }
    formatStr[pos]=(char)(amt + '0');
    pos++;
    formatStr[pos]=suffix;
    pos++;
  }
  return pos;
}
Program: 181173
Project: 181173
Buggy source:
static private int printField(char[] formatStr,int amt,char suffix,int pos,boolean always,int zeropad){
  if (always || amt > 0) {
    if ((always && zeropad >= 3) || amt > 99) {
      int dig=amt / 100;
      formatStr[pos]=(char)(dig + '0');
      pos++;
      always=true;
      amt-=(dig * 100);
    }
    if ((always && zeropad >= 2) || amt > 9) {
      int dig=amt / 10;
      formatStr[pos]=(char)(dig + '0');
      pos++;
      always=true;
      amt-=(dig * 10);
    }
    formatStr[pos]=(char)(amt + '0');
    pos++;
    formatStr[pos]=suffix;
    pos++;
  }
  return pos;
}

Fixed version (ground truth):
static private int printField(char[] formatStr,int amt,char suffix,int pos,boolean always,int zeropad){
  if (always || amt > 0) {
    final int startPos=pos;
    if ((always && zeropad >= 3) || amt > 99) {
      int dig=amt / 100;
      formatStr[pos]=(char)(dig + '0');
      pos++;
      amt-=(dig * 100);
    }
    if ((always && zeropad >= 2) || amt > 9 || startPos != pos) {
      int dig=amt / 10;
      formatStr[pos]=(char)(dig + '0');
      pos++;
      amt-=(dig * 10);
    }
    formatStr[pos]=(char)(amt + '0');
    pos++;
    formatStr[pos]=suffix;
    pos++;
  }
  return pos;
}
Program: 181176
Project: 181176
Buggy source:
PackageSetting(String name,String realName,File codePath,File resourcePath,String nativeLibraryPathString,int pVersionCode,int pkgFlags){
  super(name,realName,codePath,resourcePath,nativeLibraryPathString,pVersionCode,pkgFlags);
}

Fixed version (ground truth):
PackageSetting(PackageSetting orig){
  super(orig.name,orig.realName,orig.codePath,orig.resourcePath,orig.nativeLibraryPathString,orig.versionCode,orig.pkgFlags);
  copyFrom(orig);
}
Program: 181178
Project: 181178
Buggy source:
private boolean deleteSystemPackageLI(PackageParser.Package p,int flags,PackageRemovedInfo outInfo,boolean writeSettings){
  ApplicationInfo applicationInfo=p.applicationInfo;
  if (applicationInfo == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName + "String_Node_Str");
    return false;
  }
  PackageSetting ps=null;
synchronized (mPackages) {
    ps=mSettings.getDisabledSystemPkg(p.packageName);
  }
  if (ps == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName);
    return false;
  }
 else {
    Log.i(TAG,"String_Node_Str");
  }
  outInfo.isRemovedPackageSystemUpdate=true;
  final boolean deleteCodeAndResources;
  if (ps.versionCode < p.mVersionCode) {
    deleteCodeAndResources=true;
    flags&=~PackageManager.DONT_DELETE_DATA;
  }
 else {
    deleteCodeAndResources=false;
    flags|=PackageManager.DONT_DELETE_DATA;
  }
  boolean ret=deleteInstalledPackageLI(p,deleteCodeAndResources,flags,outInfo,writeSettings);
  if (!ret) {
    return false;
  }
synchronized (mPackages) {
    mSettings.enableSystemPackageLP(p.packageName);
    NativeLibraryHelper.removeNativeBinariesLI(p.applicationInfo.nativeLibraryDir);
  }
  PackageParser.Package newPkg=scanPackageLI(ps.codePath,PackageParser.PARSE_MUST_BE_APK | PackageParser.PARSE_IS_SYSTEM,SCAN_MONITOR | SCAN_NO_PATHS,0);
  if (newPkg == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName + "String_Node_Str"+ mLastScanError);
    return false;
  }
synchronized (mPackages) {
    updatePermissionsLP(newPkg.packageName,newPkg,true,true,false);
    if (writeSettings) {
      mSettings.writeLP();
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean deleteSystemPackageLI(PackageParser.Package p,int flags,PackageRemovedInfo outInfo,boolean writeSettings){
  ApplicationInfo applicationInfo=p.applicationInfo;
  if (applicationInfo == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName + "String_Node_Str");
    return false;
  }
  PackageSetting ps=null;
synchronized (mPackages) {
    ps=mSettings.getDisabledSystemPkg(p.packageName);
  }
  if (ps == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName);
    return false;
  }
 else {
    Log.i(TAG,"String_Node_Str");
  }
  outInfo.isRemovedPackageSystemUpdate=true;
  if (ps.versionCode < p.mVersionCode) {
    flags&=~PackageManager.DONT_DELETE_DATA;
  }
 else {
    flags|=PackageManager.DONT_DELETE_DATA;
  }
  boolean ret=deleteInstalledPackageLI(p,true,flags,outInfo,writeSettings);
  if (!ret) {
    return false;
  }
synchronized (mPackages) {
    mSettings.enableSystemPackageLP(p.packageName);
    NativeLibraryHelper.removeNativeBinariesLI(p.applicationInfo.nativeLibraryDir);
  }
  PackageParser.Package newPkg=scanPackageLI(ps.codePath,PackageParser.PARSE_MUST_BE_APK | PackageParser.PARSE_IS_SYSTEM,SCAN_MONITOR | SCAN_NO_PATHS,0);
  if (newPkg == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName + "String_Node_Str"+ mLastScanError);
    return false;
  }
synchronized (mPackages) {
    updatePermissionsLP(newPkg.packageName,newPkg,true,true,false);
    if (writeSettings) {
      mSettings.writeLP();
    }
  }
  return true;
}
Program: 181179
Project: 181179
Buggy source:
int disableSystemPackageLP(String name){
  PackageSetting p=mPackages.get(name);
  if (p == null) {
    Log.w(TAG,"String_Node_Str" + name + "String_Node_Str");
    return -1;
  }
  PackageSetting dp=mDisabledSysPackages.get(name);
  if (dp == null) {
    if ((p.pkg != null) && (p.pkg.applicationInfo != null)) {
      p.pkg.applicationInfo.flags|=ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
    }
    mDisabledSysPackages.put(name,p);
  }
  return removePackageLP(name);
}

Fixed version (ground truth):
boolean disableSystemPackageLP(String name){
  PackageSetting p=mPackages.get(name);
  if (p == null) {
    Log.w(TAG,"String_Node_Str" + name + "String_Node_Str");
    return false;
  }
  PackageSetting dp=mDisabledSysPackages.get(name);
  if (dp == null) {
    if ((p.pkg != null) && (p.pkg.applicationInfo != null)) {
      p.pkg.applicationInfo.flags|=ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
    }
    mDisabledSysPackages.put(name,p);
    PackageSetting newp=new PackageSetting(p);
    replacePackageLP(name,newp);
    return true;
  }
  return false;
}
Program: 181182
Project: 181182
Buggy source:
@Override public Parcelable onSaveInstanceState(){
  dismissPopup();
  Parcelable superState=super.onSaveInstanceState();
  SavedState ss=new SavedState(superState);
  boolean haveChildren=getChildCount() > 0 && mItemCount > 0;
  long selectedId=getSelectedItemId();
  ss.selectedId=selectedId;
  ss.height=getHeight();
  if (selectedId >= 0) {
    ss.viewTop=mSelectedTop;
    ss.position=getSelectedItemPosition();
    ss.firstId=INVALID_POSITION;
  }
 else {
    if (haveChildren) {
      View v=getChildAt(0);
      ss.viewTop=v.getTop();
      int firstPos=mFirstPosition;
      if (firstPos >= mItemCount) {
        firstPos=mItemCount - 1;
      }
      ss.position=firstPos;
      ss.firstId=mAdapter.getItemId(firstPos);
    }
 else {
      ss.viewTop=0;
      ss.firstId=INVALID_POSITION;
      ss.position=0;
    }
  }
  ss.filter=null;
  if (mFiltered) {
    final EditText textFilter=mTextFilter;
    if (textFilter != null) {
      Editable filterText=textFilter.getText();
      if (filterText != null) {
        ss.filter=filterText.toString();
      }
    }
  }
  return ss;
}

Fixed version (ground truth):
@Override public Parcelable onSaveInstanceState(){
  dismissPopup();
  Parcelable superState=super.onSaveInstanceState();
  SavedState ss=new SavedState(superState);
  boolean haveChildren=getChildCount() > 0 && mItemCount > 0;
  long selectedId=getSelectedItemId();
  ss.selectedId=selectedId;
  ss.height=getHeight();
  if (selectedId >= 0) {
    ss.viewTop=mSelectedTop;
    ss.position=getSelectedItemPosition();
    ss.firstId=INVALID_POSITION;
  }
 else {
    if (haveChildren && mFirstPosition > 0) {
      View v=getChildAt(0);
      ss.viewTop=v.getTop();
      int firstPos=mFirstPosition;
      if (firstPos >= mItemCount) {
        firstPos=mItemCount - 1;
      }
      ss.position=firstPos;
      ss.firstId=mAdapter.getItemId(firstPos);
    }
 else {
      ss.viewTop=0;
      ss.firstId=INVALID_POSITION;
      ss.position=0;
    }
  }
  ss.filter=null;
  if (mFiltered) {
    final EditText textFilter=mTextFilter;
    if (textFilter != null) {
      Editable filterText=textFilter.getText();
      if (filterText != null) {
        ss.filter=filterText.toString();
      }
    }
  }
  return ss;
}
Program: 181183
Project: 181183
Buggy source:
/** 
 * Called from the input dispatcher thread before a key is dispatched to a window. <p>Allows you to define behavior for keys that can not be overridden by applications or redirect key events to a different window.  This method is called from the input thread, with no locks held. <p>Note that if you change the window a key is dispatched to, the new target window will receive the key event without having input focus.
 * @param win The window that currently has focus.  This is where the keyevent will normally go.
 * @param action The key event action.
 * @param flags The key event flags.
 * @param keyCode The key code.
 * @param metaState bit mask of meta keys that are held.
 * @param repeatCount Number of times a key down has repeated.
 * @param policyFlags The policy flags associated with the key.
 * @return Returns true if the policy consumed the event and it shouldnot be further dispatched.
 */
public boolean interceptKeyBeforeDispatching(WindowState win,int action,int flags,int keyCode,int metaState,int repeatCount,int policyFlags);

Fixed version (ground truth):
/** 
 * Called from the input dispatcher thread before a key is dispatched to a window. <p>Allows you to define behavior for keys that can not be overridden by applications or redirect key events to a different window.  This method is called from the input thread, with no locks held. <p>Note that if you change the window a key is dispatched to, the new target window will receive the key event without having input focus.
 * @param win The window that currently has focus.  This is where the keyevent will normally go.
 * @param action The key event action.
 * @param flags The key event flags.
 * @param keyCode The key code.
 * @param scanCode The key's scan code.
 * @param metaState bit mask of meta keys that are held.
 * @param repeatCount Number of times a key down has repeated.
 * @param policyFlags The policy flags associated with the key.
 * @return Returns true if the policy consumed the event and it shouldnot be further dispatched.
 */
public boolean interceptKeyBeforeDispatching(WindowState win,int action,int flags,int keyCode,int scanCode,int metaState,int repeatCount,int policyFlags);
Program: 181184
Project: 181184
Buggy source:
/** 
 * Called from the input reader thread before a key is enqueued. <p>There are some actions that need to be handled here because they affect the power state of the device, for example, the power keys. Generally, it's best to keep as little as possible in the queue thread because it's the most fragile.
 * @param whenNanos The event time in uptime nanoseconds.
 * @param keyCode The key code.
 * @param down True if the key is down.
 * @param policyFlags The policy flags associated with the key.
 * @param isScreenOn True if the screen is already on
 * @return The bitwise or of the {@link #ACTION_PASS_TO_USER},  {@link #ACTION_POKE_USER_ACTIVITY} and {@link #ACTION_GO_TO_SLEEP} flags.
 */
public int interceptKeyBeforeQueueing(long whenNanos,int keyCode,boolean down,int policyFlags,boolean isScreenOn);

Fixed version (ground truth):
/** 
 * Called from the input reader thread before a key is enqueued. <p>There are some actions that need to be handled here because they affect the power state of the device, for example, the power keys. Generally, it's best to keep as little as possible in the queue thread because it's the most fragile.
 * @param whenNanos The event time in uptime nanoseconds.
 * @param action The key event action.
 * @param flags The key event flags.
 * @param keyCode The key code.
 * @param scanCode The key's scan code.
 * @param policyFlags The policy flags associated with the key.
 * @param isScreenOn True if the screen is already on
 * @return The bitwise or of the {@link #ACTION_PASS_TO_USER},  {@link #ACTION_POKE_USER_ACTIVITY} and {@link #ACTION_GO_TO_SLEEP} flags.
 */
public int interceptKeyBeforeQueueing(long whenNanos,int action,int flags,int keyCode,int scanCode,int policyFlags,boolean isScreenOn);