Program: 183355
Project: 183355
Buggy source:
public void run(){
  long sent, received;
  long preTxPkts=-1, preRxPkts=-1;
  Activity newActivity;
  preTxPkts=txPkts;
  preRxPkts=rxPkts;
  if (netstat != null) {
    try {
      txPkts=netstat.getMobileTxPackets();
      rxPkts=netstat.getMobileRxPackets();
    }
 catch (    RemoteException e) {
      txPkts=0;
      rxPkts=0;
    }
    if (netStatPollEnabled && (preTxPkts > 0 || preRxPkts > 0)) {
      sent=txPkts - preTxPkts;
      received=rxPkts - preRxPkts;
      if (sent > 0 && received > 0) {
        sentSinceLastRecv=0;
        newActivity=Activity.DATAINANDOUT;
      }
 else       if (sent > 0 && received == 0) {
        if (phone.getState() == Phone.State.IDLE) {
          sentSinceLastRecv+=sent;
        }
 else {
          sentSinceLastRecv=0;
        }
        newActivity=Activity.DATAOUT;
      }
 else       if (sent == 0 && received > 0) {
        sentSinceLastRecv=0;
        newActivity=Activity.DATAIN;
      }
 else       if (sent == 0 && received == 0) {
        newActivity=Activity.NONE;
      }
 else {
        sentSinceLastRecv=0;
        newActivity=Activity.NONE;
      }
      if (activity != newActivity) {
        activity=newActivity;
        phone.notifyDataActivity();
      }
    }
    if (sentSinceLastRecv >= NUMBER_SENT_PACKETS_OF_HANG) {
      if (mNoRecvPollCount == 0) {
        EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_RADIO_RESET_COUNTDOWN_TRIGGERED,sentSinceLastRecv);
      }
      if (mNoRecvPollCount < NO_RECV_POLL_LIMIT) {
        mNoRecvPollCount++;
        netStatPollPeriod=POLL_NETSTAT_SLOW_MILLIS;
      }
 else {
        if (DBG)         log("String_Node_Str" + String.valueOf(sentSinceLastRecv) + "String_Node_Str");
        netStatPollEnabled=false;
        stopNetStatPoll();
        restartRadio();
        EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_RADIO_RESET,NO_RECV_POLL_LIMIT);
      }
    }
 else {
      mNoRecvPollCount=0;
      netStatPollPeriod=POLL_NETSTAT_MILLIS;
    }
    if (netStatPollEnabled) {
      mDataConnectionTracker.postDelayed(this,netStatPollPeriod);
    }
  }
}

Fixed version (ground truth):
public void run(){
  long sent, received;
  long preTxPkts=-1, preRxPkts=-1;
  Activity newActivity;
  preTxPkts=txPkts;
  preRxPkts=rxPkts;
  if (netstat != null) {
    try {
      txPkts=netstat.getMobileTxPackets();
      rxPkts=netstat.getMobileRxPackets();
    }
 catch (    RemoteException e) {
      txPkts=0;
      rxPkts=0;
    }
    if (netStatPollEnabled && (preTxPkts > 0 || preRxPkts > 0)) {
      sent=txPkts - preTxPkts;
      received=rxPkts - preRxPkts;
      if (sent > 0 && received > 0) {
        sentSinceLastRecv=0;
        newActivity=Activity.DATAINANDOUT;
      }
 else       if (sent > 0 && received == 0) {
        if (phone.getState() == Phone.State.IDLE) {
          sentSinceLastRecv+=sent;
        }
 else {
          sentSinceLastRecv=0;
        }
        newActivity=Activity.DATAOUT;
      }
 else       if (sent == 0 && received > 0) {
        sentSinceLastRecv=0;
        newActivity=Activity.DATAIN;
      }
 else       if (sent == 0 && received == 0) {
        newActivity=(activity == Activity.DORMANT) ? activity : Activity.NONE;
      }
 else {
        sentSinceLastRecv=0;
        newActivity=(activity == Activity.DORMANT) ? activity : Activity.NONE;
      }
      if (activity != newActivity) {
        activity=newActivity;
        phone.notifyDataActivity();
      }
    }
    if (sentSinceLastRecv >= NUMBER_SENT_PACKETS_OF_HANG) {
      if (mNoRecvPollCount == 0) {
        EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_RADIO_RESET_COUNTDOWN_TRIGGERED,sentSinceLastRecv);
      }
      if (mNoRecvPollCount < NO_RECV_POLL_LIMIT) {
        mNoRecvPollCount++;
        netStatPollPeriod=POLL_NETSTAT_SLOW_MILLIS;
      }
 else {
        if (DBG)         log("String_Node_Str" + String.valueOf(sentSinceLastRecv) + "String_Node_Str");
        netStatPollEnabled=false;
        stopNetStatPoll();
        restartRadio();
        EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_RADIO_RESET,NO_RECV_POLL_LIMIT);
      }
    }
 else {
      mNoRecvPollCount=0;
      netStatPollPeriod=POLL_NETSTAT_MILLIS;
    }
    if (netStatPollEnabled) {
      mDataConnectionTracker.postDelayed(this,netStatPollPeriod);
    }
  }
}