SurfaceFlinger: use setActiveConfigWithConstraints

Remove setActiveConfig and use setActiveConfigWithConstraints
instead. Use the return parameter of setActiveConfigWithConstraints to know
whether a refresh is required and when.

Fixes: 142753004
Bug: 141329414
Test: observe refresh rate switching thru systrace
Change-Id: Ie67a3be9180e7a367fc9e73425598d53a5fd6578
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h
index e87c5c3..077e452 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.h
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.h
@@ -102,9 +102,6 @@
     // set power mode
     virtual status_t setPowerMode(DisplayId displayId, int mode) = 0;
 
-    // set active config
-    virtual status_t setActiveConfig(DisplayId displayId, size_t configId) = 0;
-
     // Sets a color transform to be applied to the result of composition
     virtual status_t setColorTransform(DisplayId displayId, const mat4& transform) = 0;
 
@@ -180,6 +177,14 @@
 
     virtual bool isUsingVrComposer() const = 0;
 
+    // Composer 2.4
+    virtual bool isVsyncPeriodSwitchSupported(DisplayId displayId) const = 0;
+    virtual nsecs_t getDisplayVsyncPeriod(DisplayId displayId) const = 0;
+    virtual status_t setActiveConfigWithConstraints(
+            DisplayId displayId, size_t configId,
+            const HWC2::VsyncPeriodChangeConstraints& constraints,
+            HWC2::VsyncPeriodChangeTimeline* outTimeline) = 0;
+
     // for debugging ----------------------------------------------------------
     virtual void dump(std::string& out) const = 0;
 
@@ -232,9 +237,6 @@
     // set power mode
     status_t setPowerMode(DisplayId displayId, int mode) override;
 
-    // set active config
-    status_t setActiveConfig(DisplayId displayId, size_t configId) override;
-
     // Sets a color transform to be applied to the result of composition
     status_t setColorTransform(DisplayId displayId, const mat4& transform) override;
 
@@ -305,6 +307,13 @@
 
     bool isUsingVrComposer() const override;
 
+    // Composer 2.4
+    bool isVsyncPeriodSwitchSupported(DisplayId displayId) const override;
+    nsecs_t getDisplayVsyncPeriod(DisplayId displayId) const override;
+    status_t setActiveConfigWithConstraints(DisplayId displayId, size_t configId,
+                                            const HWC2::VsyncPeriodChangeConstraints& constraints,
+                                            HWC2::VsyncPeriodChangeTimeline* outTimeline) override;
+
     // for debugging ----------------------------------------------------------
     void dump(std::string& out) const override;