1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef DRM_HAL_TEST_V1_4_H 18 #define DRM_HAL_TEST_V1_4_H 19 20 #include <android/hardware/drm/1.0/IDrmPlugin.h> 21 #include <android/hardware/drm/1.3/IDrmFactory.h> 22 #include <android/hardware/drm/1.4/ICryptoFactory.h> 23 #include <android/hardware/drm/1.4/ICryptoPlugin.h> 24 #include <android/hardware/drm/1.4/IDrmFactory.h> 25 #include <android/hardware/drm/1.4/IDrmPlugin.h> 26 #include <gtest/gtest.h> 27 #include <hidl/HidlSupport.h> 28 #include <hidl/ServiceManagement.h> 29 #include <log/log.h> 30 31 #include <algorithm> 32 #include <cstdint> 33 #include <iterator> 34 #include <string> 35 #include <utility> 36 #include <vector> 37 38 #include "drm_hal_vendor_module_api.h" 39 #include "drm_vts_helper.h" 40 #include "vendor_modules.h" 41 #include "VtsHalHidlTargetCallbackBase.h" 42 43 #include "android/hardware/drm/1.2/vts/drm_hal_common.h" 44 45 namespace android { 46 namespace hardware { 47 namespace drm { 48 namespace V1_4 { 49 namespace vts { 50 51 namespace drm = ::android::hardware::drm; 52 using android::hardware::hidl_array; 53 using android::hardware::hidl_string; 54 using V1_0::SessionId; 55 using V1_1::SecurityLevel; 56 57 using drm_vts::DrmHalTestParam; 58 59 class DrmHalTest : public drm::V1_2::vts::DrmHalTest { 60 public: 61 using drm::V1_2::vts::DrmHalTest::DrmHalTest; 62 static const char* const kVideoMp4; 63 static const char* const kAudioMp4; 64 static const uint32_t kSecLevelMin = static_cast<uint32_t>(SecurityLevel::SW_SECURE_CRYPTO); 65 static const uint32_t kSecLevelMax = static_cast<uint32_t>(SecurityLevel::HW_SECURE_ALL); 66 static const uint32_t kSecLevelDefault; 67 68 protected: 69 sp<V1_4::IDrmPlugin> DrmPluginV1_4() const; 70 sp<V1_0::ICryptoPlugin> CryptoPlugin(const SessionId& sid); 71 SessionId OpenSession(uint32_t level); 72 73 private: 74 void DoProvisioning(); 75 }; 76 77 } // namespace vts 78 } // namespace V1_4 79 } // namespace drm 80 } // namespace hardware 81 } // namespace android 82 83 #endif // DRM_HAL_TEST_V1_4_H 84