SF: Remove DisplayDevice::ActiveModeInfo

This type is redundant with DisplayModeRequest, so store the desired and
pending modes as DisplayModeRequestOpt. This is a step toward flowing
the request through one of desired/pending/active states.

Use the std::nullopt state of the desired mode instead of relying on the
implicitly associated TracedOrdinal<bool>.

Bug: 241285876
Test: presubmit
Change-Id: Ie12a5ad420745761c73b1ce2c536862f79a50665
diff --git a/services/surfaceflinger/DisplayDevice.h b/services/surfaceflinger/DisplayDevice.h
index a061fca..51c7be0 100644
--- a/services/surfaceflinger/DisplayDevice.h
+++ b/services/surfaceflinger/DisplayDevice.h
@@ -186,35 +186,19 @@
      * Display mode management.
      */
 
-    // TODO(b/241285876): Replace ActiveModeInfo and DisplayModeEvent with DisplayModeRequest.
-    struct ActiveModeInfo {
-        using Event = scheduler::DisplayModeEvent;
-
-        ActiveModeInfo() = default;
-        ActiveModeInfo(scheduler::FrameRateMode mode, Event event)
-              : modeOpt(std::move(mode)), event(event) {}
-
-        explicit ActiveModeInfo(display::DisplayModeRequest&& request)
-              : ActiveModeInfo(std::move(request.mode),
-                               request.emitEvent ? Event::Changed : Event::None) {}
-
-        ftl::Optional<scheduler::FrameRateMode> modeOpt;
-        Event event = Event::None;
-
-        bool operator!=(const ActiveModeInfo& other) const {
-            return modeOpt != other.modeOpt || event != other.event;
-        }
-    };
-
     enum class DesiredModeAction { None, InitiateDisplayModeSwitch, InitiateRenderRateSwitch };
 
-    DesiredModeAction setDesiredMode(const ActiveModeInfo&, bool force = false)
+    DesiredModeAction setDesiredMode(display::DisplayModeRequest&&, bool force = false)
             EXCLUDES(mDesiredModeLock);
 
-    ftl::Optional<ActiveModeInfo> getDesiredMode() const EXCLUDES(mDesiredModeLock);
+    using DisplayModeRequestOpt = ftl::Optional<display::DisplayModeRequest>;
+
+    DisplayModeRequestOpt getDesiredMode() const EXCLUDES(mDesiredModeLock);
     void clearDesiredMode() EXCLUDES(mDesiredModeLock);
 
-    ActiveModeInfo getPendingMode() const REQUIRES(kMainThreadContext) { return mPendingMode; }
+    DisplayModeRequestOpt getPendingMode() const REQUIRES(kMainThreadContext) {
+        return mPendingModeOpt;
+    }
     bool isModeSetPending() const REQUIRES(kMainThreadContext) { return mIsModeSetPending; }
 
     scheduler::FrameRateMode getActiveMode() const REQUIRES(kMainThreadContext) {
@@ -223,7 +207,7 @@
 
     void setActiveMode(DisplayModeId, Fps vsyncRate, Fps renderFps);
 
-    bool initiateModeChange(const ActiveModeInfo&, const hal::VsyncPeriodChangeConstraints&,
+    bool initiateModeChange(display::DisplayModeRequest&&, const hal::VsyncPeriodChangeConstraints&,
                             hal::VsyncPeriodChangeTimeline& outTimeline)
             REQUIRES(kMainThreadContext);
 
@@ -316,10 +300,10 @@
     float mHdrSdrRatio = 1.0f;
 
     mutable std::mutex mDesiredModeLock;
-    ActiveModeInfo mDesiredMode GUARDED_BY(mDesiredModeLock);
-    TracedOrdinal<bool> mDesiredModeChanged GUARDED_BY(mDesiredModeLock);
+    DisplayModeRequestOpt mDesiredModeOpt GUARDED_BY(mDesiredModeLock);
+    TracedOrdinal<bool> mHasDesiredModeTrace GUARDED_BY(mDesiredModeLock);
 
-    ActiveModeInfo mPendingMode GUARDED_BY(kMainThreadContext);
+    DisplayModeRequestOpt mPendingModeOpt GUARDED_BY(kMainThreadContext);
     bool mIsModeSetPending GUARDED_BY(kMainThreadContext) = false;
 };