diff --git a/staging/threadnetwork/aidl/vts/VtsHalThreadNetworkTargetTest.cpp b/staging/threadnetwork/aidl/vts/VtsHalThreadNetworkTargetTest.cpp index 3e43f9c8b7..14c5b06d1b 100644 --- a/staging/threadnetwork/aidl/vts/VtsHalThreadNetworkTargetTest.cpp +++ b/staging/threadnetwork/aidl/vts/VtsHalThreadNetworkTargetTest.cpp @@ -67,10 +67,33 @@ class ThreadNetworkAidl : public testing::TestWithParam { } virtual void TearDown() override { thread_chip->close(); } + bool DeviceSupportsFeature(const char* feature); + static constexpr char kTvFeatureName[] = "android.software.leanback"; std::shared_ptr thread_chip; }; +bool ThreadNetworkAidl::DeviceSupportsFeature(const char* feature) { + bool device_supports_feature = false; + FILE* p = popen("pm list features", "re"); + char* line = nullptr; + size_t len = 0; + + if (!p) { + return false; + } + + while (getline(&line, &len, p) > 0) { + if (strstr(line, feature)) { + device_supports_feature = true; + break; + } + } + pclose(p); + + return device_supports_feature; +} + TEST_P(ThreadNetworkAidl, Open) { std::shared_ptr callback = ndk::SharedRefBase::make([](auto /* data */) {}); @@ -122,6 +145,10 @@ TEST_P(ThreadNetworkAidl, SendSpinelFrame) { } }); + if (DeviceSupportsFeature(kTvFeatureName)) { + GTEST_SKIP() << "SendSpinelFrame test is bypassed on TV devices"; + } + ASSERT_NE(callback, nullptr); EXPECT_TRUE(thread_chip->open(callback).isOk());