From bf6245967e398d5895c2b9f03aac5c2a0b2fab57 Mon Sep 17 00:00:00 2001 From: Jeff Tinker Date: Fri, 18 Jan 2019 19:30:41 -0800 Subject: [PATCH] Add securityLevel to MediaDrm isCryptoSchemeSupported API bug:110701831 test: cts media test cases, widevine integration tests Change-Id: I4a8973537b4b90740cdaf79a36e73943bcf074fb --- libwvdrmengine/include_hidl/WVDrmFactory.h | 5 +++++ libwvdrmengine/src_hidl/WVDrmFactory.cpp | 9 +++++++++ libwvdrmengine/test/unit/WVDrmFactory_test.cpp | 8 ++++++++ 3 files changed, 22 insertions(+) diff --git a/libwvdrmengine/include_hidl/WVDrmFactory.h b/libwvdrmengine/include_hidl/WVDrmFactory.h index 89663b25..19720113 100644 --- a/libwvdrmengine/include_hidl/WVDrmFactory.h +++ b/libwvdrmengine/include_hidl/WVDrmFactory.h @@ -24,6 +24,11 @@ struct WVDrmFactory : public IDrmFactory { Return isCryptoSchemeSupported(const hidl_array& uuid) override; + Return isCryptoSchemeSupported_1_2(const hidl_array& uuid, + const hidl_string& mimeType, + SecurityLevel level) + override; + Return isContentTypeSupported(const hidl_string &mimeType) override; diff --git a/libwvdrmengine/src_hidl/WVDrmFactory.cpp b/libwvdrmengine/src_hidl/WVDrmFactory.cpp index 857336e4..704ef1d1 100644 --- a/libwvdrmengine/src_hidl/WVDrmFactory.cpp +++ b/libwvdrmengine/src_hidl/WVDrmFactory.cpp @@ -31,6 +31,15 @@ Return WVDrmFactory::isCryptoSchemeSupported( return isWidevineUUID(uuid.data()); } +Return WVDrmFactory::isCryptoSchemeSupported_1_2( + const hidl_array& uuid, + const hidl_string& initDataType, + SecurityLevel level) { + return isWidevineUUID(uuid.data()) && + isContentTypeSupported(initDataType) + /* TODO: jtinker@ b/117104043 && wvcdm::IsSecurityLevelSupported(level)*/; +} + Return WVDrmFactory::isContentTypeSupported( const hidl_string& initDataType) { return wvcdm::WvContentDecryptionModule::IsSupported(initDataType.c_str()); diff --git a/libwvdrmengine/test/unit/WVDrmFactory_test.cpp b/libwvdrmengine/test/unit/WVDrmFactory_test.cpp index 3fc74317..aacf0805 100644 --- a/libwvdrmengine/test/unit/WVDrmFactory_test.cpp +++ b/libwvdrmengine/test/unit/WVDrmFactory_test.cpp @@ -95,6 +95,14 @@ TEST(WVDrmFactoryTest, DoesNotSupportUnsupportedContainerFormats) { "WVPluginFactory incorrectly claims to support WMV"; } +TEST(WVDrmFactoryTest, SupportsSupportedCryptoSchemeWithLevel) { + WVDrmFactory factory; + + EXPECT_TRUE(factory.isCryptoSchemeSupported_1_2(kWidevineUUID, hidl_string("video/mp4"), + android::hardware::drm::V1_1::SecurityLevel::SW_SECURE_CRYPTO)) << + "WVPluginFactory does not support Widevine's UUID for video/mp4 and SW_SECURE_CRYPTO"; +} + TEST(WVDrmFactoryTest, CalculatesSpoidUseCorrectly) { WVDrmFactory factory;