blob: 0855996cce24f4d9096f5c9e0a5996d02cd2fb11 [file] [log] [blame]
Jeff Tinkerb075caa2016-12-06 23:15:20 -08001/*
2 * Copyright (C) 2016 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#ifndef ANDROID_HARDWARE_DRM_CRYPTO_V1_0__CRYPTOFACTORY_H
17#define ANDROID_HARDWARE_DRM_CRYPTO_V1_0__CRYPTOFACTORY_H
18
19#include <android/hardware/drm/crypto/1.0/ICryptoFactory.h>
20#include <hidl/Status.h>
21#include <media/hardware/CryptoAPI.h>
22#include <media/PluginLoader.h>
23#include <media/SharedLibrary.h>
24
25namespace android {
26namespace hardware {
27namespace drm {
28namespace crypto {
29namespace V1_0 {
30namespace implementation {
31
32using ::android::hardware::drm::crypto::V1_0::ICryptoFactory;
33using ::android::hardware::drm::crypto::V1_0::ICryptoPlugin;
34using ::android::hardware::hidl_array;
35using ::android::hardware::hidl_string;
36using ::android::hardware::hidl_vec;
37using ::android::hardware::Return;
38using ::android::hardware::Void;
39using ::android::sp;
40
41struct CryptoFactory : public ICryptoFactory {
42 CryptoFactory();
43 virtual ~CryptoFactory() {}
44
45 // Methods from ::android::hardware::drm::crypto::V1_0::ICryptoFactory follow.
46
47 Return<bool> isCryptoSchemeSupported(const hidl_array<uint8_t, 16>& uuid)
48 override;
49
50 Return<void> createPlugin(const hidl_array<uint8_t, 16>& uuid,
51 const hidl_vec<uint8_t>& initData, createPlugin_cb _hidl_cb)
52 override;
53
54private:
55 android::PluginLoader<android::CryptoFactory> loader;
56
57 CryptoFactory(const CryptoFactory &) = delete;
58 void operator=(const CryptoFactory &) = delete;
59};
60
61extern "C" ICryptoFactory* HIDL_FETCH_ICryptoFactory(const char* name);
62
63} // namespace implementation
64} // namespace V1_0
65} // namespace crypto
66} // namespace drm
67} // namespace hardware
68} // namespace android
69
70#endif // ANDROID_HARDWARE_DRM_CRYPTO_V1_0__CRYPTOFACTORY_H