SF: Break dependency between VsyncConfiguration and RefreshRateConfigs

The VsyncConfiguration class doesn't need to know the list of
supported refresh rates, because the offsets can be calculated
and cached on the fly. This is better because the list of refresh
rates can change during runtime (for example for Android TV).

After fixing this the dependency on RefreshRateConfigs is only needed
for getting the current refresh rate at construction time. For
this it's sufficient to pass only the Fps instead of the whole
RefreshRateConfigs object.

Bug: 159590486
Test: presubmit
Change-Id: I1c0ceaf2524b517e85c8067577fc9f5146f1f632
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index d9c8457..ba1fbbe 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2620,8 +2620,14 @@
             setPowerModeInternal(display, hal::PowerMode::ON);
 
             // TODO(b/175678251) Call a listener instead.
-            if (mRefreshRateOverlay) {
-                mRefreshRateOverlay->reset();
+            if (currentState.physical->hwcDisplayId == getHwComposer().getInternalHwcDisplayId()) {
+                const auto displayId = currentState.physical->id;
+                const auto configs = getHwComposer().getConfigs(displayId);
+                mVsyncConfiguration->reset();
+                updatePhaseConfiguration(mRefreshRateConfigs->getCurrentRefreshRate());
+                if (mRefreshRateOverlay) {
+                    mRefreshRateOverlay->reset();
+                }
             }
         }
         return;
@@ -2908,7 +2914,7 @@
             std::make_unique<scheduler::RefreshRateStats>(*mTimeStats, currRefreshRate.getFps(),
                                                           hal::PowerMode::OFF);
 
-    mVsyncConfiguration = getFactory().createVsyncConfiguration(*mRefreshRateConfigs);
+    mVsyncConfiguration = getFactory().createVsyncConfiguration(currRefreshRate.getFps());
     mVsyncModulator.emplace(mVsyncConfiguration->getCurrentConfigs());
 
     // start the EventThread