Program: 93909
Project: 93909
Buggy source:
final boolean update(double timeStep,long currentTime){
  if (!m_manager.isAny(SCANNING,STARTING_SCAN)) {
    m_timeNotScanning+=timeStep;
  }
  boolean stopClassicBoost=false;
  if (m_manager.is(BOOST_SCANNING)) {
    m_timeClassicBoosting+=timeStep;
    if (m_timeClassicBoosting >= m_classicLength) {
      stopClassicBoost=true;
    }
  }
  boolean startScan=false;
  if (Interval.isEnabled(m_manager.m_config.autoScanActiveTime) && m_manager.ready() && !m_manager.is(BOOST_SCANNING)) {
    if (m_manager.isForegrounded()) {
      if (Interval.isEnabled(m_manager.m_config.autoScanDelayAfterBleTurnsOn) && m_triedToStartScanAfterTurnedOn && (currentTime - m_manager.timeTurnedOn()) >= m_manager.m_config.autoScanDelayAfterBleTurnsOn.millis()) {
        m_triedToStartScanAfterTurnedOn=true;
        if (!m_manager.is(SCANNING)) {
          startScan=true;
        }
      }
 else       if (Interval.isEnabled(m_manager.m_config.autoScanDelayAfterResume) && !m_triedToStartScanAfterResume && m_manager.timeForegrounded() >= Interval.secs(m_manager.m_config.autoScanDelayAfterResume)) {
        m_triedToStartScanAfterResume=true;
        if (!m_manager.is(SCANNING)) {
          startScan=true;
        }
      }
    }
    if (!m_manager.is(SCANNING)) {
      double scanInterval=Interval.secs(m_manager.isForegrounded() ? m_manager.m_config.autoScanPauseInterval : m_manager.m_config.autoScanPauseTimeWhileAppIsBackgrounded);
      if (Interval.isEnabled(scanInterval) && m_timeNotScanning >= scanInterval) {
        startScan=true;
      }
    }
  }
  if (startScan) {
    if (m_manager.doAutoScan()) {
      m_manager.startScan_private(new ScanOptions().scanPeriodically(m_manager.m_config.autoScanActiveTime,m_manager.m_config.autoScanPauseInterval));
    }
  }
  final P_Task_Scan scanTask=m_manager.getTaskQueue().get(P_Task_Scan.class,m_manager);
  if (scanTask != null) {
    if (stopClassicBoost) {
      m_timeClassicBoosting=0;
      stopClassicDiscovery();
      scanTask.onClassicBoostFinished();
    }
    if (scanTask.getState() == PE_TaskState.EXECUTING) {
      m_manager.tryPurgingStaleDevices(scanTask.getAggregatedTimeArmedAndExecuting());
    }
  }
  return startScan;
}

Fixed version (ground truth):
final boolean update(double timeStep,long currentTime){
  if (!m_manager.isAny(SCANNING,STARTING_SCAN)) {
    m_timeNotScanning+=timeStep;
  }
  boolean stopClassicBoost=false;
  if (m_manager.is(BOOST_SCANNING)) {
    m_timeClassicBoosting+=timeStep;
    if (m_timeClassicBoosting >= m_classicLength) {
      stopClassicBoost=true;
    }
  }
  boolean startScan=false;
  if (Interval.isEnabled(m_manager.m_config.autoScanActiveTime) && m_manager.ready() && !m_manager.is(BOOST_SCANNING)) {
    if (m_manager.isForegrounded()) {
      if (Interval.isEnabled(m_manager.m_config.autoScanDelayAfterBleTurnsOn) && m_triedToStartScanAfterTurnedOn && (currentTime - m_manager.timeTurnedOn()) >= m_manager.m_config.autoScanDelayAfterBleTurnsOn.millis()) {
        m_triedToStartScanAfterTurnedOn=true;
        if (!m_manager.isAny(SCANNING,STARTING_SCAN)) {
          startScan=true;
        }
      }
 else       if (Interval.isEnabled(m_manager.m_config.autoScanDelayAfterResume) && !m_triedToStartScanAfterResume && m_manager.timeForegrounded() >= Interval.secs(m_manager.m_config.autoScanDelayAfterResume)) {
        m_triedToStartScanAfterResume=true;
        if (!m_manager.isAny(SCANNING,STARTING_SCAN)) {
          startScan=true;
        }
      }
    }
    if (!m_manager.isAny(SCANNING,STARTING_SCAN)) {
      double scanInterval=Interval.secs(m_manager.isForegrounded() ? m_manager.m_config.autoScanPauseInterval : m_manager.m_config.autoScanPauseTimeWhileAppIsBackgrounded);
      if (Interval.isEnabled(scanInterval) && m_timeNotScanning >= scanInterval) {
        startScan=true;
      }
    }
  }
  if (startScan) {
    if (m_manager.doAutoScan()) {
      m_manager.startScan_private(new ScanOptions().scanPeriodically(m_manager.m_config.autoScanActiveTime,m_manager.m_config.autoScanPauseInterval));
    }
  }
  final P_Task_Scan scanTask=m_manager.getTaskQueue().get(P_Task_Scan.class,m_manager);
  if (scanTask != null) {
    if (stopClassicBoost) {
      m_timeClassicBoosting=0;
      stopClassicDiscovery();
      scanTask.onClassicBoostFinished();
    }
    if (scanTask.getState() == PE_TaskState.EXECUTING) {
      m_manager.tryPurgingStaleDevices(scanTask.getAggregatedTimeArmedAndExecuting());
    }
  }
  return startScan;
}