Files
android/libwvdrmengine/aidl_include/WVDrmFactory.h
Edwin 96a8ccd4a1 Use aidl interface for Widevine service.
The interface is defined in
hardware/interfaces/drm/aidl(http://go/ag/15329852).

Test: build
  m android.hardware.drm-service.widevine -j128

Test: build_and_run_all_unit_tests.sh
  for hidl tests

Test: atest VtsAidlHalDrmTargetTest

Bug: 200055138
Bug: 170964303
Change-Id: If2f2a129914436ba5cef1c46f6cb9415e12c3d1c
2022-01-28 20:29:14 -08:00

72 lines
2.2 KiB
C++

//
// Copyright 2021 Google LLC. All Rights Reserved. This file and proprietary
// source code may only be used and distributed under the Widevine License
// Agreement.
//
#ifndef WV_DRM_FACTORY_H_
#define WV_DRM_FACTORY_H_
#include <aidl/android/hardware/drm/BnDrmFactory.h>
#include <aidl/android/hardware/drm/IDrmFactory.h>
#include <aidl/android/hardware/drm/IDrmPlugin.h>
#include "WVGenericCryptoInterface.h"
#include "WVTypes.h"
namespace wvdrm {
namespace hardware {
namespace drm {
namespace widevine {
struct WVDrmFactory : public ::aidl::android::hardware::drm::BnDrmFactory {
WVDrmFactory() {}
virtual ~WVDrmFactory() {}
::ndk::ScopedAStatus createPlugin(
const ::aidl::android::hardware::drm::Uuid& in_uuid,
const std::string& in_appPackageName,
std::shared_ptr<::aidl::android::hardware::drm::IDrmPlugin>* _aidl_return)
override;
::ndk::ScopedAStatus getSupportedCryptoSchemes(
std::vector<::aidl::android::hardware::drm::Uuid>* _aidl_return) override;
::ndk::ScopedAStatus isContentTypeSupported(const std::string& in_mimeType,
bool* _aidl_return) override;
// This overloaded method is not part of the AIDL interface, it is provided
// for Widevine CDM.
bool isCryptoSchemeSupported(
const ::aidl::android::hardware::drm::Uuid& in_uuid);
::ndk::ScopedAStatus isCryptoSchemeSupported(
const ::aidl::android::hardware::drm::Uuid& in_uuid,
const std::string& in_mimeType,
::aidl::android::hardware::drm::SecurityLevel in_securityLevel,
bool* _aidl_return) override;
binder_status_t dump(int fd, const char** args, uint32_t numArgs) override;
private:
WVDRM_DISALLOW_COPY_AND_ASSIGN(WVDrmFactory);
static WVGenericCryptoInterface sOemCryptoInterface;
static bool areSpoidsEnabled();
static bool isBlankAppPackageNameAllowed();
static int32_t firstApiLevel();
static std::string stringToHex(const std::string& input);
static void printCdmMetrics(int fd);
static void printCdmProperties(int fd);
friend class WVDrmFactoryTestPeer;
};
} // namespace widevine
} // namespace drm
} // namespace hardware
} // namespace wvdrm
#endif // WV_DRM_FACTORY_H_