Add proper namespace to GraphicTypes.
Renamed GraphicsTypes.h to GraphicTypes.h and added proper namespace to avoid
naming conflict.
BUG: 77156734
Test: Build and flash
Change-Id: Ibd9f454b5b72d5f8c6d94a3869a60a1bf821f106
Merged-In: Ibd9f454b5b72d5f8c6d94a3869a60a1bf821f106
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index fe0b30b..bab6a71 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -49,13 +49,12 @@
#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h>
#include <configstore/Utils.h>
-// ----------------------------------------------------------------------------
-using namespace android;
-// ----------------------------------------------------------------------------
+namespace android {
// retrieve triple buffer setting from configstore
using namespace android::hardware::configstore;
using namespace android::hardware::configstore::V1_0;
+using android::ui::ColorMode;
/*
* Initialize the display to the specified values.
@@ -474,3 +473,5 @@
viewport.makeInvalid();
frame.makeInvalid();
}
+
+} // namespace android
diff --git a/services/surfaceflinger/DisplayDevice.h b/services/surfaceflinger/DisplayDevice.h
index fbb0d46..df729f5 100644
--- a/services/surfaceflinger/DisplayDevice.h
+++ b/services/surfaceflinger/DisplayDevice.h
@@ -31,7 +31,7 @@
#include <gui/ISurfaceComposer.h>
#include <hardware/hwcomposer_defs.h>
-#include <ui/GraphicsTypes.h>
+#include <ui/GraphicTypes.h>
#include "RenderArea.h"
#include "RenderEngine/Surface.h"
@@ -161,8 +161,8 @@
void setPowerMode(int mode);
bool isDisplayOn() const;
- ColorMode getActiveColorMode() const;
- void setActiveColorMode(ColorMode mode);
+ ui::ColorMode getActiveColorMode() const;
+ void setActiveColorMode(ui::ColorMode mode);
void setCompositionDataSpace(android_dataspace dataspace);
/* ------------------------------------------------------------------------
@@ -236,7 +236,7 @@
// Current active config
int mActiveConfig;
// current active color mode
- ColorMode mActiveColorMode;
+ ui::ColorMode mActiveColorMode;
// Need to know if display is wide-color capable or not.
// Initialized by SurfaceFlinger when the DisplayDevice is created.
@@ -285,7 +285,7 @@
bool needsFiltering() const override { return mDevice->needsFiltering(); }
Rect getSourceCrop() const override { return mSourceCrop; }
bool getWideColorSupport() const override { return mDevice->getWideColorSupport(); }
- ColorMode getActiveColorMode() const override {
+ ui::ColorMode getActiveColorMode() const override {
return mDevice->getActiveColorMode();
}
diff --git a/services/surfaceflinger/DisplayHardware/HWC2.cpp b/services/surfaceflinger/DisplayHardware/HWC2.cpp
index 0c77aba..98daec3 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWC2.cpp
@@ -362,20 +362,10 @@
return Error::None;
}
-Error Display::getColorModes(std::vector<android::ColorMode>* outModes) const
+Error Display::getColorModes(std::vector<android::ui::ColorMode>* outModes) const
{
- std::vector<android::ColorMode> modes;
- auto intError = mComposer.getColorModes(mId, &modes);
- uint32_t numModes = modes.size();
- auto error = static_cast<Error>(intError);
- if (error != Error::None) {
- return error;
- }
-
- outModes->resize(numModes);
- for (size_t i = 0; i < numModes; i++) {
- (*outModes)[i] = modes[i];
- }
+ auto intError = mComposer.getColorModes(mId, outModes);
+ return static_cast<Error>(intError);
return Error::None;
}
@@ -537,7 +527,7 @@
return static_cast<Error>(intError);
}
-Error Display::setColorMode(android::ColorMode mode)
+Error Display::setColorMode(android::ui::ColorMode mode)
{
auto intError = mComposer.setColorMode(mId, mode);
return static_cast<Error>(intError);
diff --git a/services/surfaceflinger/DisplayHardware/HWC2.h b/services/surfaceflinger/DisplayHardware/HWC2.h
index 5b53b54..71c094a 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2.h
+++ b/services/surfaceflinger/DisplayHardware/HWC2.h
@@ -25,7 +25,7 @@
#include <gui/HdrMetadata.h>
#include <math/mat4.h>
-#include <ui/GraphicsTypes.h>
+#include <ui/GraphicTypes.h>
#include <ui/HdrCapabilities.h>
#include <utils/Log.h>
@@ -211,7 +211,7 @@
[[clang::warn_unused_result]] Error getChangedCompositionTypes(
std::unordered_map<Layer*, Composition>* outTypes);
[[clang::warn_unused_result]] Error getColorModes(
- std::vector<android::ColorMode>* outModes) const;
+ std::vector<android::ui::ColorMode>* outModes) const;
// Doesn't call into the HWC2 device, so no errors are possible
std::vector<std::shared_ptr<const Config>> getConfigs() const;
@@ -235,7 +235,8 @@
uint32_t slot, const android::sp<android::GraphicBuffer>& target,
const android::sp<android::Fence>& acquireFence,
android_dataspace_t dataspace);
- [[clang::warn_unused_result]] Error setColorMode(android::ColorMode mode);
+ [[clang::warn_unused_result]] Error setColorMode(
+ android::ui::ColorMode mode);
[[clang::warn_unused_result]] Error setColorTransform(
const android::mat4& matrix, android_color_transform_t hint);
[[clang::warn_unused_result]] Error setOutputBuffer(
@@ -246,8 +247,8 @@
[[clang::warn_unused_result]] Error validate(uint32_t* outNumTypes,
uint32_t* outNumRequests);
[[clang::warn_unused_result]] Error presentOrValidate(uint32_t* outNumTypes,
- uint32_t* outNumRequests,
- android::sp<android::Fence>* outPresentFence, uint32_t* state);
+ uint32_t* outNumRequests,
+ android::sp<android::Fence>* outPresentFence, uint32_t* state);
// Other Display methods
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index 6d5917d..6bf2ee9 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -311,8 +311,8 @@
return config;
}
-std::vector<ColorMode> HWComposer::getColorModes(int32_t displayId) const {
- std::vector<ColorMode> modes;
+std::vector<ui::ColorMode> HWComposer::getColorModes(int32_t displayId) const {
+ std::vector<ui::ColorMode> modes;
if (!isValidDisplay(displayId)) {
ALOGE("getColorModes: Attempted to access invalid display %d",
@@ -324,13 +324,13 @@
if (error != HWC2::Error::None) {
ALOGE("getColorModes failed for display %d: %s (%d)", displayId,
to_string(error).c_str(), static_cast<int32_t>(error));
- return std::vector<ColorMode>();
+ return std::vector<ui::ColorMode>();
}
return modes;
}
-status_t HWComposer::setActiveColorMode(int32_t displayId, ColorMode mode) {
+status_t HWComposer::setActiveColorMode(int32_t displayId, ui::ColorMode mode) {
if (!isValidDisplay(displayId)) {
ALOGE("setActiveColorMode: Display %d is not valid", displayId);
return BAD_INDEX;
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h
index c442b2f..0366a0d 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.h
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.h
@@ -23,7 +23,7 @@
#include <sys/types.h>
#include <ui/Fence.h>
-#include <ui/GraphicsTypes.h>
+#include <ui/GraphicTypes.h>
#include <utils/BitSet.h>
#include <utils/Condition.h>
@@ -159,9 +159,9 @@
std::shared_ptr<const HWC2::Display::Config>
getActiveConfig(int32_t displayId) const;
- std::vector<ColorMode> getColorModes(int32_t displayId) const;
+ std::vector<ui::ColorMode> getColorModes(int32_t displayId) const;
- status_t setActiveColorMode(int32_t displayId, ColorMode mode);
+ status_t setActiveColorMode(int32_t displayId, ui::ColorMode mode);
bool isUsingVrComposer() const;
diff --git a/services/surfaceflinger/RenderArea.h b/services/surfaceflinger/RenderArea.h
index b9c4909..bf0707f 100644
--- a/services/surfaceflinger/RenderArea.h
+++ b/services/surfaceflinger/RenderArea.h
@@ -1,6 +1,6 @@
#pragma once
-#include <ui/GraphicsTypes.h>
+#include <ui/GraphicTypes.h>
#include "Transform.h"
@@ -32,7 +32,7 @@
int getReqWidth() const { return mReqWidth; };
Transform::orientation_flags getRotationFlags() const { return mRotationFlags; };
virtual bool getWideColorSupport() const = 0;
- virtual ColorMode getActiveColorMode() const = 0;
+ virtual ui::ColorMode getActiveColorMode() const = 0;
status_t updateDimensions();
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 5c69b98..09e67b6 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -104,6 +104,7 @@
using namespace android::hardware::configstore;
using namespace android::hardware::configstore::V1_0;
+using ui::ColorMode;
namespace {
class ConditionalLock {
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 42d8112..448509b 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -410,9 +410,9 @@
Vector<DisplayInfo>* configs);
virtual int getActiveConfig(const sp<IBinder>& display);
virtual status_t getDisplayColorModes(const sp<IBinder>& display,
- Vector<ColorMode>* configs);
- virtual ColorMode getActiveColorMode(const sp<IBinder>& display);
- virtual status_t setActiveColorMode(const sp<IBinder>& display, ColorMode colorMode);
+ Vector<ui::ColorMode>* configs);
+ virtual ui::ColorMode getActiveColorMode(const sp<IBinder>& display);
+ virtual status_t setActiveColorMode(const sp<IBinder>& display, ui::ColorMode colorMode);
virtual void setPowerMode(const sp<IBinder>& display, int mode);
virtual status_t setActiveConfig(const sp<IBinder>& display, int id);
virtual status_t clearAnimationFrameStats();
@@ -462,7 +462,7 @@
bool stateLockHeld);
// Called on the main thread in response to setActiveColorMode()
- void setActiveColorModeInternal(const sp<DisplayDevice>& hw, ColorMode colorMode);
+ void setActiveColorModeInternal(const sp<DisplayDevice>& hw, ui::ColorMode colorMode);
// Returns whether the transaction actually modified any state
bool handleMessageTransaction();
@@ -635,7 +635,7 @@
// Given a dataSpace, returns the appropriate color_mode to use
// to display that dataSpace.
- ColorMode pickColorMode(android_dataspace dataSpace) const;
+ ui::ColorMode pickColorMode(android_dataspace dataSpace) const;
android_dataspace bestTargetDataSpace(android_dataspace a, android_dataspace b,
bool hasHdr) const;
diff --git a/services/surfaceflinger/tests/hwc2/Hwc2Test.cpp b/services/surfaceflinger/tests/hwc2/Hwc2Test.cpp
index 86e2e1e..b3f1b69 100644
--- a/services/surfaceflinger/tests/hwc2/Hwc2Test.cpp
+++ b/services/surfaceflinger/tests/hwc2/Hwc2Test.cpp
@@ -22,7 +22,7 @@
#include <android-base/unique_fd.h>
#include <hardware/hardware.h>
#include <sync/sync.h>
-#include <ui/GraphicsTypes.h>
+#include <ui/GraphicTypes.h>
#define HWC2_INCLUDE_STRINGIFICATION
#define HWC2_USE_CPP11
@@ -35,7 +35,7 @@
#include "Hwc2TestClientTarget.h"
#include "Hwc2TestVirtualDisplay.h"
-using android::ColorMode;
+using android::ui::ColorMode;
void hwc2TestHotplugCallback(hwc2_callback_data_t callbackData,
hwc2_display_t display, int32_t connected);