[VTS] Add interface version check function
Use the interface version check function in
SetRefreshRateChangedCallbackDebug tests
Update the GetOverlaySupport and SkipValidateDeprecatedTest
To use the interface vesion function
Test: atest VtsHalGraphicsComposer3_TargetTest
BUG: 267565265
Change-Id: I3f37f4ff5610f8e9e3dec299ed7c3f0c41a630d7
diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
index 746330b..323554c 100644
--- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
+++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
@@ -118,6 +118,12 @@
[&](const Capability& activeCapability) { return activeCapability == capability; });
}
+ int getInterfaceVersion() {
+ const auto& [versionStatus, version] = mComposerClient->getInterfaceVersion();
+ EXPECT_TRUE(versionStatus.isOk());
+ return version;
+ }
+
const VtsDisplay& getPrimaryDisplay() const { return mDisplays[0]; }
int64_t getPrimaryDisplayId() const { return getPrimaryDisplay().getDisplayId(); }
@@ -874,9 +880,7 @@
}
TEST_P(GraphicsComposerAidlTest, GetOverlaySupport) {
- const auto& [versionStatus, version] = mComposerClient->getInterfaceVersion();
- ASSERT_TRUE(versionStatus.isOk());
- if (version == 1) {
+ if (getInterfaceVersion() <= 1) {
GTEST_SUCCEED() << "Device does not support the new API for overlay support";
return;
}
@@ -2290,6 +2294,11 @@
}
TEST_P(GraphicsComposerAidlCommandTest, SetRefreshRateChangedCallbackDebug_Unsupported) {
+ if (getInterfaceVersion() <= 1) {
+ GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is "
+ "not supported on older version of the service";
+ return;
+ }
if (!hasCapability(Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG)) {
auto status = mComposerClient->setRefreshRateChangedCallbackDebugEnabled(
getPrimaryDisplayId(), /*enabled*/ true);
@@ -2306,6 +2315,11 @@
}
TEST_P(GraphicsComposerAidlCommandTest, SetRefreshRateChangedCallbackDebug_Enabled) {
+ if (getInterfaceVersion() <= 1) {
+ GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is "
+ "not supported on older version of the service";
+ return;
+ }
if (!hasCapability(Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG)) {
GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is not supported";
return;
@@ -2335,6 +2349,11 @@
TEST_P(GraphicsComposerAidlCommandTest,
SetRefreshRateChangedCallbackDebugEnabled_noCallbackWhenIdle) {
+ if (getInterfaceVersion() <= 1) {
+ GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is "
+ "not supported on older version of the service";
+ return;
+ }
if (!hasCapability(Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG)) {
GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is not supported";
return;
@@ -2392,6 +2411,11 @@
TEST_P(GraphicsComposerAidlCommandTest,
SetRefreshRateChangedCallbackDebugEnabled_SetActiveConfigWithConstraints) {
+ if (getInterfaceVersion() <= 1) {
+ GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is "
+ "not supported on older version of the service";
+ return;
+ }
if (!hasCapability(Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG)) {
GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is not supported";
return;
@@ -2514,9 +2538,7 @@
* Capability::SKIP_VALIDATE has been deprecated and should not be enabled.
*/
TEST_P(GraphicsComposerAidlCommandTest, SkipValidateDeprecatedTest) {
- const auto& [versionStatus, version] = mComposerClient->getInterfaceVersion();
- ASSERT_TRUE(versionStatus.isOk());
- if (version <= 1) {
+ if (getInterfaceVersion() <= 1) {
GTEST_SUCCEED() << "HAL at version 1 or lower can contain Capability::SKIP_VALIDATE.";
return;
}