diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2017-10-05 07:24:14 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2017-10-05 07:24:14 +0000 |
commit | 86d74b4cf0a553052d3bc1f8952fa034c5ca6b92 (patch) | |
tree | a8870fa5fcbbf273a6f619ac650111071c216d0d | |
parent | f8bdc8ceae92e2b2e61be33d384f241fd5872ba1 (diff) | |
parent | 0c7d0a9d0dba6f8d879b8b61cbc1c5b56a5cfd99 (diff) | |
download | android_hardware_interfaces-86d74b4cf0a553052d3bc1f8952fa034c5ca6b92.tar.gz android_hardware_interfaces-86d74b4cf0a553052d3bc1f8952fa034c5ca6b92.tar.bz2 android_hardware_interfaces-86d74b4cf0a553052d3bc1f8952fa034c5ca6b92.zip |
Snap for 4378450 from 0c7d0a9d0dba6f8d879b8b61cbc1c5b56a5cfd99 to oc-mr1-release
Change-Id: I7a709f6418fb267d2c4aad0d6cfd14e458181b71
-rw-r--r-- | drm/1.0/vts/functional/drm_hal_clearkey_test.cpp | 88 | ||||
-rw-r--r-- | neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp | 39 | ||||
-rw-r--r-- | tests/libhwbinder/1.0/default/Android.bp | 1 |
3 files changed, 93 insertions, 35 deletions
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 3966eac15..4652c76d5 100644 --- a/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp +++ b/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp @@ -76,12 +76,14 @@ using std::vector; #define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk()) #define EXPECT_OK(ret) EXPECT_TRUE(ret.isOk()) -static const uint8_t kCommonPsshBoxUUID[16] = {0x10, 0x77, 0xEF, 0xEC, 0xC0, 0xB2, 0x4D, 0x02, - 0xAC, 0xE3, 0x3C, 0x1E, 0x52, 0xE2, 0xFB, 0x4B}; +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 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, @@ -111,7 +113,7 @@ 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)); @@ -164,9 +166,23 @@ 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, CreateClearKeyDrmPlugin) { +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, CreateClearKeyDrmPluginUsingClearKeyUuid) { hidl_string packageName("android.hardware.drm.test"); auto res = drmFactory->createPlugin( kClearKeyUUID, packageName, @@ -178,9 +194,23 @@ TEST_F(DrmHalClearkeyFactoryTest, CreateClearKeyDrmPlugin) { } /** - * Ensure clearkey crypto plugin can be created + * Ensure clearkey crypto plugin can be created using Common Pssh Box UUID + */ +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, CreateClearKeyCryptoPlugin) { +TEST_F(DrmHalClearkeyFactoryTest, CreateClearKeyCryptoPluginUsingClearKeyUuid) { hidl_vec<uint8_t> initVec; auto res = cryptoFactory->createPlugin( kClearKeyUUID, initVec, @@ -332,32 +362,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; @@ -1085,12 +1112,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); } diff --git a/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp b/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp index 366bfc19a..735528b95 100644 --- a/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp +++ b/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp @@ -21,6 +21,7 @@ #include <android-base/logging.h> #include <android/hidl/memory/1.0/IMemory.h> #include <hidlmemory/mapping.h> +#include <iostream> namespace android { namespace hardware { @@ -70,6 +71,19 @@ void Execute(const sp<IDevice>& device, std::function<Model(void)> create_model, const uint32_t OUTPUT = 1; Model model = create_model(); + // see if service can handle model + ErrorStatus supportedStatus; + bool fullySupportsModel = false; + Return<void> supportedCall = device->getSupportedOperations( + model, [&](ErrorStatus status, const hidl_vec<bool>& supported) { + supportedStatus = status; + ASSERT_NE(0ul, supported.size()); + fullySupportsModel = + std::all_of(supported.begin(), supported.end(), [](bool valid) { return valid; }); + }); + ASSERT_TRUE(supportedCall.isOk()); + ASSERT_EQ(ErrorStatus::NONE, supportedStatus); + // launch prepare model sp<PreparedModelCallback> preparedModelCallback = new PreparedModelCallback(); ASSERT_NE(nullptr, preparedModelCallback.get()); @@ -79,8 +93,24 @@ void Execute(const sp<IDevice>& device, std::function<Model(void)> create_model, // retrieve prepared model preparedModelCallback->wait(); ErrorStatus prepareReturnStatus = preparedModelCallback->getStatus(); - EXPECT_EQ(ErrorStatus::NONE, prepareReturnStatus); sp<IPreparedModel> preparedModel = preparedModelCallback->getPreparedModel(); + if (fullySupportsModel) { + EXPECT_EQ(ErrorStatus::NONE, prepareReturnStatus); + } else { + EXPECT_TRUE(prepareReturnStatus == ErrorStatus::NONE || + prepareReturnStatus == ErrorStatus::GENERAL_FAILURE); + } + + // early termination if vendor service cannot fully prepare model + if (!fullySupportsModel && prepareReturnStatus == ErrorStatus::GENERAL_FAILURE) { + ASSERT_EQ(nullptr, preparedModel.get()); + LOG(INFO) << "NN VTS: Early termination of test because vendor service cannot " + "prepare model that it does not support."; + std::cout << "[ ] Early termination of test because vendor service cannot " + "prepare model that it does not support." + << std::endl; + return; + } ASSERT_NE(nullptr, preparedModel.get()); int example_no = 1; @@ -101,14 +131,17 @@ void Execute(const sp<IDevice>& device, std::function<Model(void)> create_model, .location = {.poolIndex = INPUT, .offset = 0, .length = static_cast<uint32_t>(s)}, .dimensions = {}, }; - inputs_info[index] = arg; + RequestArgument arg_empty = { + .hasNoValue = true, + }; + inputs_info[index] = s ? arg : arg_empty; inputSize += s; }); // Compute offset for inputs 1 and so on { size_t offset = 0; for (auto& i : inputs_info) { - i.location.offset = offset; + if (!i.hasNoValue) i.location.offset = offset; offset += i.location.length; } } diff --git a/tests/libhwbinder/1.0/default/Android.bp b/tests/libhwbinder/1.0/default/Android.bp index af4caeca1..13f9c1830 100644 --- a/tests/libhwbinder/1.0/default/Android.bp +++ b/tests/libhwbinder/1.0/default/Android.bp @@ -1,7 +1,6 @@ cc_library_shared { name: "android.hardware.tests.libhwbinder@1.0-impl", relative_install_path: "hw", - proprietary: true, srcs: [ "Benchmark.cpp", "ScheduleTest.cpp", |