Fixing the HDR conversion aidls
Bug: 251168514
Test: atest VtsHalGraphicsComposer3_TargetTest
Change-Id: I10310dd26809bd546c41d3d16bebcba711e43a50
diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HdrConversionCapability.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HdrConversionCapability.aidl
index 66151ca..b74f7d7 100644
--- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HdrConversionCapability.aidl
+++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HdrConversionCapability.aidl
@@ -34,7 +34,7 @@
package android.hardware.graphics.common;
@VintfStability
parcelable HdrConversionCapability {
- android.hardware.graphics.common.ParcelableHdr sourceType;
- @nullable android.hardware.graphics.common.ParcelableHdr outputType;
+ android.hardware.graphics.common.Hdr sourceType;
+ android.hardware.graphics.common.Hdr outputType;
boolean addsLatency;
}
diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ParcelableHdr.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ParcelableHdr.aidl
deleted file mode 100644
index 788bd4e..0000000
--- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ParcelableHdr.aidl
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Copyright (c) 2023, 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.common;
-@VintfStability
-parcelable ParcelableHdr {
- android.hardware.graphics.common.Hdr hdr;
-}
diff --git a/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl b/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl
index 6107c4c..c9ba16b 100644
--- a/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl
+++ b/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl
@@ -24,7 +24,7 @@
@Backing(type="int")
enum Hdr {
/**
- * Invalid HDR type
+ * Invalid HDR type
*/
INVALID = 0,
/**
diff --git a/graphics/common/aidl/android/hardware/graphics/common/HdrConversionCapability.aidl b/graphics/common/aidl/android/hardware/graphics/common/HdrConversionCapability.aidl
index 53b3256..d8524a5 100644
--- a/graphics/common/aidl/android/hardware/graphics/common/HdrConversionCapability.aidl
+++ b/graphics/common/aidl/android/hardware/graphics/common/HdrConversionCapability.aidl
@@ -16,22 +16,26 @@
package android.hardware.graphics.common;
-import android.hardware.graphics.common.ParcelableHdr;
+import android.hardware.graphics.common.Hdr;
/**
* Output parameter for IComposerClient.getHdrConversionCapabilities
- *
- * @param sourceType is the HDR type that can be converted to outputType.
- *
- * @param outputType is the HDR type/ SDR that the source type can be converted to. The value null
- * is used to depict SDR outputType.
- *
- * @param addsLatency is false if no latency added due to HDR conversion from sourceType to
- * outputType, otherwise true.
*/
@VintfStability
parcelable HdrConversionCapability {
- ParcelableHdr sourceType;
- @nullable ParcelableHdr outputType;
+ /** sourceType is the HDR type that can be converted to outputType */
+ Hdr sourceType;
+
+ /**
+ * outputType is the HDR type/ SDR that the source type can be converted to. The value INVALID
+ * is used to depict SDR outputType.
+ */
+
+ Hdr outputType;
+
+ /**
+ * addsLatency is false if no latency added due to HDR conversion from sourceType to
+ * outputType, otherwise true.
+ */
boolean addsLatency;
}
diff --git a/graphics/common/aidl/android/hardware/graphics/common/HdrConversionStrategy.aidl b/graphics/common/aidl/android/hardware/graphics/common/HdrConversionStrategy.aidl
index f564e9f..71beaa0 100644
--- a/graphics/common/aidl/android/hardware/graphics/common/HdrConversionStrategy.aidl
+++ b/graphics/common/aidl/android/hardware/graphics/common/HdrConversionStrategy.aidl
@@ -15,25 +15,32 @@
*/
package android.hardware.graphics.common;
+
+import android.hardware.graphics.common.Hdr;
/**
* Input parameter for IComposerClient.setHdrConversionStrategy
- *
- * @param passthrough - When this parameter is set to true, HDR conversion is disabled by the
- * implementation. The output HDR type will change dynamically to match the content. This value is
- * never set to false, as other union values will be present in the false case.
- *
- * @param autoAllowedHdrTypes - When this parameter is set, the output HDR type is selected by the
- * implementation. The implementation is only allowed to set the output HDR type to the HDR types
- * present in this list. If conversion to any of the autoHdrTypes types is not possible, the
- * implementation should do no conversion.
- *
- * @param forceHdrConversion - When this parameter is set, the implementation should convert all
- * content to this HDR type, when possible. If not possible, the functionality should be similar to
- * passthrough=true.
*/
@VintfStability
union HdrConversionStrategy {
+ /**
+ * When this parameter is set to true, HDR conversion is disabled by the
+ * implementation. The output HDR type will change dynamically to match the content. This value
+ * is never set to false, as other union values will be present in the false case.
+ */
boolean passthrough = true;
- android.hardware.graphics.common.Hdr[] autoAllowedHdrTypes;
- android.hardware.graphics.common.Hdr forceHdrConversion;
+
+ /**
+ * When this parameter is set, the output HDR type is selected by the
+ * implementation. The implementation is only allowed to set the output HDR type to the HDR
+ * types present in this list. If conversion to any of the autoHdrTypes types is not possible,
+ * the implementation should do no conversion.
+ */
+ Hdr[] autoAllowedHdrTypes;
+
+ /**
+ * When this parameter is set, the implementation should convert all
+ * content to this HDR type, when possible. If not possible, the functionality should be similar
+ * to passthrough=true.
+ */
+ Hdr forceHdrConversion;
}
diff --git a/graphics/common/aidl/android/hardware/graphics/common/ParcelableHdr.aidl b/graphics/common/aidl/android/hardware/graphics/common/ParcelableHdr.aidl
deleted file mode 100644
index 9aff277..0000000
--- a/graphics/common/aidl/android/hardware/graphics/common/ParcelableHdr.aidl
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * Copyright (c) 2023, 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.common;
-
-import android.hardware.graphics.common.Hdr;
-
-@VintfStability
-parcelable ParcelableHdr {
- Hdr hdr;
-}
diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
index 1ecd405..746330b 100644
--- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
+++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
@@ -650,10 +650,10 @@
}
const auto& [status, conversionCapabilities] = mComposerClient->getHdrConversionCapabilities();
for (auto conversionCapability : conversionCapabilities) {
- if (conversionCapability.outputType) {
+ if (conversionCapability.outputType != common::Hdr::INVALID) {
common::HdrConversionStrategy hdrConversionStrategy;
hdrConversionStrategy.set<common::HdrConversionStrategy::Tag::forceHdrConversion>(
- conversionCapability.outputType->hdr);
+ conversionCapability.outputType);
const auto& [statusSet, preferredHdrOutputType] =
mComposerClient->setHdrConversionStrategy(hdrConversionStrategy);
EXPECT_TRUE(statusSet.isOk());
@@ -670,8 +670,8 @@
const auto& [status, conversionCapabilities] = mComposerClient->getHdrConversionCapabilities();
std::vector<aidl::android::hardware::graphics::common::Hdr> autoHdrTypes;
for (auto conversionCapability : conversionCapabilities) {
- if (conversionCapability.outputType) {
- autoHdrTypes.push_back(conversionCapability.outputType->hdr);
+ if (conversionCapability.outputType != common::Hdr::INVALID) {
+ autoHdrTypes.push_back(conversionCapability.outputType);
}
}
common::HdrConversionStrategy hdrConversionStrategy;