Add composer API changes in accordance to partner feedback

* Add a DimmingStage to the client target configuration reported by HWC,
  which may be used for some vendor color modes to configure when
  dimming should occur during client composition
* Communicate the display brightness in nits, so that HWC
  implementations do not need to parse the per-display xml to map from
  display brightness to nits. Furthermore, this is more plausible for
  extensibility for external displays.

Bug: 220396224
Bug: 218954037
Test: builds
Change-Id: I5675c16f0895f9958e3bee3ee4c85df8937ecdb7
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DimmingStage.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DimmingStage.aidl
new file mode 100644
index 0000000..44457f8
--- /dev/null
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DimmingStage.aidl
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) 2022, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.graphics.composer3;
+@Backing(type="int") @VintfStability
+enum DimmingStage {
+  NONE = 0,
+  LINEAR = 1,
+  GAMMA_OETF = 2,
+}
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayBrightness.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayBrightness.aidl
index be623df..e765189 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayBrightness.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayBrightness.aidl
@@ -35,4 +35,5 @@
 @VintfStability
 parcelable DisplayBrightness {
   float brightness;
+  float brightnessNits;
 }
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DimmingStage.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DimmingStage.aidl
new file mode 100644
index 0000000..f732d41
--- /dev/null
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DimmingStage.aidl
@@ -0,0 +1,35 @@
+/**
+ * Copyright (c) 2022, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.graphics.composer3;
+
+@VintfStability
+@Backing(type="int")
+enum DimmingStage {
+    /**
+     * Corresponds to if the dimming stage is not meaningful for a scene, such as
+     * if client composition is not requesting dimming.
+     */
+    NONE = 0,
+    /**
+     * Dimming operations must be applied in linear optical space
+     */
+    LINEAR = 1,
+    /**
+     * Dimming operations must be applied in gamma space, after OETF has been applied
+     */
+    GAMMA_OETF = 2,
+}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayBrightness.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayBrightness.aidl
index f66b235..51f4db5 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayBrightness.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayBrightness.aidl
@@ -20,7 +20,16 @@
 parcelable DisplayBrightness {
     /**
      * A number between 0.0f (minimum brightness) and 1.0f (maximum brightness), a negative value to
-     * turn the backlight off.
+     * turn the backlight off
      */
     float brightness;
+
+    /**
+     * The absolute brightness in nits of the backlight, if it is available. This will be a negative
+     * value if it is not known.
+     *
+     * An implementation may choose to use this value to assist with tone-mapping, as a mapping
+     * between the brightness float and the nits may not otherwise be known.
+     */
+    float brightnessNits;
 }