SF: Obey active display's RefreshRateConfigs

When a display becomes active, apply its RefreshRateConfigs' policy,
as it may have changed while the display was inactive.

When booting while folded, DisplayManager first sends DisplayModeSpecs
for each display, and then powers on the outer display. Before this CL,
the outer display would become the new active display, but its
DisplayManagerPolicy would never be applied.

This backport also includes I63d21c2216a3ab864b040bdb2c9e8fba0768b66a
for expanded unit tests.

Bug: 250421145
Test: Force 120 Hz, and reboot while folded.
Test: SetPowerModeInternalTest.activeDisplay{Boot,Single,Dual}
Change-Id: I15e0f5a280e62baf6d4e6ea2748d95342e79ac44
Merged-In: I15e0f5a280e62baf6d4e6ea2748d95342e79ac44
diff --git a/services/surfaceflinger/tests/unittests/DisplayTransactionTestHelpers.h b/services/surfaceflinger/tests/unittests/DisplayTransactionTestHelpers.h
index f5235ce..60f773f 100644
--- a/services/surfaceflinger/tests/unittests/DisplayTransactionTestHelpers.h
+++ b/services/surfaceflinger/tests/unittests/DisplayTransactionTestHelpers.h
@@ -42,6 +42,7 @@
 #include <renderengine/mock/RenderEngine.h>
 #include <ui/DebugUtils.h>
 
+#include "FakeDisplayInjector.h"
 #include "TestableScheduler.h"
 #include "TestableSurfaceFlinger.h"
 #include "mock/DisplayHardware/MockComposer.h"
@@ -90,7 +91,9 @@
     void injectFakeBufferQueueFactory();
     void injectFakeNativeWindowSurfaceFactory();
     sp<DisplayDevice> injectDefaultInternalDisplay(
-            std::function<void(TestableSurfaceFlinger::FakeDisplayDeviceInjector&)>);
+            std::function<void(TestableSurfaceFlinger::FakeDisplayDeviceInjector&)> injectExtra) {
+        return mFakeDisplayInjector.injectInternalDisplay(injectExtra);
+    }
 
     // --------------------------------------------------------------------
     // Postcondition helpers
@@ -115,6 +118,8 @@
     sp<GraphicBuffer> mBuffer = new GraphicBuffer();
     Hwc2::mock::PowerAdvisor mPowerAdvisor;
 
+    FakeDisplayInjector mFakeDisplayInjector{mFlinger, mPowerAdvisor, mNativeWindow};
+
     // These mocks are created by the test, but are destroyed by SurfaceFlinger
     // by virtue of being stored into a std::unique_ptr. However we still need
     // to keep a reference to them for use in setting up call expectations.