1b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker/* 2b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker * Copyright (C) 2016 The Android Open Source Project 3b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker * 4b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker * Licensed under the Apache License, Version 2.0 (the "License"); 5b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker * you may not use this file except in compliance with the License. 6b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker * You may obtain a copy of the License at 7b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker * 8b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker * http://www.apache.org/licenses/LICENSE-2.0 9b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker * 10b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker * Unless required by applicable law or agreed to in writing, software 11b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker * distributed under the License is distributed on an "AS IS" BASIS, 12b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker * See the License for the specific language governing permissions and 14b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker * limitations under the License. 15b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker */ 16da002fe6415cee1e37cc3131aafb79ddb53f01e5Jeff Tinker#ifndef ANDROID_HARDWARE_DRM_V1_0__CRYPTOFACTORY_H 17da002fe6415cee1e37cc3131aafb79ddb53f01e5Jeff Tinker#define ANDROID_HARDWARE_DRM_V1_0__CRYPTOFACTORY_H 18b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker 19da002fe6415cee1e37cc3131aafb79ddb53f01e5Jeff Tinker#include <android/hardware/drm/1.0/ICryptoFactory.h> 20b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker#include <hidl/Status.h> 21b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker#include <media/hardware/CryptoAPI.h> 2207770c78e18c5b09ba116fa1e779fe4408c42e3fJiyong Park#include <PluginLoader.h> 23b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker 24b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinkernamespace android { 25b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinkernamespace hardware { 26b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinkernamespace drm { 27b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinkernamespace V1_0 { 28b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinkernamespace implementation { 29b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker 3007770c78e18c5b09ba116fa1e779fe4408c42e3fJiyong Parkusing ::android::hardware::drm::V1_0::helper::PluginLoader; 31da002fe6415cee1e37cc3131aafb79ddb53f01e5Jeff Tinkerusing ::android::hardware::drm::V1_0::ICryptoFactory; 32da002fe6415cee1e37cc3131aafb79ddb53f01e5Jeff Tinkerusing ::android::hardware::drm::V1_0::ICryptoPlugin; 33b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinkerusing ::android::hardware::hidl_array; 34b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinkerusing ::android::hardware::hidl_string; 35b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinkerusing ::android::hardware::hidl_vec; 36b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinkerusing ::android::hardware::Return; 37b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinkerusing ::android::hardware::Void; 38b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinkerusing ::android::sp; 39b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker 40b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinkerstruct CryptoFactory : public ICryptoFactory { 41b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker CryptoFactory(); 42b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker virtual ~CryptoFactory() {} 43b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker 449a33bb2b25aaa1ff0fc05b0b4d73f7c2af55ac92Jeff Tinker // Methods from ::android::hardware::drm::V1_0::ICryptoFactory follow. 459a33bb2b25aaa1ff0fc05b0b4d73f7c2af55ac92Jeff Tinker 46b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker Return<bool> isCryptoSchemeSupported(const hidl_array<uint8_t, 16>& uuid) 47b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker override; 48b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker 49b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker Return<void> createPlugin(const hidl_array<uint8_t, 16>& uuid, 50b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker const hidl_vec<uint8_t>& initData, createPlugin_cb _hidl_cb) 51b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker override; 52b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker 53b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinkerprivate: 5407770c78e18c5b09ba116fa1e779fe4408c42e3fJiyong Park PluginLoader<android::CryptoFactory> loader; 55b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker 56b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker CryptoFactory(const CryptoFactory &) = delete; 57b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker void operator=(const CryptoFactory &) = delete; 58b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker}; 59b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker 60b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinkerextern "C" ICryptoFactory* HIDL_FETCH_ICryptoFactory(const char* name); 61b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker 62b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker} // namespace implementation 63b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker} // namespace V1_0 64b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker} // namespace drm 65b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker} // namespace hardware 66b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker} // namespace android 67b075caa3b95c0c980e6118fb78878b87ce21a6a3Jeff Tinker 68da002fe6415cee1e37cc3131aafb79ddb53f01e5Jeff Tinker#endif // ANDROID_HARDWARE_DRM_V1_0__CRYPTOFACTORY_H 69