From 9f3b352cdb59b0538cf317aa9b5e28b9b65cb017 Mon Sep 17 00:00:00 2001 From: Harish Mahendrakar Date: Fri, 4 Feb 2022 16:55:34 -0800 Subject: [PATCH] OMX VTS: Added a test to mandate transition to C2 codecs - For devices launching with S and above, only audio codecs are allowed to use OMX. - For devices launching with T and above, no codecs are allowed to use OMX. Bug: 217793552 Test: atest VtsHalMediaOmxV1_0TargetStoreTest Change-Id: Iff5e0c45dd7e61be9118bdcec1b6d35db3d39b4e --- .../VtsHalMediaOmxV1_0TargetStoreTest.cpp | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp b/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp index 8699de3eb8..d9a6363ec9 100644 --- a/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp +++ b/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp @@ -20,7 +20,9 @@ #endif #include +#include #include +#include #include #include @@ -371,6 +373,31 @@ TEST_P(StoreHidlTest, ListRoles) { } } +static int getFirstApiLevel() { + return android::base::GetIntProperty("ro.product.first_api_level", __ANDROID_API_T__); +} + +// list components and roles. +TEST_P(StoreHidlTest, OmxCodecAllowedTest) { + hidl_vec componentInfos = getComponentInfoList(omx); + for (IOmx::ComponentInfo info : componentInfos) { + for (std::string role : info.mRoles) { + if (role.find("video_decoder") != std::string::npos || + role.find("video_encoder") != std::string::npos) { + 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"; + } + if (role.find("audio_decoder") != std::string::npos || + role.find("audio_encoder") != std::string::npos) { + ASSERT_LT(getFirstApiLevel(), __ANDROID_API_T__) + << " Component: " << info.mName.c_str() << " Role: " << role.c_str() + << " not allowed for devices launching with Android T and above"; + } + } + } +} + // list components and roles. TEST_P(StoreHidlTest, ListNodes) { description("enumerate component and roles");