[Native] Replace android_color_mode usage with ColorMode.
To ease the pain when we add color mode v1.1, we replace all current
android_color_mode usage in framework native with ColorMode directly from HAL.
BUG: 73824924
Test: Build & flash
Change-Id: I4436fc225c7807506825c7148bc794cb99f278dc
diff --git a/libs/ui/DebugUtils.cpp b/libs/ui/DebugUtils.cpp
index 17ebf80..d7e191d 100644
--- a/libs/ui/DebugUtils.cpp
+++ b/libs/ui/DebugUtils.cpp
@@ -22,6 +22,7 @@
#include <string>
using android::base::StringPrintf;
+using android::ColorMode;
std::string decodeStandard(android_dataspace dataspace) {
const uint32_t dataspaceSelect = (dataspace & HAL_DATASPACE_STANDARD_MASK);
@@ -197,37 +198,37 @@
decodeRange(dataspace).c_str());
}
-std::string decodeColorMode(android_color_mode colorMode) {
+std::string decodeColorMode(ColorMode colorMode) {
switch (colorMode) {
- case HAL_COLOR_MODE_NATIVE:
- return std::string("HAL_COLOR_MODE_NATIVE");
+ case ColorMode::NATIVE:
+ return std::string("ColorMode::NATIVE");
- case HAL_COLOR_MODE_STANDARD_BT601_625:
- return std::string("HAL_COLOR_MODE_BT601_625");
+ case ColorMode::STANDARD_BT601_625:
+ return std::string("ColorMode::BT601_625");
- case HAL_COLOR_MODE_STANDARD_BT601_625_UNADJUSTED:
- return std::string("HAL_COLOR_MODE_BT601_625_UNADJUSTED");
+ case ColorMode::STANDARD_BT601_625_UNADJUSTED:
+ return std::string("ColorMode::BT601_625_UNADJUSTED");
- case HAL_COLOR_MODE_STANDARD_BT601_525:
- return std::string("HAL_COLOR_MODE_BT601_525");
+ case ColorMode::STANDARD_BT601_525:
+ return std::string("ColorMode::BT601_525");
- case HAL_COLOR_MODE_STANDARD_BT601_525_UNADJUSTED:
- return std::string("HAL_COLOR_MODE_BT601_525_UNADJUSTED");
+ case ColorMode::STANDARD_BT601_525_UNADJUSTED:
+ return std::string("ColorMode::BT601_525_UNADJUSTED");
- case HAL_COLOR_MODE_STANDARD_BT709:
- return std::string("HAL_COLOR_MODE_BT709");
+ case ColorMode::STANDARD_BT709:
+ return std::string("ColorMode::BT709");
- case HAL_COLOR_MODE_DCI_P3:
- return std::string("HAL_COLOR_MODE_DCI_P3");
+ case ColorMode::DCI_P3:
+ return std::string("ColorMode::DCI_P3");
- case HAL_COLOR_MODE_SRGB:
- return std::string("HAL_COLOR_MODE_SRGB");
+ case ColorMode::SRGB:
+ return std::string("ColorMode::SRGB");
- case HAL_COLOR_MODE_ADOBE_RGB:
- return std::string("HAL_COLOR_MODE_ADOBE_RGB");
+ case ColorMode::ADOBE_RGB:
+ return std::string("ColorMode::ADOBE_RGB");
- case HAL_COLOR_MODE_DISPLAY_P3:
- return std::string("HAL_COLOR_MODE_DISPLAY_P3");
+ case ColorMode::DISPLAY_P3:
+ return std::string("ColorMode::DISPLAY_P3");
}
return android::base::StringPrintf("Unknown color mode %d", colorMode);
diff --git a/libs/ui/include/ui/DebugUtils.h b/libs/ui/include/ui/DebugUtils.h
index dad9446..3370107 100644
--- a/libs/ui/include/ui/DebugUtils.h
+++ b/libs/ui/include/ui/DebugUtils.h
@@ -16,7 +16,7 @@
#pragma once
-#include <system/graphics.h>
+#include <ui/GraphicsTypes.h>
#include <ui/PixelFormat.h>
#include <string>
@@ -29,6 +29,6 @@
std::string decodeTransfer(android_dataspace dataspace);
std::string decodeRange(android_dataspace dataspace);
std::string dataspaceDetails(android_dataspace dataspace);
-std::string decodeColorMode(android_color_mode colormode);
+std::string decodeColorMode(android::ColorMode colormode);
std::string decodePixelFormat(android::PixelFormat format);
std::string to_string(const android::Rect& rect);
diff --git a/libs/ui/include/ui/GraphicsTypes.h b/libs/ui/include/ui/GraphicsTypes.h
new file mode 100644
index 0000000..fa9a812
--- /dev/null
+++ b/libs/ui/include/ui/GraphicsTypes.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2018 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 <android/hardware/graphics/common/1.1/types.h>
+#include <system/graphics.h>
+
+namespace android {
+
+using android::hardware::graphics::common::V1_0::ColorMode;
+
+} // namespace android