Program: 197669
Project: 197669
Buggy source:
private void resetAllStatsLocked(){
  mStartCount=0;
  initTimes(SystemClock.uptimeMillis() * 1000,SystemClock.elapsedRealtime() * 1000);
  mScreenOnTimer.reset(false);
  for (int i=0; i < NUM_SCREEN_BRIGHTNESS_BINS; i++) {
    mScreenBrightnessTimer[i].reset(false);
  }
  mInteractiveTimer.reset(false);
  mLowPowerModeEnabledTimer.reset(false);
  mPhoneOnTimer.reset(false);
  mAudioOnTimer.reset(false);
  mVideoOnTimer.reset(false);
  mFlashlightOnTimer.reset(false);
  for (int i=0; i < SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
    mPhoneSignalStrengthsTimer[i].reset(false);
  }
  mPhoneSignalScanningTimer.reset(false);
  for (int i=0; i < NUM_DATA_CONNECTION_TYPES; i++) {
    mPhoneDataConnectionsTimer[i].reset(false);
  }
  for (int i=0; i < NUM_NETWORK_ACTIVITY_TYPES; i++) {
    mNetworkByteActivityCounters[i].reset(false);
    mNetworkPacketActivityCounters[i].reset(false);
  }
  mMobileRadioActiveTimer.reset(false);
  mMobileRadioActivePerAppTimer.reset(false);
  mMobileRadioActiveAdjustedTime.reset(false);
  mMobileRadioActiveUnknownTime.reset(false);
  mMobileRadioActiveUnknownCount.reset(false);
  mWifiOnTimer.reset(false);
  mGlobalWifiRunningTimer.reset(false);
  for (int i=0; i < NUM_WIFI_STATES; i++) {
    mWifiStateTimer[i].reset(false);
  }
  for (int i=0; i < NUM_WIFI_SUPPL_STATES; i++) {
    mWifiSupplStateTimer[i].reset(false);
  }
  for (int i=0; i < NUM_WIFI_SIGNAL_STRENGTH_BINS; i++) {
    mWifiSignalStrengthsTimer[i].reset(false);
  }
  mBluetoothOnTimer.reset(false);
  for (int i=0; i < NUM_BLUETOOTH_STATES; i++) {
    mBluetoothStateTimer[i].reset(false);
  }
  for (int i=0; i < mUidStats.size(); i++) {
    if (mUidStats.valueAt(i).reset()) {
      mUidStats.remove(mUidStats.keyAt(i));
      i--;
    }
  }
  if (mKernelWakelockStats.size() > 0) {
    for (    SamplingTimer timer : mKernelWakelockStats.values()) {
      mOnBatteryScreenOffTimeBase.remove(timer);
    }
    mKernelWakelockStats.clear();
  }
  if (mWakeupReasonStats.size() > 0) {
    for (    LongSamplingCounter timer : mWakeupReasonStats.values()) {
      mOnBatteryScreenOffTimeBase.remove(timer);
    }
    mWakeupReasonStats.clear();
  }
  initDischarge();
  clearHistoryLocked();
}

Fixed version (ground truth):
private void resetAllStatsLocked(){
  mStartCount=0;
  initTimes(SystemClock.uptimeMillis() * 1000,SystemClock.elapsedRealtime() * 1000);
  mScreenOnTimer.reset(false);
  for (int i=0; i < NUM_SCREEN_BRIGHTNESS_BINS; i++) {
    mScreenBrightnessTimer[i].reset(false);
  }
  mInteractiveTimer.reset(false);
  mLowPowerModeEnabledTimer.reset(false);
  mPhoneOnTimer.reset(false);
  mAudioOnTimer.reset(false);
  mVideoOnTimer.reset(false);
  mFlashlightOnTimer.reset(false);
  for (int i=0; i < SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
    mPhoneSignalStrengthsTimer[i].reset(false);
  }
  mPhoneSignalScanningTimer.reset(false);
  for (int i=0; i < NUM_DATA_CONNECTION_TYPES; i++) {
    mPhoneDataConnectionsTimer[i].reset(false);
  }
  for (int i=0; i < NUM_NETWORK_ACTIVITY_TYPES; i++) {
    mNetworkByteActivityCounters[i].reset(false);
    mNetworkPacketActivityCounters[i].reset(false);
  }
  mMobileRadioActiveTimer.reset(false);
  mMobileRadioActivePerAppTimer.reset(false);
  mMobileRadioActiveAdjustedTime.reset(false);
  mMobileRadioActiveUnknownTime.reset(false);
  mMobileRadioActiveUnknownCount.reset(false);
  mWifiOnTimer.reset(false);
  mGlobalWifiRunningTimer.reset(false);
  for (int i=0; i < NUM_WIFI_STATES; i++) {
    mWifiStateTimer[i].reset(false);
  }
  for (int i=0; i < NUM_WIFI_SUPPL_STATES; i++) {
    mWifiSupplStateTimer[i].reset(false);
  }
  for (int i=0; i < NUM_WIFI_SIGNAL_STRENGTH_BINS; i++) {
    mWifiSignalStrengthsTimer[i].reset(false);
  }
  mBluetoothOnTimer.reset(false);
  for (int i=0; i < NUM_BLUETOOTH_STATES; i++) {
    mBluetoothStateTimer[i].reset(false);
  }
  for (int i=0; i < mUidStats.size(); i++) {
    if (mUidStats.valueAt(i).reset()) {
      mUidStats.remove(mUidStats.keyAt(i));
      i--;
    }
  }
  if (mKernelWakelockStats.size() > 0) {
    for (    SamplingTimer timer : mKernelWakelockStats.values()) {
      mOnBatteryScreenOffTimeBase.remove(timer);
    }
    mKernelWakelockStats.clear();
  }
  if (mWakeupReasonStats.size() > 0) {
    for (    SamplingTimer timer : mWakeupReasonStats.values()) {
      mOnBatteryTimeBase.remove(timer);
    }
    mWakeupReasonStats.clear();
  }
  initDischarge();
  clearHistoryLocked();
}