Deprecate getDisplayBrightnessSupport.
Brightness is already a per display capability, we don't need this API.
BUG: 130313275
Test: build
Change-Id: I0a669aca19a2873df41bee82bd0e5e2775af8101
diff --git a/graphics/composer/2.3/IComposerClient.hal b/graphics/composer/2.3/IComposerClient.hal
index 1eea306..4d6f78f 100644
--- a/graphics/composer/2.3/IComposerClient.hal
+++ b/graphics/composer/2.3/IComposerClient.hal
@@ -502,6 +502,10 @@
float minLuminance);
/**
+ * Use getDisplayCapabilities instead. If brightness is supported, must return
+ * DisplayCapability::BRIGHTNESS as one of the display capabilities via getDisplayCapabilities.
+ * Only use getDisplayCapabilities as the source of truth to query brightness support.
+ *
* Gets whether brightness operations are supported on a display.
*
* @param display
diff --git a/graphics/composer/2.3/vts/functional/VtsHalGraphicsComposerV2_3TargetTest.cpp b/graphics/composer/2.3/vts/functional/VtsHalGraphicsComposerV2_3TargetTest.cpp
index 56b2e33..d51c30a 100644
--- a/graphics/composer/2.3/vts/functional/VtsHalGraphicsComposerV2_3TargetTest.cpp
+++ b/graphics/composer/2.3/vts/functional/VtsHalGraphicsComposerV2_3TargetTest.cpp
@@ -572,6 +572,10 @@
std::find(capabilities.begin(), capabilities.end(),
IComposerClient::DisplayCapability::DOZE) != capabilities.end();
EXPECT_EQ(mComposerClient->getDozeSupport(mPrimaryDisplay), hasDozeSupport);
+ bool hasBrightnessSupport =
+ std::find(capabilities.begin(), capabilities.end(),
+ IComposerClient::DisplayCapability::BRIGHTNESS) != capabilities.end();
+ EXPECT_EQ(mComposerClient->getDisplayBrightnessSupport(mPrimaryDisplay), hasBrightnessSupport);
}
TEST_F(GraphicsComposerHidlTest, getDisplayCapabilitiesBadDisplay) {
@@ -604,24 +608,18 @@
}
/*
- * Test that getDisplayBrightnessSupport works as expected.
+ * Test that if brightness operations are supported, setDisplayBrightness works as expected.
*/
-TEST_F(GraphicsComposerHidlTest, getDisplayBrightnessSupport) {
+TEST_F(GraphicsComposerHidlTest, setDisplayBrightness) {
std::vector<IComposerClient::DisplayCapability> capabilities;
const auto error = mComposerClient->getDisplayCapabilities(mPrimaryDisplay, &capabilities);
ASSERT_EQ(Error::NONE, error);
bool brightnessSupport =
std::find(capabilities.begin(), capabilities.end(),
IComposerClient::DisplayCapability::BRIGHTNESS) != capabilities.end();
- EXPECT_EQ(mComposerClient->getDisplayBrightnessSupport(mPrimaryDisplay), brightnessSupport);
-}
-
-/*
- * Test that if brightness operations are supported, setDisplayBrightness works as expected.
- */
-TEST_F(GraphicsComposerHidlTest, setDisplayBrightness) {
- if (!mComposerClient->getDisplayBrightnessSupport(mPrimaryDisplay)) {
- EXPECT_EQ(mComposerClient->setDisplayBrightness(mPrimaryDisplay, 0.5f), Error::UNSUPPORTED);
+ if (!brightnessSupport) {
+ EXPECT_EQ(mComposerClient->getRaw()->setDisplayBrightness(mPrimaryDisplay, 0.5f),
+ Error::UNSUPPORTED);
GTEST_SUCCEED() << "Brightness operations are not supported";
return;
}