SF: update scheduler's RefreshRateConfigs on hotplugs
We may receive hotplug event on the primary display (mostly on
Android TVs), and we should update the Scheduler with the new dipslay
information.
Test: com.android.devicehealthchecks.SystemCheck
Bug: 194157853
Change-Id: I82e64ee002475cdba70e9cb369c388290e667bdf
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 7541510..e0df3cd 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3124,9 +3124,11 @@
void SurfaceFlinger::initScheduler(const sp<DisplayDevice>& display) {
if (mScheduler) {
- // In practice it's not allowed to hotplug in/out the primary display once it's been
- // connected during startup, but some tests do it, so just warn and return.
- ALOGW("Can't re-init scheduler");
+ // If the scheduler is already initialized, this means that we received
+ // a hotplug(connected) on the primary display. In that case we should
+ // update the scheduler with the most recent display information.
+ ALOGW("Scheduler already initialized, updating instead");
+ mScheduler->setRefreshRateConfigs(display->holdRefreshRateConfigs());
return;
}
const auto currRefreshRate = display->getActiveMode()->getFps();