composer: DisplayCommand.colorTransform is just a matrix

Remove the hint from DisplayCommand.colorTransform as currently
we only use ColorTransform::IDENTITY and ColorTransform::ARBITRARY_MATRIX,
which both can be expressed using a matrix.

Bug: 208879711
Test: VTS
Change-Id: Ibb24593e3d0af5afdc8f3f79de2fc22eeccfcea8
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ColorTransformPayload.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ColorTransformPayload.aidl
deleted file mode 100644
index df07c9c..0000000
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ColorTransformPayload.aidl
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Copyright (c) 2021, 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;
-@VintfStability
-parcelable ColorTransformPayload {
-  float[] matrix;
-  android.hardware.graphics.common.ColorTransform hint;
-}
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCommand.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCommand.aidl
index 35a1eed..3382633 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCommand.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCommand.aidl
@@ -36,7 +36,7 @@
 parcelable DisplayCommand {
   long display;
   android.hardware.graphics.composer3.LayerCommand[] layers;
-  @nullable android.hardware.graphics.composer3.ColorTransformPayload colorTransform;
+  @nullable float[] colorTransformMatrix;
   @nullable android.hardware.graphics.composer3.ClientTarget clientTarget;
   @nullable android.hardware.graphics.composer3.Buffer virtualDisplayOutputBuffer;
   @nullable android.hardware.graphics.composer3.ClockMonotonicTimestamp expectedPresentTime;
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ColorTransformPayload.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ColorTransformPayload.aidl
deleted file mode 100644
index fc37dac..0000000
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/ColorTransformPayload.aidl
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * Copyright (c) 2021, 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;
-
-import android.hardware.graphics.common.ColorTransform;
-
-@VintfStability
-parcelable ColorTransformPayload {
-    /**
-     * 4x4 transform matrix (16 floats) as described in DisplayCommand.colorTransform.
-     */
-    float[] matrix;
-
-    /**
-     * Hint value which may be used instead of the given matrix unless it
-     * is ColorTransform.ARBITRARY.
-     */
-    ColorTransform hint;
-}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl
index fdaf35a..18461ad 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl
@@ -19,7 +19,6 @@
 import android.hardware.graphics.composer3.Buffer;
 import android.hardware.graphics.composer3.ClientTarget;
 import android.hardware.graphics.composer3.ClockMonotonicTimestamp;
-import android.hardware.graphics.composer3.ColorTransformPayload;
 import android.hardware.graphics.composer3.LayerCommand;
 
 @VintfStability
@@ -39,11 +38,7 @@
     /**
      * Sets a color transform which will be applied after composition.
      *
-     * If hint is not ColorTransform.ARBITRARY, then the device may use the
-     * hint to apply the desired color transform instead of using the color
-     * matrix directly.
-     *
-     * If the device is not capable of either using the hint or the matrix to
+     * If the device is not capable of either using the matrix to
      * apply the desired color transform, it must force all layers to client
      * composition during VALIDATE_DISPLAY.
      *
@@ -71,7 +66,7 @@
      * B_out = R_in * r.b + G_in * g.b + B_in * b.b + Tb
      *
      */
-    @nullable ColorTransformPayload colorTransform;
+    @nullable float[] colorTransformMatrix;
 
     /**
      * Sets the buffer handle which will receive the output of client
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_TargetTest.cpp
index 19b1fb2..e8dd61c 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_TargetTest.cpp
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_TargetTest.cpp
@@ -1503,7 +1503,7 @@
 };
 
 TEST_P(GraphicsComposerAidlCommandTest, SET_COLOR_TRANSFORM) {
-    mWriter.setColorTransform(mPrimaryDisplay, kIdentity.data(), ColorTransform::IDENTITY);
+    mWriter.setColorTransform(mPrimaryDisplay, kIdentity.data());
     execute();
 }
 
diff --git a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h
index dc15ea0..be31d79 100644
--- a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h
+++ b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h
@@ -75,11 +75,11 @@
         mCommands.clear();
     }
 
-    void setColorTransform(int64_t display, const float* matrix, ColorTransform hint) {
-        ColorTransformPayload colorTransformPayload;
-        colorTransformPayload.matrix.assign(matrix, matrix + 16);
-        colorTransformPayload.hint = hint;
-        getDisplayCommand(display).colorTransform.emplace(std::move(colorTransformPayload));
+    void setColorTransform(int64_t display, const float* matrix) {
+        std::vector<float> matVec;
+        matVec.reserve(16);
+        matVec.assign(matrix, matrix + 16);
+        getDisplayCommand(display).colorTransformMatrix.emplace(std::move(matVec));
     }
 
     void setClientTarget(int64_t display, uint32_t slot, const native_handle_t* target,