composer: few changes for refresh rate switching

 - getDisplayConfigs is required to remain backward compatible with
   composer@2.3 and older versions. To keep it that way a new config
   attribute was added to group similar configs.
 - getSupportedDisplayVsyncPeriods was removed as the vsync period
   can be obtained by getDisplayAttribute for each individual config.
 - renamed setActiveConfigAndVsyncPeriod -> setActiveConfigWithConstraints
   to better describe what this function does.
 - added VsyncPeriodChangeTimeline and onVsyncPeriodTimingChanged

With these changes composer is expected to return all possible
configurations when getDisplayConfigs (similar to older composer versions).
The client knows whether a seamless vsync period is possible or not by
the config groups.

Test: rev up composer to 2.4 and test refresh rate switching
Bug: 141329414
Change-Id: I1b4525f7e00b62cdaf260274abe4a6a5962ed1ab
diff --git a/graphics/composer/2.4/IComposerClient.hal b/graphics/composer/2.4/IComposerClient.hal
index c2102d5..f23536c 100644
--- a/graphics/composer/2.4/IComposerClient.hal
+++ b/graphics/composer/2.4/IComposerClient.hal
@@ -20,10 +20,23 @@
 import @2.1::Config;
 import @2.1::Display;
 import @2.1::Error;
+import @2.1::IComposerClient;
 import @2.3::IComposerClient;
 
 interface IComposerClient extends @2.3::IComposerClient {
     /**
+     * Display attributes queryable through getDisplayAttribute_2_4.
+     */
+    enum Attribute : @2.1::IComposerClient.Attribute {
+        /**
+         * The configuration group ID (as int32_t) this config is associated to.
+         * Switching between configurations within the same group may be done seamlessly
+         * in some conditions via setActiveConfigWithConstraints.
+         */
+        CONFIG_GROUP = 7,
+    };
+
+    /**
      * Required capabilities which are supported by the display. The
      * particular set of supported capabilities for a given display may be
      * retrieved using getDisplayCapabilities.
@@ -60,6 +73,7 @@
          * (i.e., the vsync period must not change before this time).
          */
         int64_t desiredTimeNanos;
+
         /**
          * If true, requires that the vsync period change must happen seamlessly without
          * a noticeable visual artifact.
@@ -74,7 +88,6 @@
      *
      * @param callback is the IComposerCallback object.
      */
-    @entry
     registerCallback_2_4(IComposerCallback callback);
 
     /**
@@ -99,25 +112,29 @@
     getDisplayConnectionType(Display display) generates (Error error, DisplayConnectionType type);
 
     /**
-     * Provides a list of the vsync periods supported by the display in the given configuration
+     * Returns a display attribute value for a particular display
+     * configuration.
      *
-     * @param display is the display for which the vsync periods are queried.
-     * @param config is the display configuration for which the vsync periods are queried.
-     *
+     * @param display is the display to query.
+     * @param config is the display configuration for which to return
+     *        attribute values.
      * @return error is NONE upon success. Otherwise,
-     *     BAD_DISPLAY when an invalid display handle was passed in.
-     *     BAD_CONFIG when an invalid config handle was passed in.
-     * @return supportedVsyncPeriods is a list of supported vsync periods.
+     *         BAD_DISPLAY when an invalid display handle was passed in.
+     *         BAD_CONFIG when config does not name a valid configuration for
+     *                    this display.
+     *         BAD_PARAMETER when attribute is unrecognized.
+     *         UNSUPPORTED when attribute cannot be queried for the config.
+     * @return value is the value of the attribute.
      */
-    getSupportedDisplayVsyncPeriods(Display display, Config config)
-        generates (Error error, vec<VsyncPeriodNanos> supportedVsyncPeriods);
+    getDisplayAttribute_2_4(Display display, Config config, Attribute attribute)
+        generates (Error error, int32_t value);
 
     /**
      * Retrieves which vsync period the display is currently using.
      *
      * If no display configuration is currently active, this function must
      * return BAD_CONFIG. If the vsync period is about to change due to a
-     * setActiveConfigAndVsyncPeriod call, this function must return the current vsync period
+     * setActiveConfigWithConstraints call, this function must return the current vsync period
      * until the change takes place.
      *
      * @param display is the display for which the vsync period is queried.
@@ -131,7 +148,8 @@
 
     /**
      * Sets the active configuration and the refresh rate for this display.
-     * If the config is the same as the current config, only the vsync period shall change.
+     * If the new config shares the same config group as the current config,
+     * only the vsync period shall change.
      * Upon returning, the given display configuration, except vsync period, must be active and
      * remain so until either this function is called again or the display is disconnected.
      * When the display starts to refresh at the new vsync period, onVsync_2_4 callback must be
@@ -139,21 +157,19 @@
      *
      * @param display is the display for which the active config is set.
      * @param config is the new display configuration.
-     * @param vsyncPeriodNanos is the new display vsync period.
      * @param vsyncPeriodChangeConstraints are the constraints required for changing vsync period.
      *
      * @return error is NONE upon success. Otherwise,
      *         BAD_DISPLAY when an invalid display handle was passed in.
      *         BAD_CONFIG when the configuration handle passed in is not valid
      *                    for this display.
-     *         BAD_VSYNC_PERIOD when an invalid vsync period is passed in.
+     *         SEAMLESS_NOT_ALLOWED when seamlessRequired was true but config provided doesn't
+     *                              share the same config group as the current config.
      *         SEAMLESS_NOT_POSSIBLE when seamlessRequired was true but the display cannot achieve
      *                               the vsync period change without a noticeable visual artifact.
-     * @return newVsyncAppliedTime is the time in CLOCK_MONOTONIC when the new display will start to
-     *                             refresh at the new vsync period.
+     * @return timeline is the timeline for the vsync period change.
      */
-    setActiveConfigAndVsyncPeriod(Display display, Config config,
-        VsyncPeriodNanos vsyncPeriodNanos,
+    setActiveConfigWithConstraints(Display display, Config config,
         VsyncPeriodChangeConstraints vsyncPeriodChangeConstraints)
-        generates (Error error, int64_t newVsyncAppliedTime);
+        generates (Error error, VsyncPeriodChangeTimeline timeline);
 };