SF: Skip choosing mode for powered-off followers

While the inactive display of a foldable is powered off, the Scheduler's
chosen mode for it is ignored by shouldApplyRefreshRateSelectorPolicy in
SF::requestDisplayModes, as it will be applied when the display becomes
active.

As an optimization, skip RefreshRateSelector::getRankedFrameRates for
follower displays, since SF::requestDisplayModes throws the result away.

This also restricts the mode of powered-off external displays to only be
set in response to DM policy changes, e.g. 60+60 constraint. Previously,
the Scheduler could initiate a mode request with an unconstrained policy
before powering on the display, which HWC would apply after powering on.

Flag: NONE (blocks P1 bug fix, and risk is limited to multi-display)
Bug: 329111930
Bug: 318534874
Test: SchedulerTest.chooseDisplayModesMultipleDisplays
Change-Id: I4dd954bf9a943f181bd64950ff9edee863f53e99
diff --git a/services/surfaceflinger/Scheduler/Scheduler.cpp b/services/surfaceflinger/Scheduler/Scheduler.cpp
index 005ec05..30bd735 100644
--- a/services/surfaceflinger/Scheduler/Scheduler.cpp
+++ b/services/surfaceflinger/Scheduler/Scheduler.cpp
@@ -1152,8 +1152,10 @@
         return pacesetterFps;
     }();
 
+    // Choose a mode for powered-on follower displays.
     for (const auto& [id, display] : mDisplays) {
         if (id == *mPacesetterDisplayId) continue;
+        if (display.powerMode != hal::PowerMode::ON) continue;
 
         auto rankedFrameRates =
                 display.selectorPtr->getRankedFrameRates(mPolicy.contentRequirements, globalSignals,