FTL: Pull Flags into namespace
Bug: 185536303
Test: Build
Change-Id: Ia9aafc78565414815dfc14732ce85b06fa96e17b
diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/LayerState.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/LayerState.h
index cb00e71..29d3366 100644
--- a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/LayerState.h
+++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/LayerState.h
@@ -16,20 +16,20 @@
#pragma once
+#include <string>
+
+#include <aidl/android/hardware/graphics/common/BufferUsage.h>
+#include <aidl/android/hardware/graphics/composer3/Composition.h>
#include <android-base/strings.h>
+#include <ftl/flags.h>
+#include <math/HashCombine.h>
+
#include <compositionengine/LayerFE.h>
#include <compositionengine/LayerFECompositionState.h>
#include <compositionengine/OutputLayer.h>
#include <compositionengine/impl/OutputLayerCompositionState.h>
-#include <ftl/Flags.h>
-
-#include <string>
#include "DisplayHardware/Hal.h"
-#include "math/HashCombine.h"
-
-#include <aidl/android/hardware/graphics/common/BufferUsage.h>
-#include <aidl/android/hardware/graphics/composer3/Composition.h>
namespace std {
template <typename T>
@@ -84,13 +84,13 @@
public:
virtual ~StateInterface() = default;
- virtual Flags<LayerStateField> update(const compositionengine::OutputLayer* layer) = 0;
+ virtual ftl::Flags<LayerStateField> update(const compositionengine::OutputLayer* layer) = 0;
virtual size_t getHash() const = 0;
virtual LayerStateField getField() const = 0;
- virtual Flags<LayerStateField> getFieldIfDifferent(const StateInterface* other) const = 0;
+ virtual ftl::Flags<LayerStateField> getFieldIfDifferent(const StateInterface* other) const = 0;
virtual bool equals(const StateInterface* other) const = 0;
@@ -152,12 +152,12 @@
~OutputLayerState() override = default;
// Returns this member's field flag if it was changed
- Flags<LayerStateField> update(const compositionengine::OutputLayer* layer) override {
+ ftl::Flags<LayerStateField> update(const compositionengine::OutputLayer* layer) override {
T newValue = mReader(layer);
return update(newValue);
}
- Flags<LayerStateField> update(const T& newValue) {
+ ftl::Flags<LayerStateField> update(const T& newValue) {
if (!mEquals(mValue, newValue)) {
mValue = newValue;
mHash = {};
@@ -176,14 +176,14 @@
return *mHash;
}
- Flags<LayerStateField> getFieldIfDifferent(const StateInterface* other) const override {
+ ftl::Flags<LayerStateField> getFieldIfDifferent(const StateInterface* other) const override {
if (other->getField() != FIELD) {
return {};
}
// The early return ensures that this downcast is sound
const OutputLayerState* otherState = static_cast<const OutputLayerState*>(other);
- return *this != *otherState ? FIELD : Flags<LayerStateField>{};
+ return *this != *otherState ? FIELD : ftl::Flags<LayerStateField>{};
}
bool equals(const StateInterface* other) const override {
@@ -215,7 +215,7 @@
LayerState(compositionengine::OutputLayer* layer);
// Returns which fields were updated
- Flags<LayerStateField> update(compositionengine::OutputLayer*);
+ ftl::Flags<LayerStateField> update(compositionengine::OutputLayer*);
// Computes a hash for this LayerState.
// The hash is only computed from NonUniqueFields, and excludes GraphicBuffers since they are
@@ -224,7 +224,7 @@
// Returns the bit-set of differing fields between this LayerState and another LayerState.
// This bit-set is based on NonUniqueFields only, and excludes GraphicBuffers.
- Flags<LayerStateField> getDifferingFields(const LayerState& other) const;
+ ftl::Flags<LayerStateField> getDifferingFields(const LayerState& other) const;
compositionengine::OutputLayer* getOutputLayer() const { return mOutputLayer; }
int32_t getId() const { return mId.get(); }
diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/Predictor.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/Predictor.h
index ef1560e..6be6735 100644
--- a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/Predictor.h
+++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/Predictor.h
@@ -16,6 +16,8 @@
#pragma once
+#include <ftl/flags.h>
+
#include <compositionengine/impl/planner/LayerState.h>
namespace android::compositionengine::impl::planner {
@@ -35,7 +37,7 @@
// This implies that only one layer is allowed to differ in an approximate match.
size_t differingIndex;
// Set of fields that differ for the differing layer in the approximate match.
- Flags<LayerStateField> differingFields;
+ ftl::Flags<LayerStateField> differingFields;
};
// Returns an approximate match when comparing this layer stack with the provided list of
diff --git a/services/surfaceflinger/CompositionEngine/src/planner/LayerState.cpp b/services/surfaceflinger/CompositionEngine/src/planner/LayerState.cpp
index c79ca0d..f439caf 100644
--- a/services/surfaceflinger/CompositionEngine/src/planner/LayerState.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/planner/LayerState.cpp
@@ -41,7 +41,7 @@
update(layer);
}
-Flags<LayerStateField> LayerState::update(compositionengine::OutputLayer* layer) {
+ftl::Flags<LayerStateField> LayerState::update(compositionengine::OutputLayer* layer) {
ALOGE_IF(mOutputLayer != layer && layer->getLayerFE().getSequence() != mId.get(),
"[%s] Expected mOutputLayer ID to never change: %d, %d", __func__,
layer->getLayerFE().getSequence(), mId.get());
@@ -50,7 +50,7 @@
// same, i.e., the LayerFE is the same. An example use-case is screen rotation.
mOutputLayer = layer;
- Flags<LayerStateField> differences;
+ ftl::Flags<LayerStateField> differences;
// Update the unique fields as well, since we have to set them at least
// once from the OutputLayer
@@ -76,8 +76,8 @@
return hash;
}
-Flags<LayerStateField> LayerState::getDifferingFields(const LayerState& other) const {
- Flags<LayerStateField> differences;
+ftl::Flags<LayerStateField> LayerState::getDifferingFields(const LayerState& other) const {
+ ftl::Flags<LayerStateField> differences;
auto myFields = getNonUniqueFields();
auto otherFields = other.getNonUniqueFields();
for (size_t i = 0; i < myFields.size(); ++i) {
diff --git a/services/surfaceflinger/CompositionEngine/src/planner/Planner.cpp b/services/surfaceflinger/CompositionEngine/src/planner/Planner.cpp
index 74d2701..c8413eb 100644
--- a/services/surfaceflinger/CompositionEngine/src/planner/Planner.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/planner/Planner.cpp
@@ -97,7 +97,7 @@
if (const auto layerEntry = mPreviousLayers.find(id); layerEntry != mPreviousLayers.end()) {
// Track changes from previous info
LayerState& state = layerEntry->second;
- Flags<LayerStateField> differences = state.update(layer);
+ ftl::Flags<LayerStateField> differences = state.update(layer);
if (differences.get() == 0) {
state.incrementFramesSinceBufferUpdate();
} else {
diff --git a/services/surfaceflinger/CompositionEngine/src/planner/Predictor.cpp b/services/surfaceflinger/CompositionEngine/src/planner/Predictor.cpp
index 2d53583..2fc029f 100644
--- a/services/surfaceflinger/CompositionEngine/src/planner/Predictor.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/planner/Predictor.cpp
@@ -57,7 +57,7 @@
return std::nullopt;
}
- Flags<LayerStateField> differingFields = mLayers[i].getDifferingFields(*other[i]);
+ ftl::Flags<LayerStateField> differingFields = mLayers[i].getDifferingFields(*other[i]);
// If we don't find an approximate match on this layer, then the LayerStacks differ
// by too much, so return nothing
diff --git a/services/surfaceflinger/CompositionEngine/tests/planner/LayerStateTest.cpp b/services/surfaceflinger/CompositionEngine/tests/planner/LayerStateTest.cpp
index bd4ff13..5c6e8da 100644
--- a/services/surfaceflinger/CompositionEngine/tests/planner/LayerStateTest.cpp
+++ b/services/surfaceflinger/CompositionEngine/tests/planner/LayerStateTest.cpp
@@ -97,12 +97,12 @@
void verifyUniqueDifferingFields(const LayerState& lhs, const LayerState& rhs) {
EXPECT_EQ(lhs.getHash(), rhs.getHash());
- EXPECT_EQ(Flags<LayerStateField>(LayerStateField::None), lhs.getDifferingFields(rhs));
- EXPECT_EQ(Flags<LayerStateField>(LayerStateField::None), rhs.getDifferingFields(lhs));
+ EXPECT_EQ(ftl::Flags<LayerStateField>(LayerStateField::None), lhs.getDifferingFields(rhs));
+ EXPECT_EQ(ftl::Flags<LayerStateField>(LayerStateField::None), rhs.getDifferingFields(lhs));
}
void verifyNonUniqueDifferingFields(const LayerState& lhs, const LayerState& rhs,
- Flags<LayerStateField> fields) {
+ ftl::Flags<LayerStateField> fields) {
EXPECT_NE(lhs.getHash(), rhs.getHash());
EXPECT_EQ(fields, lhs.getDifferingFields(rhs));
@@ -159,9 +159,9 @@
sp<mock::LayerFE> newLayerFE = sp<mock::LayerFE>::make();
setupMocksForLayer(newOutputLayer, *newLayerFE, outputLayerCompositionState,
layerFECompositionState, sSequenceIdTwo);
- Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
+ ftl::Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
EXPECT_EQ(sSequenceIdTwo, mLayerState->getId());
- EXPECT_EQ(Flags<LayerStateField>(LayerStateField::Id), updates);
+ EXPECT_EQ(ftl::Flags<LayerStateField>(LayerStateField::Id), updates);
}
TEST_F(LayerStateTest, compareId) {
@@ -204,9 +204,9 @@
sp<mock::LayerFE> newLayerFE = sp<mock::LayerFE>::make();
setupMocksForLayer(newOutputLayer, *newLayerFE, outputLayerCompositionState,
layerFECompositionState, sSequenceId, sDebugNameTwo);
- Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
+ ftl::Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
EXPECT_EQ(sDebugNameTwo, mLayerState->getName());
- EXPECT_EQ(Flags<LayerStateField>(LayerStateField::Name), updates);
+ EXPECT_EQ(ftl::Flags<LayerStateField>(LayerStateField::Name), updates);
}
TEST_F(LayerStateTest, compareName) {
@@ -253,9 +253,9 @@
outputLayerCompositionStateTwo.displayFrame = sRectTwo;
setupMocksForLayer(newOutputLayer, *newLayerFE, outputLayerCompositionStateTwo,
layerFECompositionState);
- Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
+ ftl::Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
EXPECT_EQ(sRectTwo, mLayerState->getDisplayFrame());
- EXPECT_EQ(Flags<LayerStateField>(LayerStateField::DisplayFrame), updates);
+ EXPECT_EQ(ftl::Flags<LayerStateField>(LayerStateField::DisplayFrame), updates);
}
TEST_F(LayerStateTest, compareDisplayFrame) {
@@ -315,9 +315,9 @@
layerFECompositionStateTwo.compositionType = Composition::SOLID_COLOR;
setupMocksForLayer(newOutputLayer, *newLayerFE, outputLayerCompositionState,
layerFECompositionStateTwo);
- Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
+ ftl::Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
EXPECT_EQ(Composition::SOLID_COLOR, mLayerState->getCompositionType());
- EXPECT_EQ(Flags<LayerStateField>(LayerStateField::CompositionType), updates);
+ EXPECT_EQ(ftl::Flags<LayerStateField>(LayerStateField::CompositionType), updates);
}
TEST_F(LayerStateTest, compareCompositionType) {
@@ -357,8 +357,8 @@
layerFECompositionStateTwo.buffer = new GraphicBuffer();
setupMocksForLayer(newOutputLayer, *newLayerFE, outputLayerCompositionState,
layerFECompositionStateTwo);
- Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
- EXPECT_EQ(Flags<LayerStateField>(LayerStateField::Buffer), updates);
+ ftl::Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
+ EXPECT_EQ(ftl::Flags<LayerStateField>(LayerStateField::Buffer), updates);
}
TEST_F(LayerStateTest, updateBufferSingleBufferedLegacy) {
@@ -380,8 +380,8 @@
layerFECompositionStateTwo.frameNumber = i;
setupMocksForLayer(newOutputLayer, *newLayerFE, outputLayerCompositionState,
layerFECompositionStateTwo);
- Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
- EXPECT_EQ(Flags<LayerStateField>(LayerStateField::Buffer), updates);
+ ftl::Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
+ EXPECT_EQ(ftl::Flags<LayerStateField>(LayerStateField::Buffer), updates);
}
}
@@ -404,8 +404,8 @@
for (uint64_t i = 0; i < 10; i++) {
setupMocksForLayer(newOutputLayer, *newLayerFE, outputLayerCompositionState,
layerFECompositionStateTwo);
- Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
- EXPECT_EQ(Flags<LayerStateField>(LayerStateField::Buffer), updates);
+ ftl::Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
+ EXPECT_EQ(ftl::Flags<LayerStateField>(LayerStateField::Buffer), updates);
}
}
@@ -446,8 +446,8 @@
outputLayerCompositionStateTwo.sourceCrop = sFloatRectTwo;
setupMocksForLayer(newOutputLayer, *newLayerFE, outputLayerCompositionStateTwo,
layerFECompositionState);
- Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
- EXPECT_EQ(Flags<LayerStateField>(LayerStateField::SourceCrop), updates);
+ ftl::Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
+ EXPECT_EQ(ftl::Flags<LayerStateField>(LayerStateField::SourceCrop), updates);
}
TEST_F(LayerStateTest, compareSourceCrop) {
@@ -485,8 +485,8 @@
outputLayerCompositionStateTwo.bufferTransform = Hwc2::Transform::FLIP_V;
setupMocksForLayer(newOutputLayer, *newLayerFE, outputLayerCompositionStateTwo,
layerFECompositionState);
- Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
- EXPECT_EQ(Flags<LayerStateField>(LayerStateField::BufferTransform), updates);
+ ftl::Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
+ EXPECT_EQ(ftl::Flags<LayerStateField>(LayerStateField::BufferTransform), updates);
}
TEST_F(LayerStateTest, compareBufferTransform) {
@@ -525,8 +525,8 @@
layerFECompositionStateTwo.blendMode = hal::BlendMode::PREMULTIPLIED;
setupMocksForLayer(newOutputLayer, *newLayerFE, outputLayerCompositionState,
layerFECompositionStateTwo);
- Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
- EXPECT_EQ(Flags<LayerStateField>(LayerStateField::BlendMode), updates);
+ ftl::Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
+ EXPECT_EQ(ftl::Flags<LayerStateField>(LayerStateField::BlendMode), updates);
}
TEST_F(LayerStateTest, compareBlendMode) {
@@ -564,8 +564,8 @@
layerFECompositionStateTwo.alpha = sAlphaTwo;
setupMocksForLayer(newOutputLayer, *newLayerFE, outputLayerCompositionState,
layerFECompositionStateTwo);
- Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
- EXPECT_EQ(Flags<LayerStateField>(LayerStateField::Alpha), updates);
+ ftl::Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
+ EXPECT_EQ(ftl::Flags<LayerStateField>(LayerStateField::Alpha), updates);
}
TEST_F(LayerStateTest, compareAlpha) {
@@ -603,8 +603,8 @@
layerFECompositionStateTwo.metadata[sMetadataKeyTwo] = sMetadataValueTwo;
setupMocksForLayer(newOutputLayer, *newLayerFE, outputLayerCompositionState,
layerFECompositionStateTwo);
- Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
- EXPECT_EQ(Flags<LayerStateField>(LayerStateField::LayerMetadata), updates);
+ ftl::Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
+ EXPECT_EQ(ftl::Flags<LayerStateField>(LayerStateField::LayerMetadata), updates);
}
TEST_F(LayerStateTest, compareLayerMetadata) {
@@ -652,8 +652,8 @@
outputLayerCompositionStateTwo.visibleRegion = sRegionTwo;
setupMocksForLayer(newOutputLayer, *newLayerFE, outputLayerCompositionStateTwo,
layerFECompositionState);
- Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
- EXPECT_EQ(Flags<LayerStateField>(LayerStateField::VisibleRegion), updates);
+ ftl::Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
+ EXPECT_EQ(ftl::Flags<LayerStateField>(LayerStateField::VisibleRegion), updates);
}
TEST_F(LayerStateTest, compareVisibleRegion) {
@@ -691,8 +691,8 @@
outputLayerCompositionStateTwo.dataspace = ui::Dataspace::DISPLAY_P3;
setupMocksForLayer(newOutputLayer, *newLayerFE, outputLayerCompositionStateTwo,
layerFECompositionState);
- Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
- EXPECT_EQ(Flags<LayerStateField>(LayerStateField::Dataspace), updates);
+ ftl::Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
+ EXPECT_EQ(ftl::Flags<LayerStateField>(LayerStateField::Dataspace), updates);
}
TEST_F(LayerStateTest, compareDataspace) {
@@ -738,9 +738,9 @@
"buffer2");
setupMocksForLayer(newOutputLayer, *newLayerFE, outputLayerCompositionState,
layerFECompositionStateTwo);
- Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
- EXPECT_EQ(Flags<LayerStateField>(LayerStateField::Buffer) |
- Flags<LayerStateField>(LayerStateField::PixelFormat),
+ ftl::Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
+ EXPECT_EQ(ftl::Flags<LayerStateField>(LayerStateField::Buffer) |
+ ftl::Flags<LayerStateField>(LayerStateField::PixelFormat),
updates);
}
@@ -768,7 +768,7 @@
auto otherLayerState = std::make_unique<LayerState>(&newOutputLayer);
verifyNonUniqueDifferingFields(*mLayerState, *otherLayerState,
- Flags<LayerStateField>(LayerStateField::PixelFormat));
+ ftl::Flags<LayerStateField>(LayerStateField::PixelFormat));
EXPECT_TRUE(mLayerState->compare(*otherLayerState));
EXPECT_TRUE(otherLayerState->compare(*mLayerState));
@@ -790,8 +790,8 @@
layerFECompositionStateTwo.colorTransform = sMat4One;
setupMocksForLayer(newOutputLayer, *newLayerFE, outputLayerCompositionState,
layerFECompositionStateTwo);
- Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
- EXPECT_EQ(Flags<LayerStateField>(LayerStateField::ColorTransform), updates);
+ ftl::Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
+ EXPECT_EQ(ftl::Flags<LayerStateField>(LayerStateField::ColorTransform), updates);
}
TEST_F(LayerStateTest, compareColorTransform) {
@@ -831,8 +831,8 @@
layerFECompositionStateTwo.sidebandStream = NativeHandle::create(sFakeSidebandStreamTwo, false);
setupMocksForLayer(newOutputLayer, *newLayerFE, outputLayerCompositionState,
layerFECompositionStateTwo);
- Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
- EXPECT_EQ(Flags<LayerStateField>(LayerStateField::SidebandStream), updates);
+ ftl::Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
+ EXPECT_EQ(ftl::Flags<LayerStateField>(LayerStateField::SidebandStream), updates);
}
TEST_F(LayerStateTest, compareSidebandStream) {
@@ -870,8 +870,8 @@
layerFECompositionStateTwo.color = sHalf4Two;
setupMocksForLayer(newOutputLayer, *newLayerFE, outputLayerCompositionState,
layerFECompositionStateTwo);
- Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
- EXPECT_EQ(Flags<LayerStateField>(LayerStateField::SolidColor), updates);
+ ftl::Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
+ EXPECT_EQ(ftl::Flags<LayerStateField>(LayerStateField::SolidColor), updates);
}
TEST_F(LayerStateTest, compareSolidColor) {
@@ -909,8 +909,8 @@
layerFECompositionStateTwo.backgroundBlurRadius = sBgBlurRadiusTwo;
setupMocksForLayer(newOutputLayer, *newLayerFE, outputLayerCompositionState,
layerFECompositionStateTwo);
- Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
- EXPECT_EQ(Flags<LayerStateField>(LayerStateField::BackgroundBlurRadius), updates);
+ ftl::Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
+ EXPECT_EQ(ftl::Flags<LayerStateField>(LayerStateField::BackgroundBlurRadius), updates);
}
TEST_F(LayerStateTest, compareBackgroundBlur) {
@@ -949,8 +949,8 @@
layerFECompositionStateTwo.blurRegions.push_back(sBlurRegionTwo);
setupMocksForLayer(newOutputLayer, *newLayerFE, outputLayerCompositionState,
layerFECompositionStateTwo);
- Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
- EXPECT_EQ(Flags<LayerStateField>(LayerStateField::BlurRegions), updates);
+ ftl::Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
+ EXPECT_EQ(ftl::Flags<LayerStateField>(LayerStateField::BlurRegions), updates);
}
TEST_F(LayerStateTest, compareBlurRegions) {
diff --git a/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp b/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
index b4fb51f..3803a78 100644
--- a/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
+++ b/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
@@ -19,20 +19,20 @@
#pragma clang diagnostic ignored "-Wconversion"
// #define LOG_NDEBUG 0
-#include "VirtualDisplaySurface.h"
#include <cinttypes>
-#include "HWComposer.h"
-#include "SurfaceFlinger.h"
-
-#include <ftl/Flags.h>
#include <ftl/enum.h>
+#include <ftl/flags.h>
#include <gui/BufferItem.h>
#include <gui/BufferQueue.h>
#include <gui/IProducerListener.h>
#include <system/window.h>
+#include "HWComposer.h"
+#include "SurfaceFlinger.h"
+#include "VirtualDisplaySurface.h"
+
#define VDS_LOGE(msg, ...) ALOGE("[%s] " msg, \
mDisplayName.c_str(), ##__VA_ARGS__)
#define VDS_LOGW_IF(cond, msg, ...) ALOGW_IF(cond, "[%s] " msg, \
@@ -657,7 +657,7 @@
std::string VirtualDisplaySurface::toString(CompositionType type) {
using namespace std::literals;
- return type == CompositionType::Unknown ? "Unknown"s : Flags(type).string();
+ return type == CompositionType::Unknown ? "Unknown"s : ftl::Flags(type).string();
}
} // namespace android
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 894fb8d..41e0487 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -82,11 +82,13 @@
constexpr int kDumpTableRowLength = 159;
} // namespace
+using namespace ftl::flag_operators;
+
using base::StringAppendF;
-using namespace android::flag_operators;
-using PresentState = frametimeline::SurfaceFrame::PresentState;
using gui::WindowInfo;
+using PresentState = frametimeline::SurfaceFrame::PresentState;
+
std::atomic<int32_t> Layer::sSequence{1};
Layer::Layer(const LayerCreationArgs& args)
diff --git a/services/surfaceflinger/Scheduler/include/scheduler/Features.h b/services/surfaceflinger/Scheduler/include/scheduler/Features.h
index 0e96678..b3a6a60 100644
--- a/services/surfaceflinger/Scheduler/include/scheduler/Features.h
+++ b/services/surfaceflinger/Scheduler/include/scheduler/Features.h
@@ -16,10 +16,10 @@
#pragma once
-#include <ftl/Flags.h>
-
#include <cstdint>
+#include <ftl/flags.h>
+
namespace android::scheduler {
enum class Feature : std::uint8_t {
@@ -29,6 +29,6 @@
kTracePredictedVsync = 0b1000,
};
-using FeatureFlags = Flags<Feature>;
+using FeatureFlags = ftl::Flags<Feature>;
} // namespace android::scheduler
diff --git a/services/surfaceflinger/Tracing/TransactionProtoParser.cpp b/services/surfaceflinger/Tracing/TransactionProtoParser.cpp
index d249b60..a73eccf 100644
--- a/services/surfaceflinger/Tracing/TransactionProtoParser.cpp
+++ b/services/surfaceflinger/Tracing/TransactionProtoParser.cpp
@@ -429,7 +429,7 @@
bufferProto.height(), bufferProto.pixel_format(),
bufferProto.usage()));
layer.bufferData->frameNumber = bufferProto.frame_number();
- layer.bufferData->flags = Flags<BufferData::BufferDataChange>(bufferProto.flags());
+ layer.bufferData->flags = ftl::Flags<BufferData::BufferDataChange>(bufferProto.flags());
layer.bufferData->cachedBuffer.id = bufferProto.cached_buffer_id();
layer.bufferData->acquireFence = Fence::NO_FENCE;
}
diff --git a/services/surfaceflinger/tests/unittests/EventThreadTest.cpp b/services/surfaceflinger/tests/unittests/EventThreadTest.cpp
index 14d8f98..fa36d9c 100644
--- a/services/surfaceflinger/tests/unittests/EventThreadTest.cpp
+++ b/services/surfaceflinger/tests/unittests/EventThreadTest.cpp
@@ -34,12 +34,13 @@
using namespace std::chrono_literals;
using namespace std::placeholders;
-using namespace android::flag_operators;
using testing::_;
using testing::Invoke;
namespace android {
+using namespace ftl::flag_operators;
+
namespace {
constexpr PhysicalDisplayId INTERNAL_DISPLAY_ID = PhysicalDisplayId::fromPort(111u);