[sf] Add support for generic layer metadata to HWComposer and HWC2
HWComposer construction is slightly modified to make it easier to test.
Data is retrieved about the device on the call SurfaceFlinger makes
right after creaton (was registerCallbacks, now called
setConfiguration). This now includes obtaining the supported layer
metadata information from the HAL implementation.
Since getting capabilities is now no longer done by just construction,
the existing tests were adjusted to not expect the call, especially as
none of them were testing any variance in capabilities.
A HWC2::Layer::setLayerGenericMetadata function is also added to set
the metadata.
Tests are explicitly added for both retrieving the supported metadata
and for setting layer generic metadata.
Bug: 139747351
Test: atest libsurfaceflinger_unittest
Change-Id: I3e95be932d94d4e9f200b870acea965744c68d2c
diff --git a/services/surfaceflinger/CompositionEngine/tests/MockHWC2.h b/services/surfaceflinger/CompositionEngine/tests/MockHWC2.h
index a51cc67..be89c1a 100644
--- a/services/surfaceflinger/CompositionEngine/tests/MockHWC2.h
+++ b/services/surfaceflinger/CompositionEngine/tests/MockHWC2.h
@@ -65,6 +65,8 @@
MOCK_METHOD2(setInfo, Error(uint32_t, uint32_t));
MOCK_METHOD1(setColorTransform, Error(const android::mat4&));
+ MOCK_METHOD3(setLayerGenericMetadata,
+ Error(const std::string&, bool, const std::vector<uint8_t>&));
};
} // namespace mock
diff --git a/services/surfaceflinger/CompositionEngine/tests/MockHWComposer.h b/services/surfaceflinger/CompositionEngine/tests/MockHWComposer.h
index 502a33f..9995ce1 100644
--- a/services/surfaceflinger/CompositionEngine/tests/MockHWComposer.h
+++ b/services/surfaceflinger/CompositionEngine/tests/MockHWComposer.h
@@ -36,7 +36,7 @@
HWComposer();
~HWComposer() override;
- MOCK_METHOD2(registerCallback, void(HWC2::ComposerCallback*, int32_t));
+ MOCK_METHOD2(setConfiguration, void(HWC2::ComposerCallback*, int32_t));
MOCK_CONST_METHOD3(getDisplayIdentificationData,
bool(hwc2_display_t, uint8_t*, DisplayIdentificationData*));
MOCK_CONST_METHOD1(hasCapability, bool(HWC2::Capability));
@@ -96,6 +96,8 @@
MOCK_METHOD2(setAutoLowLatencyMode, status_t(DisplayId, bool));
MOCK_METHOD2(getSupportedContentTypes, status_t(DisplayId, std::vector<HWC2::ContentType>*));
MOCK_METHOD2(setContentType, status_t(DisplayId, HWC2::ContentType));
+ MOCK_CONST_METHOD0(getSupportedLayerGenericMetadata,
+ const std::unordered_map<std::string, bool>&());
MOCK_CONST_METHOD1(dump, void(std::string&));
MOCK_CONST_METHOD0(getComposer, android::Hwc2::Composer*());
diff --git a/services/surfaceflinger/DisplayHardware/HWC2.cpp b/services/surfaceflinger/DisplayHardware/HWC2.cpp
index 41e7879..e8bf2d8 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWC2.cpp
@@ -734,12 +734,11 @@
Layer::Layer(android::Hwc2::Composer& composer, const std::unordered_set<Capability>& capabilities,
hwc2_display_t displayId, hwc2_layer_t layerId)
- : mComposer(composer),
- mCapabilities(capabilities),
- mDisplayId(displayId),
- mId(layerId),
- mColorMatrix(android::mat4())
-{
+ : mComposer(composer),
+ mCapabilities(capabilities),
+ mDisplayId(displayId),
+ mId(layerId),
+ mColorMatrix(android::mat4()) {
ALOGV("Created layer %" PRIu64 " on display %" PRIu64, layerId, displayId);
}
@@ -979,6 +978,13 @@
return error;
}
+// Composer HAL 2.4
+Error Layer::setLayerGenericMetadata(const std::string& name, bool mandatory,
+ const std::vector<uint8_t>& value) {
+ auto intError = mComposer.setLayerGenericMetadata(mDisplayId, mId, name, mandatory, value);
+ return static_cast<Error>(intError);
+}
+
} // namespace impl
} // namespace HWC2
diff --git a/services/surfaceflinger/DisplayHardware/HWC2.h b/services/surfaceflinger/DisplayHardware/HWC2.h
index e7cf5ff..5804903 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2.h
+++ b/services/surfaceflinger/DisplayHardware/HWC2.h
@@ -374,6 +374,10 @@
// Composer HAL 2.3
[[clang::warn_unused_result]] virtual Error setColorTransform(const android::mat4& matrix) = 0;
+
+ // Composer HAL 2.4
+ [[clang::warn_unused_result]] virtual Error setLayerGenericMetadata(
+ const std::string& name, bool mandatory, const std::vector<uint8_t>& value) = 0;
};
namespace impl {
@@ -382,8 +386,7 @@
class Layer : public HWC2::Layer {
public:
- Layer(android::Hwc2::Composer& composer,
- const std::unordered_set<Capability>& capabilities,
+ Layer(android::Hwc2::Composer& composer, const std::unordered_set<Capability>& capabilities,
hwc2_display_t displayId, hwc2_layer_t layerId);
~Layer() override;
@@ -412,6 +415,10 @@
// Composer HAL 2.3
Error setColorTransform(const android::mat4& matrix) override;
+ // Composer HAL 2.4
+ Error setLayerGenericMetadata(const std::string& name, bool mandatory,
+ const std::vector<uint8_t>& value) override;
+
private:
// These are references to data owned by HWC2::Device, which will outlive
// this HWC2::Layer, so these references are guaranteed to be valid for
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index f8d45c0..bb6f696 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -148,20 +148,20 @@
namespace impl {
HWComposer::HWComposer(std::unique_ptr<Hwc2::Composer> composer) : mComposer(std::move(composer)) {
- loadCapabilities();
}
HWComposer::HWComposer(const std::string& composerServiceName)
: mComposer(std::make_unique<Hwc2::impl::Composer>(composerServiceName)) {
- loadCapabilities();
}
HWComposer::~HWComposer() {
mDisplayData.clear();
}
-void HWComposer::registerCallback(HWC2::ComposerCallback* callback,
- int32_t sequenceId) {
+void HWComposer::setConfiguration(HWC2::ComposerCallback* callback, int32_t sequenceId) {
+ loadCapabilities();
+ loadLayerMetadataSupport();
+
if (mRegisteredCallback) {
ALOGW("Callback already registered. Ignored extra registration attempt.");
return;
@@ -871,6 +871,10 @@
return NO_ERROR;
}
+const std::unordered_map<std::string, bool>& HWComposer::getSupportedLayerGenericMetadata() const {
+ return mSupportedLayerGenericMetadata;
+}
+
void HWComposer::dump(std::string& result) const {
result.append(mComposer->dumpDebugInfo());
}
@@ -946,6 +950,22 @@
}
}
+void HWComposer::loadLayerMetadataSupport() {
+ mSupportedLayerGenericMetadata.clear();
+
+ std::vector<Hwc2::IComposerClient::LayerGenericMetadataKey> supportedMetadataKeyInfo;
+ const auto error = mComposer->getLayerGenericMetadataKeys(&supportedMetadataKeyInfo);
+ if (error != hardware::graphics::composer::V2_4::Error::NONE) {
+ ALOGE("%s: %s failed: %s (%d)", __FUNCTION__, "getLayerGenericMetadataKeys",
+ toString(error).c_str(), static_cast<int32_t>(error));
+ return;
+ }
+
+ for (const auto& [name, mandatory] : supportedMetadataKeyInfo) {
+ mSupportedLayerGenericMetadata.emplace(name, mandatory);
+ }
+}
+
uint32_t HWComposer::getMaxVirtualDisplayCount() const {
return mComposer->getMaxVirtualDisplayCount();
}
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h
index effe43b..76e831b 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.h
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.h
@@ -55,11 +55,16 @@
class Output;
} // namespace compositionengine
+struct KnownHWCGenericLayerMetadata {
+ const char* name;
+ const uint32_t id;
+};
+
class HWComposer {
public:
virtual ~HWComposer();
- virtual void registerCallback(HWC2::ComposerCallback* callback, int32_t sequenceId) = 0;
+ virtual void setConfiguration(HWC2::ComposerCallback* callback, int32_t sequenceId) = 0;
virtual bool getDisplayIdentificationData(hwc2_display_t hwcDisplayId, uint8_t* outPort,
DisplayIdentificationData* outData) const = 0;
@@ -194,6 +199,8 @@
virtual status_t getSupportedContentTypes(
DisplayId displayId, std::vector<HWC2::ContentType>* outSupportedContentTypes) = 0;
virtual status_t setContentType(DisplayId displayId, HWC2::ContentType contentType) = 0;
+ virtual const std::unordered_map<std::string, bool>& getSupportedLayerGenericMetadata()
+ const = 0;
// for debugging ----------------------------------------------------------
virtual void dump(std::string& out) const = 0;
@@ -217,7 +224,7 @@
~HWComposer() override;
- void registerCallback(HWC2::ComposerCallback* callback, int32_t sequenceId) override;
+ void setConfiguration(HWC2::ComposerCallback* callback, int32_t sequenceId) override;
bool getDisplayIdentificationData(hwc2_display_t hwcDisplayId, uint8_t* outPort,
DisplayIdentificationData* outData) const override;
@@ -329,6 +336,8 @@
std::vector<HWC2::ContentType>*) override;
status_t setContentType(DisplayId displayId, HWC2::ContentType) override;
+ const std::unordered_map<std::string, bool>& getSupportedLayerGenericMetadata() const override;
+
// for debugging ----------------------------------------------------------
void dump(std::string& out) const override;
@@ -351,6 +360,7 @@
std::optional<DisplayIdentificationInfo> onHotplugConnect(hwc2_display_t hwcDisplayId);
void loadCapabilities();
+ void loadLayerMetadataSupport();
uint32_t getMaxVirtualDisplayCount() const;
struct DisplayData {
@@ -379,6 +389,7 @@
std::unique_ptr<android::Hwc2::Composer> mComposer;
std::unordered_set<HWC2::Capability> mCapabilities;
+ std::unordered_map<std::string, bool> mSupportedLayerGenericMetadata;
bool mRegisteredCallback = false;
std::unordered_map<hwc2_display_t, DisplayId> mPhysicalDisplayIdMap;
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index f81179a..7ed6342 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -57,6 +57,7 @@
#include <gui/IDisplayEventConnection.h>
#include <gui/IProducerListener.h>
#include <gui/LayerDebugInfo.h>
+#include <gui/LayerMetadata.h>
#include <gui/Surface.h>
#include <input/IInputFlinger.h>
#include <renderengine/RenderEngine.h>
@@ -622,7 +623,7 @@
LOG_ALWAYS_FATAL_IF(mVrFlingerRequestsDisplay,
"Starting with vr flinger active is not currently supported.");
mCompositionEngine->setHwComposer(getFactory().createHWComposer(getBE().mHwcServiceName));
- mCompositionEngine->getHwComposer().registerCallback(this, getBE().mComposerSequenceId);
+ mCompositionEngine->getHwComposer().setConfiguration(this, getBE().mComposerSequenceId);
// Process any initial hotplug and resulting display changes.
processDisplayHotplugEventsLocked();
const auto display = getDefaultDisplayDeviceLocked();
@@ -1682,7 +1683,7 @@
mCompositionEngine->setHwComposer(std::unique_ptr<HWComposer>());
mCompositionEngine->setHwComposer(getFactory().createHWComposer(
vrFlingerRequestsDisplay ? "vr" : getBE().mHwcServiceName));
- getHwComposer().registerCallback(this, ++getBE().mComposerSequenceId);
+ mCompositionEngine->getHwComposer().setConfiguration(this, ++getBE().mComposerSequenceId);
LOG_ALWAYS_FATAL_IF(!getHwComposer().getComposer()->isRemote(),
"Switched to non-remote hardware composer");
diff --git a/services/surfaceflinger/tests/unittests/Android.bp b/services/surfaceflinger/tests/unittests/Android.bp
index d046f76..1cd8731 100644
--- a/services/surfaceflinger/tests/unittests/Android.bp
+++ b/services/surfaceflinger/tests/unittests/Android.bp
@@ -42,6 +42,7 @@
"DisplayTransactionTest.cpp",
"EventControlThreadTest.cpp",
"EventThreadTest.cpp",
+ "HWComposerTest.cpp",
"OneShotTimerTest.cpp",
"LayerHistoryTest.cpp",
"LayerHistoryTestV2.cpp",
diff --git a/services/surfaceflinger/tests/unittests/CompositionTest.cpp b/services/surfaceflinger/tests/unittests/CompositionTest.cpp
index 888e009..b41131b 100644
--- a/services/surfaceflinger/tests/unittests/CompositionTest.cpp
+++ b/services/surfaceflinger/tests/unittests/CompositionTest.cpp
@@ -116,8 +116,6 @@
void setupComposer(int virtualDisplayCount) {
mComposer = new Hwc2::mock::Composer();
- EXPECT_CALL(*mComposer, getCapabilities())
- .WillOnce(Return(std::vector<IComposer::Capability>()));
EXPECT_CALL(*mComposer, getMaxVirtualDisplayCount()).WillOnce(Return(virtualDisplayCount));
mFlinger.setupComposer(std::unique_ptr<Hwc2::Composer>(mComposer));
diff --git a/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp b/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp
index dddad92..232255f 100644
--- a/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp
+++ b/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp
@@ -201,8 +201,6 @@
void DisplayTransactionTest::injectMockComposer(int virtualDisplayCount) {
mComposer = new Hwc2::mock::Composer();
- EXPECT_CALL(*mComposer, getCapabilities())
- .WillOnce(Return(std::vector<IComposer::Capability>()));
EXPECT_CALL(*mComposer, getMaxVirtualDisplayCount()).WillOnce(Return(virtualDisplayCount));
mFlinger.setupComposer(std::unique_ptr<Hwc2::Composer>(mComposer));
diff --git a/services/surfaceflinger/tests/unittests/HWComposerTest.cpp b/services/surfaceflinger/tests/unittests/HWComposerTest.cpp
new file mode 100644
index 0000000..c6fe205
--- /dev/null
+++ b/services/surfaceflinger/tests/unittests/HWComposerTest.cpp
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2020 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.
+ */
+
+// TODO(b/129481165): remove the #pragma below and fix conversion issues
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wconversion"
+
+#undef LOG_TAG
+#define LOG_TAG "LibSurfaceFlingerUnittests"
+
+#include <vector>
+
+#include <gmock/gmock.h>
+#include <gui/LayerMetadata.h>
+#include <log/log.h>
+
+#include "DisplayHardware/HWComposer.h"
+#include "mock/DisplayHardware/MockComposer.h"
+
+// TODO(b/129481165): remove the #pragma below and fix conversion issues
+#pragma clang diagnostic pop // ignored "-Wconversion"
+
+namespace android {
+namespace {
+
+using ::testing::_;
+using ::testing::DoAll;
+using ::testing::ElementsAreArray;
+using ::testing::Return;
+using ::testing::SetArgPointee;
+using ::testing::StrictMock;
+
+struct MockHWC2ComposerCallback : public HWC2::ComposerCallback {
+ ~MockHWC2ComposerCallback() = default;
+
+ MOCK_METHOD3(onHotplugReceived,
+ void(int32_t sequenceId, hwc2_display_t display, HWC2::Connection connection));
+ MOCK_METHOD2(onRefreshReceived, void(int32_t sequenceId, hwc2_display_t display));
+ MOCK_METHOD4(onVsyncReceived,
+ void(int32_t sequenceId, hwc2_display_t display, int64_t timestamp,
+ std::optional<hwc2_vsync_period_t> vsyncPeriod));
+ MOCK_METHOD3(onVsyncPeriodTimingChangedReceived,
+ void(int32_t sequenceId, hwc2_display_t display,
+ const hwc_vsync_period_change_timeline_t& updatedTimeline));
+ MOCK_METHOD2(onSeamlessPossible, void(int32_t sequenceId, hwc2_display_t display));
+};
+
+struct HWComposerTest : public testing::Test {
+ Hwc2::mock::Composer* mHal = new StrictMock<Hwc2::mock::Composer>();
+};
+
+struct HWComposerSetConfigurationTest : public HWComposerTest {
+ StrictMock<MockHWC2ComposerCallback> mCallback;
+};
+
+TEST_F(HWComposerSetConfigurationTest, loadsLayerMetadataSupport) {
+ const std::string kMetadata1Name = "com.example.metadata.1";
+ constexpr bool kMetadata1Mandatory = false;
+ const std::string kMetadata2Name = "com.example.metadata.2";
+ constexpr bool kMetadata2Mandatory = true;
+
+ EXPECT_CALL(*mHal, getMaxVirtualDisplayCount()).WillOnce(Return(0));
+ EXPECT_CALL(*mHal, getCapabilities())
+ .WillOnce(Return(std::vector<Hwc2::IComposer::Capability>{}));
+ EXPECT_CALL(*mHal, getLayerGenericMetadataKeys(_))
+ .WillOnce(DoAll(SetArgPointee<0>(
+ std::vector<Hwc2::IComposerClient::LayerGenericMetadataKey>{
+ {kMetadata1Name, kMetadata1Mandatory},
+ {kMetadata2Name, kMetadata2Mandatory},
+ }),
+ Return(hardware::graphics::composer::V2_4::Error::NONE)));
+ EXPECT_CALL(*mHal, registerCallback(_));
+ EXPECT_CALL(*mHal, isVsyncPeriodSwitchSupported()).WillOnce(Return(false));
+
+ impl::HWComposer hwc{std::unique_ptr<Hwc2::Composer>(mHal)};
+ hwc.setConfiguration(&mCallback, 123);
+
+ const auto& supported = hwc.getSupportedLayerGenericMetadata();
+ EXPECT_EQ(2u, supported.size());
+ EXPECT_EQ(1u, supported.count(kMetadata1Name));
+ EXPECT_EQ(kMetadata1Mandatory, supported.find(kMetadata1Name)->second);
+ EXPECT_EQ(1u, supported.count(kMetadata2Name));
+ EXPECT_EQ(kMetadata2Mandatory, supported.find(kMetadata2Name)->second);
+}
+
+TEST_F(HWComposerSetConfigurationTest, handlesUnsupportedCallToGetLayerGenericMetadataKeys) {
+ EXPECT_CALL(*mHal, getMaxVirtualDisplayCount()).WillOnce(Return(0));
+ EXPECT_CALL(*mHal, getCapabilities())
+ .WillOnce(Return(std::vector<Hwc2::IComposer::Capability>{}));
+ EXPECT_CALL(*mHal, getLayerGenericMetadataKeys(_))
+ .WillOnce(Return(hardware::graphics::composer::V2_4::Error::UNSUPPORTED));
+ EXPECT_CALL(*mHal, registerCallback(_));
+ EXPECT_CALL(*mHal, isVsyncPeriodSwitchSupported()).WillOnce(Return(false));
+
+ impl::HWComposer hwc{std::unique_ptr<Hwc2::Composer>(mHal)};
+ hwc.setConfiguration(&mCallback, 123);
+
+ const auto& supported = hwc.getSupportedLayerGenericMetadata();
+ EXPECT_EQ(0u, supported.size());
+}
+
+struct HWComposerLayerTest : public testing::Test {
+ static constexpr hwc2_display_t kDisplayId = static_cast<hwc2_display_t>(1001);
+ static constexpr hwc2_layer_t kLayerId = static_cast<hwc2_layer_t>(1002);
+
+ HWComposerLayerTest(const std::unordered_set<HWC2::Capability>& capabilities)
+ : mCapabilies(capabilities) {}
+
+ ~HWComposerLayerTest() override { EXPECT_CALL(*mHal, destroyLayer(kDisplayId, kLayerId)); }
+
+ std::unique_ptr<Hwc2::mock::Composer> mHal{new StrictMock<Hwc2::mock::Composer>()};
+ const std::unordered_set<HWC2::Capability> mCapabilies;
+ HWC2::impl::Layer mLayer{*mHal, mCapabilies, kDisplayId, kLayerId};
+};
+
+struct HWComposerLayerGenericMetadataTest : public HWComposerLayerTest {
+ static const std::string kLayerGenericMetadata1Name;
+ static constexpr bool kLayerGenericMetadata1Mandatory = false;
+ static const std::vector<uint8_t> kLayerGenericMetadata1Value;
+ static const std::string kLayerGenericMetadata2Name;
+ static constexpr bool kLayerGenericMetadata2Mandatory = true;
+ static const std::vector<uint8_t> kLayerGenericMetadata2Value;
+
+ HWComposerLayerGenericMetadataTest() : HWComposerLayerTest({}) {}
+};
+
+const std::string HWComposerLayerGenericMetadataTest::kLayerGenericMetadata1Name =
+ "com.example.metadata.1";
+
+const std::vector<uint8_t> HWComposerLayerGenericMetadataTest::kLayerGenericMetadata1Value = {1u,
+ 2u,
+ 3u};
+
+const std::string HWComposerLayerGenericMetadataTest::kLayerGenericMetadata2Name =
+ "com.example.metadata.2";
+
+const std::vector<uint8_t> HWComposerLayerGenericMetadataTest::kLayerGenericMetadata2Value = {45u,
+ 67u};
+
+TEST_F(HWComposerLayerGenericMetadataTest, forwardsSupportedMetadata) {
+ EXPECT_CALL(*mHal,
+ setLayerGenericMetadata(kDisplayId, kLayerId, kLayerGenericMetadata1Name,
+ kLayerGenericMetadata1Mandatory,
+ kLayerGenericMetadata1Value))
+ .WillOnce(Return(hardware::graphics::composer::V2_4::Error::NONE));
+ auto result = mLayer.setLayerGenericMetadata(kLayerGenericMetadata1Name,
+ kLayerGenericMetadata1Mandatory,
+ kLayerGenericMetadata1Value);
+ EXPECT_EQ(HWC2::Error::None, result);
+
+ EXPECT_CALL(*mHal,
+ setLayerGenericMetadata(kDisplayId, kLayerId, kLayerGenericMetadata2Name,
+ kLayerGenericMetadata2Mandatory,
+ kLayerGenericMetadata2Value))
+ .WillOnce(Return(hardware::graphics::composer::V2_4::Error::UNSUPPORTED));
+ result = mLayer.setLayerGenericMetadata(kLayerGenericMetadata2Name,
+ kLayerGenericMetadata2Mandatory,
+ kLayerGenericMetadata2Value);
+ EXPECT_EQ(HWC2::Error::Unsupported, result);
+}
+
+} // namespace
+} // namespace android
diff --git a/services/surfaceflinger/tests/unittests/RefreshRateSelectionTest.cpp b/services/surfaceflinger/tests/unittests/RefreshRateSelectionTest.cpp
index cffdc14..d8e8724 100644
--- a/services/surfaceflinger/tests/unittests/RefreshRateSelectionTest.cpp
+++ b/services/surfaceflinger/tests/unittests/RefreshRateSelectionTest.cpp
@@ -153,8 +153,6 @@
void RefreshRateSelectionTest::setupComposer(int virtualDisplayCount) {
mComposer = new Hwc2::mock::Composer();
- EXPECT_CALL(*mComposer, getCapabilities())
- .WillOnce(Return(std::vector<IComposer::Capability>()));
EXPECT_CALL(*mComposer, getMaxVirtualDisplayCount()).WillOnce(Return(virtualDisplayCount));
mFlinger.setupComposer(std::unique_ptr<Hwc2::Composer>(mComposer));