Indicate optimization policy to SurfaceFlinger from DisplayManager

DisplayManager's never-blank concept is translated in VirtualDisplayAdapter to be a power-optimised display (instead of a performance optimised display) in the downstream components. This concept indicates that these displays typically depend on another display's presence and activeness to be continually rendered and shown. The display they depend on instead optimises for performance when it is on, meaning that all the related displays have good performance.

For cases where power optimisation information is not available (calls to DisplayControl#createVirtualDisplay(String, boolean) and SurfaceComposerClient::createVirtualDisplay), the power optimisation state is defaulted to optimise for power since these are system calls and this preserves the previous behaviour.

Bug: 342681202

Flag: EXEMPT refactor

Test: Flashed build on test device, ran Android Auto Projected
Change-Id: I6a9fdf7c4be080e2f4df6734def8a4fbefde5742
diff --git a/services/surfaceflinger/DisplayDevice.h b/services/surfaceflinger/DisplayDevice.h
index b5a543a..be37429 100644
--- a/services/surfaceflinger/DisplayDevice.h
+++ b/services/surfaceflinger/DisplayDevice.h
@@ -93,6 +93,11 @@
     bool isSecure() const;
     void setSecure(bool secure);
 
+    // The optimization policy influences whether this display is optimized for power or
+    // performance.
+    gui::ISurfaceComposer::OptimizationPolicy getOptimizationPolicy() const;
+    void setOptimizationPolicy(gui::ISurfaceComposer::OptimizationPolicy optimizationPolicy);
+
     int getWidth() const;
     int getHeight() const;
     ui::Size getSize() const { return {getWidth(), getHeight()}; }
@@ -236,6 +241,9 @@
     // TODO(b/182939859): Remove special cases for primary display.
     const bool mIsPrimary;
 
+    gui::ISurfaceComposer::OptimizationPolicy mOptimizationPolicy =
+            gui::ISurfaceComposer::OptimizationPolicy::optimizeForPerformance;
+
     uint32_t mFlags = 0;
 
     // Requested refresh rate in fps, supported only for virtual displays.
@@ -283,6 +291,9 @@
     std::string displayName;
     std::string uniqueId;
     bool isSecure = false;
+
+    gui::ISurfaceComposer::OptimizationPolicy optimizationPolicy =
+            gui::ISurfaceComposer::OptimizationPolicy::optimizeForPerformance;
     bool isProtected = false;
     // Refer to DisplayDevice::mRequestedRefreshRate, for virtual display only
     Fps requestedRefreshRate;