SF: Split Scheduler initialization
Create VsyncSchedule and timers after Scheduler construction, which will
happen on boot rather than initial hotplug in the future.
Remove Scheduler from SF factory.
Bug: 185535769
Test: Boot
Change-Id: I1096987f468a43fa4b6ae39709b44425d026248c
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index c2dcd70..34629a2 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3149,8 +3149,19 @@
mVsyncConfiguration = getFactory().createVsyncConfiguration(currRefreshRate);
mVsyncModulator = sp<VsyncModulator>::make(mVsyncConfiguration->getCurrentConfigs());
- // start the EventThread
- mScheduler = getFactory().createScheduler(display->holdRefreshRateConfigs(), *this);
+ const Scheduler::Options options = {
+ .useContentDetection = sysprop::use_content_detection_for_refresh_rate(false)};
+
+ mScheduler = std::make_unique<Scheduler>(static_cast<ISchedulerCallback&>(*this), options);
+ {
+ auto configs = display->holdRefreshRateConfigs();
+ mScheduler->createVsyncSchedule(configs->supportsKernelIdleTimer());
+ mScheduler->setRefreshRateConfigs(std::move(configs));
+ }
+
+ setVsyncEnabled(false);
+ mScheduler->startTimers();
+
const auto configs = mVsyncConfiguration->getCurrentConfigs();
const nsecs_t vsyncPeriod = currRefreshRate.getPeriodNsecs();
mAppConnectionHandle =