reset method

void reset()

Resets the adapter to Phase 2 and clears all accumulated data.

Call when the app resumes from background (thermal recovery). The warm-up benchmark re-runs from scratch; the current quality is preserved until the new benchmark completes, at which point it may change.

If the adapter was stopped, this restarts it.

Implementation

void reset() {
  _warmupDurations.clear();
  _window.clear();
  _overBudgetWindowCount = 0;
  _underBudgetWindowCount = 0;
  _windowFrameCount = 0;
  _lastChangeAt = null;
  _skippedWarmupFrames = 0; // restart the startup-skip window
  _usedCachedQuality = false; // accurate: we are re-running Phase 2

  if (_running) {
    // Already running — just reset to warm-up phase without toggling callback.
    _phase = AdaptivePhase.warmup;
  } else {
    // Not running (e.g. tests, or after a static-probe terminal result).
    // Just reset the phase; start() may be called later by the widget.
    _phase = AdaptivePhase.warmup;
  }
}