composer: remove translate-ndk
- No one is using the translate functions, so removing.
- Rename the static_assert portion to Hidl2AidlAsserts
Test: build
Change-Id: I42abc37953e1d927a3bcf5f60f56acf99fde6bf5
diff --git a/graphics/composer/aidl/Android.bp b/graphics/composer/aidl/Android.bp
index 5f5b54e..2532a7a 100644
--- a/graphics/composer/aidl/Android.bp
+++ b/graphics/composer/aidl/Android.bp
@@ -55,20 +55,6 @@
},
}
-cc_library {
- name: "android.hardware.graphics.composer3-translate-ndk",
- vendor_available: true,
- srcs: ["android/hardware/graphics/composer3/translate-ndk.cpp"],
- shared_libs: [
- "libbinder_ndk",
- "libhidlbase",
- "android.hardware.graphics.composer3-V1-ndk",
- "android.hardware.graphics.composer@2.1",
- "android.hardware.graphics.composer@2.4",
- ],
- export_include_dirs: ["include"],
-}
-
cc_library_headers {
name: "android.hardware.graphics.composer3-command-buffer",
vendor_available: true,
@@ -88,3 +74,16 @@
],
export_include_dirs: ["include"],
}
+
+cc_test {
+ name: "android.hardware.graphics.composer3-hidl2aidl-asserts",
+ vendor_available: true,
+ srcs: ["android/hardware/graphics/composer3/Hidl2AidlAsserts.cpp"],
+ shared_libs: [
+ "libbinder_ndk",
+ "libhidlbase",
+ "android.hardware.graphics.composer3-V1-ndk",
+ "android.hardware.graphics.composer@2.1",
+ "android.hardware.graphics.composer@2.4",
+ ],
+}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/translate-ndk.cpp b/graphics/composer/aidl/android/hardware/graphics/composer3/Hidl2AidlAsserts.cpp
similarity index 81%
rename from graphics/composer/aidl/android/hardware/graphics/composer3/translate-ndk.cpp
rename to graphics/composer/aidl/android/hardware/graphics/composer3/Hidl2AidlAsserts.cpp
index c2a4fdd..d34b405 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/translate-ndk.cpp
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/Hidl2AidlAsserts.cpp
@@ -14,7 +14,33 @@
* limitations under the License.
*/
-#include "android/hardware/graphics/composer3/translate-ndk.h"
+#include "aidl/android/hardware/graphics/common/BlendMode.h"
+#include "aidl/android/hardware/graphics/common/FRect.h"
+#include "aidl/android/hardware/graphics/common/Rect.h"
+#include "aidl/android/hardware/graphics/composer3/Capability.h"
+#include "aidl/android/hardware/graphics/composer3/ClientTargetProperty.h"
+#include "aidl/android/hardware/graphics/composer3/Color.h"
+#include "aidl/android/hardware/graphics/composer3/Composition.h"
+#include "aidl/android/hardware/graphics/composer3/ContentType.h"
+#include "aidl/android/hardware/graphics/composer3/DisplayAttribute.h"
+#include "aidl/android/hardware/graphics/composer3/DisplayCapability.h"
+#include "aidl/android/hardware/graphics/composer3/DisplayConnectionType.h"
+#include "aidl/android/hardware/graphics/composer3/FloatColor.h"
+#include "aidl/android/hardware/graphics/composer3/FormatColorComponent.h"
+#include "aidl/android/hardware/graphics/composer3/IComposer.h"
+#include "aidl/android/hardware/graphics/composer3/PerFrameMetadata.h"
+#include "aidl/android/hardware/graphics/composer3/PerFrameMetadataBlob.h"
+#include "aidl/android/hardware/graphics/composer3/PerFrameMetadataKey.h"
+#include "aidl/android/hardware/graphics/composer3/PowerMode.h"
+#include "aidl/android/hardware/graphics/composer3/VsyncPeriodChangeConstraints.h"
+#include "aidl/android/hardware/graphics/composer3/VsyncPeriodChangeTimeline.h"
+#include "android/hardware/graphics/composer/2.1/IComposer.h"
+#include "android/hardware/graphics/composer/2.1/IComposerCallback.h"
+#include "android/hardware/graphics/composer/2.1/IComposerClient.h"
+#include "android/hardware/graphics/composer/2.2/IComposerClient.h"
+#include "android/hardware/graphics/composer/2.3/IComposerClient.h"
+#include "android/hardware/graphics/composer/2.4/IComposerClient.h"
+#include "android/hardware/graphics/composer/2.4/types.h"
namespace android::h2a {
@@ -325,122 +351,4 @@
aidl::android::hardware::graphics::composer3::PresentOrValidate::Result::Validated ==
static_cast<aidl::android::hardware::graphics::composer3::PresentOrValidate::Result>(0));
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_4::VsyncPeriodChangeTimeline& in,
- aidl::android::hardware::graphics::composer3::VsyncPeriodChangeTimeline* out) {
- out->newVsyncAppliedTimeNanos = static_cast<int64_t>(in.newVsyncAppliedTimeNanos);
- out->refreshRequired = static_cast<bool>(in.refreshRequired);
- out->refreshTimeNanos = static_cast<int64_t>(in.refreshTimeNanos);
- return true;
-}
-
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_1::IComposerClient::Rect& in,
- aidl::android::hardware::graphics::common::Rect* out) {
- out->left = static_cast<int32_t>(in.left);
- out->top = static_cast<int32_t>(in.top);
- out->right = static_cast<int32_t>(in.right);
- out->bottom = static_cast<int32_t>(in.bottom);
- return true;
-}
-
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_1::IComposerClient::FRect& in,
- aidl::android::hardware::graphics::common::FRect* out) {
- out->left = static_cast<float>(in.left);
- out->top = static_cast<float>(in.top);
- out->right = static_cast<float>(in.right);
- out->bottom = static_cast<float>(in.bottom);
- return true;
-}
-
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_1::IComposerClient::Color& in,
- aidl::android::hardware::graphics::composer3::Color* out) {
- // FIXME This requires conversion between signed and unsigned. Change this if it doesn't suit
- // your needs.
- if (in.r > std::numeric_limits<int8_t>::max() || in.r < 0) {
- return false;
- }
- out->r = static_cast<int8_t>(in.r);
- // FIXME This requires conversion between signed and unsigned. Change this if it doesn't suit
- // your needs.
- if (in.g > std::numeric_limits<int8_t>::max() || in.g < 0) {
- return false;
- }
- out->g = static_cast<int8_t>(in.g);
- // FIXME This requires conversion between signed and unsigned. Change this if it doesn't suit
- // your needs.
- if (in.b > std::numeric_limits<int8_t>::max() || in.b < 0) {
- return false;
- }
- out->b = static_cast<int8_t>(in.b);
- // FIXME This requires conversion between signed and unsigned. Change this if it doesn't suit
- // your needs.
- if (in.a > std::numeric_limits<int8_t>::max() || in.a < 0) {
- return false;
- }
- out->a = static_cast<int8_t>(in.a);
- return true;
-}
-
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_3::IComposerClient::PerFrameMetadata& in,
- aidl::android::hardware::graphics::composer3::PerFrameMetadata* out) {
- out->key =
- static_cast<aidl::android::hardware::graphics::composer3::PerFrameMetadataKey>(in.key);
- out->value = static_cast<float>(in.value);
- return true;
-}
-
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_2::IComposerClient::FloatColor& in,
- aidl::android::hardware::graphics::composer3::FloatColor* out) {
- out->r = static_cast<float>(in.r);
- out->g = static_cast<float>(in.g);
- out->b = static_cast<float>(in.b);
- out->a = static_cast<float>(in.a);
- return true;
-}
-
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_3::IComposerClient::PerFrameMetadataBlob&
- in,
- aidl::android::hardware::graphics::composer3::PerFrameMetadataBlob* out) {
- out->key =
- static_cast<aidl::android::hardware::graphics::composer3::PerFrameMetadataKey>(in.key);
- {
- size_t size = in.blob.size();
- for (size_t i = 0; i < size; i++) {
- // FIXME This requires conversion between signed and unsigned. Change this if it doesn't
- // suit your needs.
- if (in.blob[i] > std::numeric_limits<int8_t>::max() || in.blob[i] < 0) {
- return false;
- }
- out->blob.push_back(static_cast<int8_t>(in.blob[i]));
- }
- }
- return true;
-}
-
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_4::IComposerClient::
- VsyncPeriodChangeConstraints& in,
- aidl::android::hardware::graphics::composer3::VsyncPeriodChangeConstraints* out) {
- out->desiredTimeNanos = static_cast<int64_t>(in.desiredTimeNanos);
- out->seamlessRequired = static_cast<bool>(in.seamlessRequired);
- return true;
-}
-
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_4::IComposerClient::ClientTargetProperty&
- in,
- aidl::android::hardware::graphics::composer3::ClientTargetProperty* out) {
- out->pixelFormat =
- static_cast<aidl::android::hardware::graphics::common::PixelFormat>(in.pixelFormat);
- out->dataspace =
- static_cast<aidl::android::hardware::graphics::common::Dataspace>(in.dataspace);
- return true;
-}
-
} // namespace android::h2a
diff --git a/graphics/composer/aidl/include/android/hardware/graphics/composer3/translate-ndk.h b/graphics/composer/aidl/include/android/hardware/graphics/composer3/translate-ndk.h
deleted file mode 100644
index 3a92ae6..0000000
--- a/graphics/composer/aidl/include/android/hardware/graphics/composer3/translate-ndk.h
+++ /dev/null
@@ -1,81 +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.
- */
-
-#pragma once
-
-#include <limits>
-#include "aidl/android/hardware/graphics/common/BlendMode.h"
-#include "aidl/android/hardware/graphics/common/FRect.h"
-#include "aidl/android/hardware/graphics/common/Rect.h"
-#include "aidl/android/hardware/graphics/composer3/Capability.h"
-#include "aidl/android/hardware/graphics/composer3/ClientTargetProperty.h"
-#include "aidl/android/hardware/graphics/composer3/Color.h"
-#include "aidl/android/hardware/graphics/composer3/Composition.h"
-#include "aidl/android/hardware/graphics/composer3/ContentType.h"
-#include "aidl/android/hardware/graphics/composer3/DisplayAttribute.h"
-#include "aidl/android/hardware/graphics/composer3/DisplayCapability.h"
-#include "aidl/android/hardware/graphics/composer3/DisplayConnectionType.h"
-#include "aidl/android/hardware/graphics/composer3/FloatColor.h"
-#include "aidl/android/hardware/graphics/composer3/FormatColorComponent.h"
-#include "aidl/android/hardware/graphics/composer3/IComposer.h"
-#include "aidl/android/hardware/graphics/composer3/PerFrameMetadata.h"
-#include "aidl/android/hardware/graphics/composer3/PerFrameMetadataBlob.h"
-#include "aidl/android/hardware/graphics/composer3/PerFrameMetadataKey.h"
-#include "aidl/android/hardware/graphics/composer3/PowerMode.h"
-#include "aidl/android/hardware/graphics/composer3/VsyncPeriodChangeConstraints.h"
-#include "aidl/android/hardware/graphics/composer3/VsyncPeriodChangeTimeline.h"
-#include "android/hardware/graphics/composer/2.1/IComposer.h"
-#include "android/hardware/graphics/composer/2.1/IComposerCallback.h"
-#include "android/hardware/graphics/composer/2.1/IComposerClient.h"
-#include "android/hardware/graphics/composer/2.2/IComposerClient.h"
-#include "android/hardware/graphics/composer/2.3/IComposerClient.h"
-#include "android/hardware/graphics/composer/2.4/IComposerClient.h"
-#include "android/hardware/graphics/composer/2.4/types.h"
-
-namespace android::h2a {
-
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_4::VsyncPeriodChangeTimeline& in,
- aidl::android::hardware::graphics::composer3::VsyncPeriodChangeTimeline* out);
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_1::IComposerClient::Rect& in,
- aidl::android::hardware::graphics::common::Rect* out);
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_1::IComposerClient::FRect& in,
- aidl::android::hardware::graphics::common::FRect* out);
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_1::IComposerClient::Color& in,
- aidl::android::hardware::graphics::composer3::Color* out);
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_3::IComposerClient::PerFrameMetadata& in,
- aidl::android::hardware::graphics::composer3::PerFrameMetadata* out);
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_2::IComposerClient::FloatColor& in,
- aidl::android::hardware::graphics::composer3::FloatColor* out);
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_3::IComposerClient::PerFrameMetadataBlob&
- in,
- aidl::android::hardware::graphics::composer3::PerFrameMetadataBlob* out);
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_4::IComposerClient::
- VsyncPeriodChangeConstraints& in,
- aidl::android::hardware::graphics::composer3::VsyncPeriodChangeConstraints* out);
-__attribute__((warn_unused_result)) bool translate(
- const ::android::hardware::graphics::composer::V2_4::IComposerClient::ClientTargetProperty&
- in,
- aidl::android::hardware::graphics::composer3::ClientTargetProperty* out);
-
-} // namespace android::h2a