From 86e97b5f111e6bd7f89910235bc7996290dc4a7a Mon Sep 17 00:00:00 2001 From: Wonsik Kim Date: Thu, 6 Oct 2022 22:00:06 -0700 Subject: [PATCH] VtsHalMediaOmx: fix OmxCodecAllowedTest to match requirement Bug: 249043823 Bug: 251553217 Test: atest VtsHalMediaOmxV1_0TargetStoreTest Change-Id: I8015d559d8e7d88a32d1970102167fe4d7566c51 (cherry picked from commit db13ce5dafd40a29bf6f422c7da072d55acb1258) Merged-In: I8015d559d8e7d88a32d1970102167fe4d7566c51 --- .../VtsHalMediaOmxV1_0TargetStoreTest.cpp | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) mode change 100755 => 100644 media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp diff --git a/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp b/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp old mode 100755 new mode 100644 index 00e9837710..d80e651bcf --- a/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp +++ b/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp @@ -374,21 +374,16 @@ TEST_P(StoreHidlTest, ListRoles) { } } -static int getFirstApiLevel() { - int boardApiLevel = android::base::GetIntProperty("ro.board.first_api_level", 0); - if (boardApiLevel != 0) { - return boardApiLevel; - } - - return android::base::GetIntProperty("ro.product.first_api_level", __ANDROID_API_T__); -} - static bool isTV() { return testing::deviceSupportsFeature("android.software.leanback"); } // list components and roles. TEST_P(StoreHidlTest, OmxCodecAllowedTest) { + static int sBoardFirstApiLevel = android::base::GetIntProperty("ro.board.first_api_level", 0); + if (sBoardFirstApiLevel == 0) { + GTEST_SKIP() << "board first API level not detected"; + } hidl_vec componentInfos = getComponentInfoList(omx); for (IOmx::ComponentInfo info : componentInfos) { for (std::string role : info.mRoles) { @@ -396,27 +391,27 @@ TEST_P(StoreHidlTest, OmxCodecAllowedTest) { role.find("video_encoder") != std::string::npos) { // Codec2 is not mandatory on Android TV devices that launched with Android S if (isTV()) { - ASSERT_LT(getFirstApiLevel(), __ANDROID_API_T__) + ASSERT_LT(sBoardFirstApiLevel, __ANDROID_API_T__) << " Component: " << info.mName.c_str() << " Role: " << role.c_str() << " not allowed for devices launching with Android T and above"; } else { std::string codecName = info.mName; bool isAndroidCodec = (codecName.rfind("OMX.google", 0) != std::string::npos); - if (isAndroidCodec && (getFirstApiLevel() <= __ANDROID_API_S__)) { + if (isAndroidCodec && (sBoardFirstApiLevel <= __ANDROID_API_S__)) { // refer b/230582620 // S AOSP build did not remove the OMX.google video codecs // so it is infeasible to require no OMX.google.* video codecs // on S launching devices } else { - ASSERT_LT(getFirstApiLevel(), __ANDROID_API_S__) - << " Component: " << info.mName.c_str() << " Role: " << role.c_str() - << " not allowed for devices launching with Android S and above"; + ASSERT_LT(sBoardFirstApiLevel, __ANDROID_API_S__) + << " Component: " << info.mName.c_str() << " Role: " << role.c_str() + << " not allowed for devices launching with Android S and above"; } } } if (role.find("audio_decoder") != std::string::npos || role.find("audio_encoder") != std::string::npos) { - ASSERT_LT(getFirstApiLevel(), __ANDROID_API_T__) + ASSERT_LT(sBoardFirstApiLevel, __ANDROID_API_T__) << " Component: " << info.mName.c_str() << " Role: " << role.c_str() << " not allowed for devices launching with Android T and above"; }