diff options
Diffstat (limited to 'drm')
-rw-r--r-- | drm/1.0/Android.bp | 7 | ||||
-rw-r--r-- | drm/1.0/default/Android.mk | 3 | ||||
-rw-r--r-- | drm/1.0/default/CryptoFactory.h | 1 | ||||
-rw-r--r-- | drm/1.0/default/CryptoPlugin.cpp | 15 | ||||
-rw-r--r-- | drm/1.0/default/DrmFactory.h | 1 | ||||
-rw-r--r-- | drm/1.0/vts/functional/Android.bp | 21 | ||||
-rw-r--r-- | drm/1.0/vts/functional/drm_hal_clearkey_test.cpp | 114 | ||||
-rw-r--r-- | drm/1.0/vts/functional/drm_hal_vendor_test.cpp | 24 | ||||
-rw-r--r-- | drm/Android.bp | 1 |
9 files changed, 108 insertions, 79 deletions
diff --git a/drm/1.0/Android.bp b/drm/1.0/Android.bp index 731f58fa1..d004b8272 100644 --- a/drm/1.0/Android.bp +++ b/drm/1.0/Android.bp @@ -67,13 +67,16 @@ genrule { ], } -cc_library_shared { +cc_library { name: "android.hardware.drm@1.0", defaults: ["hidl-module-defaults"], generated_sources: ["android.hardware.drm@1.0_genc++"], generated_headers: ["android.hardware.drm@1.0_genc++_headers"], export_generated_headers: ["android.hardware.drm@1.0_genc++_headers"], vendor_available: true, + vndk: { + enabled: true, + }, shared_libs: [ "libhidlbase", "libhidltransport", @@ -89,5 +92,3 @@ cc_library_shared { "libutils", ], } - -subdirs = ["default"] diff --git a/drm/1.0/default/Android.mk b/drm/1.0/default/Android.mk index 0cc6e71b2..99773be38 100644 --- a/drm/1.0/default/Android.mk +++ b/drm/1.0/default/Android.mk @@ -42,6 +42,9 @@ LOCAL_STATIC_LIBRARIES := \ LOCAL_C_INCLUDES := \ hardware/interfaces/drm +LOCAL_HEADER_LIBRARIES := \ + media_plugin_headers + # TODO(b/18948909) Some legacy DRM plugins only support 32-bit. They need to be # migrated to 64-bit. Once all of a device's legacy DRM plugins support 64-bit, # that device can turn on TARGET_ENABLE_MEDIADRM_64 to build this service as diff --git a/drm/1.0/default/CryptoFactory.h b/drm/1.0/default/CryptoFactory.h index 6b1d1ffce..86130dc36 100644 --- a/drm/1.0/default/CryptoFactory.h +++ b/drm/1.0/default/CryptoFactory.h @@ -20,7 +20,6 @@ #include <hidl/Status.h> #include <media/hardware/CryptoAPI.h> #include <PluginLoader.h> -#include <media/SharedLibrary.h> namespace android { namespace hardware { diff --git a/drm/1.0/default/CryptoPlugin.cpp b/drm/1.0/default/CryptoPlugin.cpp index 6626c0172..aa5c6edc6 100644 --- a/drm/1.0/default/CryptoPlugin.cpp +++ b/drm/1.0/default/CryptoPlugin.cpp @@ -51,7 +51,11 @@ namespace implementation { Return<void> CryptoPlugin::setSharedBufferBase(const hidl_memory& base, uint32_t bufferId) { - mSharedBufferMap[bufferId] = mapMemory(base); + sp<IMemory> hidlMemory = mapMemory(base); + ALOGE_IF(hidlMemory == nullptr, "mapMemory returns nullptr"); + + // allow mapMemory to return nullptr + mSharedBufferMap[bufferId] = hidlMemory; return Void(); } @@ -118,6 +122,10 @@ namespace implementation { AString detailMessage; sp<IMemory> sourceBase = mSharedBufferMap[source.bufferId]; + if (sourceBase == nullptr) { + _hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, 0, "source is a nullptr"); + return Void(); + } if (source.offset + offset + source.size > sourceBase->getSize()) { _hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, 0, "invalid buffer size"); @@ -132,6 +140,11 @@ namespace implementation { if (destination.type == BufferType::SHARED_MEMORY) { const SharedBuffer& destBuffer = destination.nonsecureMemory; sp<IMemory> destBase = mSharedBufferMap[destBuffer.bufferId]; + if (destBase == nullptr) { + _hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, 0, "destination is a nullptr"); + return Void(); + } + if (destBuffer.offset + destBuffer.size > destBase->getSize()) { _hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, 0, "invalid buffer size"); return Void(); diff --git a/drm/1.0/default/DrmFactory.h b/drm/1.0/default/DrmFactory.h index 726bf9718..32e192db8 100644 --- a/drm/1.0/default/DrmFactory.h +++ b/drm/1.0/default/DrmFactory.h @@ -20,7 +20,6 @@ #include <hidl/Status.h> #include <media/drm/DrmAPI.h> #include <PluginLoader.h> -#include <media/SharedLibrary.h> namespace android { namespace hardware { diff --git a/drm/1.0/vts/functional/Android.bp b/drm/1.0/vts/functional/Android.bp index b45ce848d..57678fb46 100644 --- a/drm/1.0/vts/functional/Android.bp +++ b/drm/1.0/vts/functional/Android.bp @@ -16,33 +16,20 @@ cc_test { name: "VtsHalDrmV1_0TargetTest", + defaults: ["VtsHalTargetTestDefaults"], srcs: [ "drm_hal_clearkey_test.cpp", "drm_hal_vendor_test.cpp", "vendor_modules.cpp" - ], - shared_libs: [ + ], + static_libs: [ "android.hardware.drm@1.0", + "android.hardware.drm@1.0-helper", "android.hidl.allocator@1.0", "android.hidl.memory@1.0", - "libbase", - "libcutils", - "libhidlbase", "libhidlmemory", - "libhidltransport", - "libhwbinder", - "liblog", "libnativehelper", "libssl", "libcrypto", - "libutils", - ], - static_libs: [ - "VtsHalHidlTargetTestBase", - "android.hardware.drm@1.0-helper", - ], - cflags: [ - "-O0", - "-g", ], } diff --git a/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp b/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp index 5d6ebd37f..a110eb150 100644 --- a/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp +++ b/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp @@ -76,10 +76,15 @@ using std::vector; #define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk()) #define EXPECT_OK(ret) EXPECT_TRUE(ret.isOk()) -static const uint8_t kClearKeyUUID[16] = { +static const uint8_t kCommonPsshBoxUUID[16] = { 0x10, 0x77, 0xEF, 0xEC, 0xC0, 0xB2, 0x4D, 0x02, 0xAC, 0xE3, 0x3C, 0x1E, 0x52, 0xE2, 0xFB, 0x4B}; +// To be used in mpd to specify drm scheme for players +static const uint8_t kClearKeyUUID[16] = { + 0xE2, 0x71, 0x9D, 0x58, 0xA9, 0x85, 0xB3, 0xC9, + 0x78, 0x1A, 0xB0, 0x30, 0xAF, 0x78, 0xD3, 0x0E}; + static const uint8_t kInvalidUUID[16] = { 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80}; @@ -98,10 +103,10 @@ class DrmHalClearkeyFactoryTest : public ::testing::VtsHalHidlTargetTestBase { drmFactory = ::testing::VtsHalHidlTargetTestBase::getService<IDrmFactory>(); - ASSERT_NE(drmFactory, nullptr); + ASSERT_NE(nullptr, drmFactory.get()); cryptoFactory = ::testing::VtsHalHidlTargetTestBase::getService<ICryptoFactory>(); - ASSERT_NE(cryptoFactory, nullptr); + ASSERT_NE(nullptr, cryptoFactory.get()); } virtual void TearDown() override {} @@ -112,9 +117,12 @@ class DrmHalClearkeyFactoryTest : public ::testing::VtsHalHidlTargetTestBase { }; /** - * Ensure the factory supports the clearkey scheme UUID + * Ensure the factory supports both Common Pssh Box UUID and Clearkey Scheme UUID */ TEST_F(DrmHalClearkeyFactoryTest, ClearKeyPluginSupported) { + EXPECT_TRUE(drmFactory->isCryptoSchemeSupported(kCommonPsshBoxUUID)); + EXPECT_TRUE(cryptoFactory->isCryptoSchemeSupported(kCommonPsshBoxUUID)); + EXPECT_TRUE(drmFactory->isCryptoSchemeSupported(kClearKeyUUID)); EXPECT_TRUE(cryptoFactory->isCryptoSchemeSupported(kClearKeyUUID)); } @@ -162,29 +170,57 @@ TEST_F(DrmHalClearkeyFactoryTest, ValidContentTypeSupported) { } /** - * Ensure clearkey drm plugin can be created + * Ensure clearkey drm plugin can be created using Common Pssh Box UUID + */ +TEST_F(DrmHalClearkeyFactoryTest, CreateClearKeyDrmPluginUsingCommonPsshBoxUuid) { + hidl_string packageName("android.hardware.drm.test"); + auto res = drmFactory->createPlugin( + kCommonPsshBoxUUID, packageName, + [&](Status status, const sp<IDrmPlugin>& plugin) { + EXPECT_EQ(Status::OK, status); + EXPECT_NE(nullptr, plugin.get()); + }); + EXPECT_OK(res); +} + +/** + * Ensure clearkey drm plugin can be created using ClearKey UUID */ -TEST_F(DrmHalClearkeyFactoryTest, CreateClearKeyDrmPlugin) { + TEST_F(DrmHalClearkeyFactoryTest, CreateClearKeyDrmPluginUsingClearKeyUuid) { hidl_string packageName("android.hardware.drm.test"); auto res = drmFactory->createPlugin( kClearKeyUUID, packageName, [&](Status status, const sp<IDrmPlugin>& plugin) { EXPECT_EQ(Status::OK, status); - EXPECT_NE(plugin, nullptr); + EXPECT_NE(nullptr, plugin.get()); }); EXPECT_OK(res); } /** - * Ensure clearkey crypto plugin can be created + * Ensure clearkey crypto plugin can be created using Common Pssh Box UUID */ -TEST_F(DrmHalClearkeyFactoryTest, CreateClearKeyCryptoPlugin) { +TEST_F(DrmHalClearkeyFactoryTest, CreateClearKeyCryptoPluginUsingCommonPsshBoxUuid) { + hidl_vec<uint8_t> initVec; + auto res = cryptoFactory->createPlugin( + kCommonPsshBoxUUID, initVec, + [&](Status status, const sp<ICryptoPlugin>& plugin) { + EXPECT_EQ(Status::OK, status); + EXPECT_NE(nullptr, plugin.get()); + }); + EXPECT_OK(res); +} + +/** + * Ensure clearkey crypto plugin can be created using ClearKey UUID + */ +TEST_F(DrmHalClearkeyFactoryTest, CreateClearKeyCryptoPluginUsingClearKeyUuid) { hidl_vec<uint8_t> initVec; auto res = cryptoFactory->createPlugin( kClearKeyUUID, initVec, [&](Status status, const sp<ICryptoPlugin>& plugin) { EXPECT_EQ(Status::OK, status); - EXPECT_NE(plugin, nullptr); + EXPECT_NE(nullptr, plugin.get()); }); EXPECT_OK(res); } @@ -198,7 +234,7 @@ TEST_F(DrmHalClearkeyFactoryTest, CreateInvalidDrmPlugin) { kInvalidUUID, packageName, [&](Status status, const sp<IDrmPlugin>& plugin) { EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status); - EXPECT_EQ(plugin, nullptr); + EXPECT_EQ(nullptr, plugin.get()); }); EXPECT_OK(res); } @@ -212,7 +248,7 @@ TEST_F(DrmHalClearkeyFactoryTest, CreateInvalidCryptoPlugin) { kInvalidUUID, initVec, [&](Status status, const sp<ICryptoPlugin>& plugin) { EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status); - EXPECT_EQ(plugin, nullptr); + EXPECT_EQ(nullptr, plugin.get()); }); EXPECT_OK(res); } @@ -223,13 +259,13 @@ class DrmHalClearkeyPluginTest : public DrmHalClearkeyFactoryTest { // Create factories DrmHalClearkeyFactoryTest::SetUp(); - ASSERT_NE(drmFactory, nullptr); + ASSERT_NE(nullptr, drmFactory.get()); hidl_string packageName("android.hardware.drm.test"); auto res = drmFactory->createPlugin( kClearKeyUUID, packageName, [this](Status status, const sp<IDrmPlugin>& plugin) { EXPECT_EQ(Status::OK, status); - ASSERT_NE(plugin, nullptr); + ASSERT_NE(nullptr, plugin.get()); drmPlugin = plugin; }); ASSERT_OK(res); @@ -239,7 +275,7 @@ class DrmHalClearkeyPluginTest : public DrmHalClearkeyFactoryTest { kClearKeyUUID, initVec, [this](Status status, const sp<ICryptoPlugin>& plugin) { EXPECT_EQ(Status::OK, status); - ASSERT_NE(plugin, nullptr); + ASSERT_NE(nullptr, plugin.get()); cryptoPlugin = plugin; }); ASSERT_OK(res); @@ -330,32 +366,29 @@ hidl_vec<uint8_t> DrmHalClearkeyPluginTest::loadKeys( // full box header (version = 1 flags = 0) 0x01, 0x00, 0x00, 0x00, // system id - 0x10, 0x77, 0xef, 0xec, 0xc0, 0xb2, 0x4d, 0x02, 0xac, 0xe3, 0x3c, 0x1e, - 0x52, 0xe2, 0xfb, 0x4b, + 0x10, 0x77, 0xef, 0xec, 0xc0, 0xb2, 0x4d, 0x02, 0xac, 0xe3, 0x3c, + 0x1e, 0x52, 0xe2, 0xfb, 0x4b, // number of key ids 0x00, 0x00, 0x00, 0x01, // key id - 0x60, 0x06, 0x1e, 0x01, 0x7e, 0x47, 0x7e, 0x87, 0x7e, 0x57, 0xd0, 0x0d, - 0x1e, 0xd0, 0x0d, 0x1e, + 0x60, 0x06, 0x1e, 0x01, 0x7e, 0x47, 0x7e, 0x87, 0x7e, 0x57, 0xd0, + 0x0d, 0x1e, 0xd0, 0x0d, 0x1e, // size of data, must be zero 0x00, 0x00, 0x00, 0x00}; hidl_vec<uint8_t> expectedKeyRequest = { - 0x7b, 0x22, 0x6b, 0x69, 0x64, 0x73, 0x22, 0x3a, 0x5b, 0x22, 0x59, - 0x41, 0x59, 0x65, 0x41, 0x58, 0x35, 0x48, 0x66, 0x6f, 0x64, 0x2b, - 0x56, 0x39, 0x41, 0x4e, 0x48, 0x74, 0x41, 0x4e, 0x48, 0x67, 0x22, - 0x5d, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x74, - 0x65, 0x6d, 0x70, 0x6f, 0x72, 0x61, 0x72, 0x79, 0x22, 0x7d}; + 0x7b, 0x22, 0x6b, 0x69, 0x64, 0x73, 0x22, 0x3a, 0x5b, 0x22, 0x59, 0x41, 0x59, 0x65, + 0x41, 0x58, 0x35, 0x48, 0x66, 0x6f, 0x64, 0x2d, 0x56, 0x39, 0x41, 0x4e, 0x48, 0x74, + 0x41, 0x4e, 0x48, 0x67, 0x22, 0x5d, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, + 0x22, 0x74, 0x65, 0x6d, 0x70, 0x6f, 0x72, 0x61, 0x72, 0x79, 0x22, 0x7d}; hidl_vec<uint8_t> knownKeyResponse = { - 0x7b, 0x22, 0x6b, 0x65, 0x79, 0x73, 0x22, 0x3a, 0x5b, 0x7b, 0x22, - 0x6b, 0x74, 0x79, 0x22, 0x3a, 0x22, 0x6f, 0x63, 0x74, 0x22, 0x2c, - 0x22, 0x6b, 0x69, 0x64, 0x22, 0x3a, 0x22, 0x59, 0x41, 0x59, 0x65, - 0x41, 0x58, 0x35, 0x48, 0x66, 0x6f, 0x64, 0x2b, 0x56, 0x39, 0x41, - 0x4e, 0x48, 0x74, 0x41, 0x4e, 0x48, 0x67, 0x22, 0x2c, 0x22, 0x6b, - 0x22, 0x3a, 0x22, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x54, 0x65, - 0x73, 0x74, 0x4b, 0x65, 0x79, 0x42, 0x61, 0x73, 0x65, 0x36, 0x34, - 0x67, 0x67, 0x67, 0x22, 0x7d, 0x5d, 0x7d, 0x0a}; + 0x7b, 0x22, 0x6b, 0x65, 0x79, 0x73, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x6b, 0x74, 0x79, 0x22, + 0x3a, 0x22, 0x6f, 0x63, 0x74, 0x22, 0x2c, 0x22, 0x6b, 0x69, 0x64, 0x22, 0x3a, 0x22, 0x59, + 0x41, 0x59, 0x65, 0x41, 0x58, 0x35, 0x48, 0x66, 0x6f, 0x64, 0x2d, 0x56, 0x39, 0x41, 0x4e, + 0x48, 0x74, 0x41, 0x4e, 0x48, 0x67, 0x22, 0x2c, 0x22, 0x6b, 0x22, 0x3a, 0x22, 0x47, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x54, 0x65, 0x73, 0x74, 0x4b, 0x65, 0x79, 0x42, 0x61, 0x73, 0x65, + 0x36, 0x34, 0x67, 0x67, 0x67, 0x22, 0x7d, 0x5d, 0x7d, 0x0a}; hidl_string mimeType = "video/mp4"; KeyedVector optionalParameters; @@ -870,7 +903,7 @@ TEST_F(DrmHalClearkeyPluginTest, NotifyResolution) { sp<IMemory> DrmHalClearkeyPluginTest::getDecryptMemory(size_t size, size_t index) { sp<IAllocator> ashmemAllocator = IAllocator::getService("ashmem"); - EXPECT_NE(ashmemAllocator, nullptr); + EXPECT_NE(nullptr, ashmemAllocator.get()); hidl_memory hidlMemory; auto res = ashmemAllocator->allocate( @@ -882,6 +915,7 @@ sp<IMemory> DrmHalClearkeyPluginTest::getDecryptMemory(size_t size, EXPECT_OK(res); sp<IMemory> mappedMemory = mapMemory(hidlMemory); + EXPECT_NE(nullptr, mappedMemory.get()); EXPECT_OK(cryptoPlugin->setSharedBufferBase(hidlMemory, index)); return mappedMemory; } @@ -1069,8 +1103,6 @@ void DrmHalClearkeyDecryptTest::aes_cbc_decrypt(uint8_t* dest, uint8_t* src, AES_set_encrypt_key(&key[0], 128, &decryptionKey); size_t offset = 0; - size_t num = 0; - size_t ecount_buf = 0; for (size_t i = 0; i < subSamples.size(); i++) { memcpy(dest + offset, src + offset, subSamples[i].numBytesOfClearData); offset += subSamples[i].numBytesOfClearData; @@ -1086,12 +1118,11 @@ void DrmHalClearkeyDecryptTest::aes_cbc_decrypt(uint8_t* dest, uint8_t* src, */ TEST_F(DrmHalClearkeyDecryptTest, TestQueryKeyStatus) { auto sessionId = openSession(); - auto res = drmPlugin->queryKeyStatus(sessionId, - [&](Status status, KeyedVector /* info */) { - // clearkey doesn't support this method - EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status); - }); + auto res = drmPlugin->queryKeyStatus( + sessionId, [&](Status status, KeyedVector /* info */) { EXPECT_EQ(Status::OK, status); }); EXPECT_OK(res); + + closeSession(sessionId); } /** @@ -1109,7 +1140,6 @@ TEST_F(DrmHalClearkeyDecryptTest, ClearSegmentTest) { Status status = cryptoPlugin->setMediaDrmSession(sessionId); EXPECT_EQ(Status::OK, status); - const bool kNotSecure = false; uint32_t byteCount = decrypt(Mode::UNENCRYPTED, &iv[0], subSamples, noPattern, Status::OK); EXPECT_EQ(k256SubSampleByteCount, byteCount); @@ -1133,7 +1163,6 @@ TEST_F(DrmHalClearkeyDecryptTest, EncryptedAesCtrSegmentTest) { Status status = cryptoPlugin->setMediaDrmSession(sessionId); EXPECT_EQ(Status::OK, status); - const bool kNotSecure = false; uint32_t byteCount = decrypt(Mode::AES_CTR, &iv[0], subSamples, noPattern, Status::OK); EXPECT_EQ(k512SubSampleClearBytes + k512SubSampleEncryptedBytes, byteCount); @@ -1155,7 +1184,6 @@ TEST_F(DrmHalClearkeyDecryptTest, EncryptedAesCtrSegmentTestNoKeys) { Status status = cryptoPlugin->setMediaDrmSession(sessionId); EXPECT_EQ(Status::OK, status); - const bool kNotSecure = false; uint32_t byteCount = decrypt(Mode::AES_CTR, &iv[0], subSamples, noPattern, Status::ERROR_DRM_NO_LICENSE); EXPECT_EQ(0u, byteCount); diff --git a/drm/1.0/vts/functional/drm_hal_vendor_test.cpp b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp index e651e193b..47c6950cd 100644 --- a/drm/1.0/vts/functional/drm_hal_vendor_test.cpp +++ b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp @@ -113,7 +113,7 @@ class DrmHalVendorFactoryTest : public testing::TestWithParam<std::string> { test_info->test_case_name(), test_info->name(), GetParam().c_str()); - ASSERT_NE(vendorModule, nullptr); + ASSERT_NE(nullptr, vendorModule.get()); // First try the binderized service name provided by the vendor module. // If that fails, which it can on non-binderized devices, try the default @@ -123,14 +123,14 @@ class DrmHalVendorFactoryTest : public testing::TestWithParam<std::string> { if (drmFactory == nullptr) { drmFactory = VtsTestBase::getService<IDrmFactory>(); } - ASSERT_NE(drmFactory, nullptr); + ASSERT_NE(nullptr, drmFactory.get()); // Do the same for the crypto factory cryptoFactory = VtsTestBase::getService<ICryptoFactory>(name); if (cryptoFactory == nullptr) { cryptoFactory = VtsTestBase::getService<ICryptoFactory>(); } - ASSERT_NE(cryptoFactory, nullptr); + ASSERT_NE(nullptr, cryptoFactory.get()); // If drm scheme not installed skip subsequent tests if (!drmFactory->isCryptoSchemeSupported(getVendorUUID())) { @@ -239,7 +239,7 @@ TEST_P(DrmHalVendorFactoryTest, CreateVendorDrmPlugin) { getVendorUUID(), packageName, [&](Status status, const sp<IDrmPlugin>& plugin) { EXPECT_EQ(Status::OK, status); - EXPECT_NE(plugin, nullptr); + EXPECT_NE(nullptr, plugin.get()); }); EXPECT_OK(res); } @@ -254,7 +254,7 @@ TEST_P(DrmHalVendorFactoryTest, CreateVendorCryptoPlugin) { getVendorUUID(), initVec, [&](Status status, const sp<ICryptoPlugin>& plugin) { EXPECT_EQ(Status::OK, status); - EXPECT_NE(plugin, nullptr); + EXPECT_NE(nullptr, plugin.get()); }); EXPECT_OK(res); } @@ -269,7 +269,7 @@ TEST_P(DrmHalVendorFactoryTest, CreateInvalidDrmPlugin) { kInvalidUUID, packageName, [&](Status status, const sp<IDrmPlugin>& plugin) { EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status); - EXPECT_EQ(plugin, nullptr); + EXPECT_EQ(nullptr, plugin.get()); }); EXPECT_OK(res); } @@ -284,7 +284,7 @@ TEST_P(DrmHalVendorFactoryTest, CreateInvalidCryptoPlugin) { kInvalidUUID, initVec, [&](Status status, const sp<ICryptoPlugin>& plugin) { EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status); - EXPECT_EQ(plugin, nullptr); + EXPECT_EQ(nullptr, plugin.get()); }); EXPECT_OK(res); } @@ -302,7 +302,7 @@ class DrmHalVendorPluginTest : public DrmHalVendorFactoryTest { getVendorUUID(), packageName, [this](Status status, const sp<IDrmPlugin>& plugin) { EXPECT_EQ(Status::OK, status); - ASSERT_NE(plugin, nullptr); + ASSERT_NE(nullptr, plugin.get()); drmPlugin = plugin; }); ASSERT_OK(res); @@ -312,7 +312,7 @@ class DrmHalVendorPluginTest : public DrmHalVendorFactoryTest { getVendorUUID(), initVec, [this](Status status, const sp<ICryptoPlugin>& plugin) { EXPECT_EQ(Status::OK, status); - ASSERT_NE(plugin, nullptr); + ASSERT_NE(nullptr, plugin.get()); cryptoPlugin = plugin; }); ASSERT_OK(res); @@ -1185,7 +1185,7 @@ TEST_P(DrmHalVendorPluginTest, NotifyResolution) { sp<IMemory> DrmHalVendorPluginTest::getDecryptMemory(size_t size, size_t index) { sp<IAllocator> ashmemAllocator = IAllocator::getService("ashmem"); - EXPECT_NE(ashmemAllocator, nullptr); + EXPECT_NE(nullptr, ashmemAllocator.get()); hidl_memory hidlMemory; auto res = ashmemAllocator->allocate( @@ -1198,7 +1198,7 @@ sp<IMemory> DrmHalVendorPluginTest::getDecryptMemory(size_t size, EXPECT_OK(res); sp<IMemory> mappedMemory = mapMemory(hidlMemory); - EXPECT_NE(mappedMemory, nullptr); + EXPECT_NE(nullptr, mappedMemory.get()); res = cryptoPlugin->setSharedBufferBase(hidlMemory, index); EXPECT_OK(res); return mappedMemory; @@ -1406,8 +1406,6 @@ void DrmHalVendorDecryptTest::aes_cbc_decrypt(uint8_t* dest, uint8_t* src, AES_set_encrypt_key(&key[0], 128, &decryptionKey); size_t offset = 0; - size_t num = 0; - size_t ecount_buf = 0; for (size_t i = 0; i < subSamples.size(); i++) { const SubSample& subSample = subSamples[i]; diff --git a/drm/Android.bp b/drm/Android.bp index 33f70ebae..ed19a3703 100644 --- a/drm/Android.bp +++ b/drm/Android.bp @@ -1,5 +1,6 @@ // This is an autogenerated file, do not edit. subdirs = [ "1.0", + "1.0/default", "1.0/vts/functional", ] |