Widevine drm aidl: address API review

Interface update in change 16810770

Bug: 214410088
Test: atest VtsAidlHalDrmTargetTest
Change-Id: I19da51ef75952f5ff6c7c02e0393f574e69ee30b
This commit is contained in:
Edwin
2022-02-08 16:16:12 -08:00
parent 6112060529
commit 9654d29be6
15 changed files with 150 additions and 292 deletions

View File

@@ -36,12 +36,17 @@ inline ::aidl::android::hardware::drm::LogPriority toAidlLogPriority(
}
inline ::ndk::ScopedAStatus toNdkScopedAStatus(
::aidl::android::hardware::drm::Status status) {
::aidl::android::hardware::drm::Status status, const char* msg = nullptr) {
if (::aidl::android::hardware::drm::Status::OK == status)
return ::ndk::ScopedAStatus::ok();
else {
return ::ndk::ScopedAStatus::fromServiceSpecificError(
static_cast<int32_t>(status));
auto err = static_cast<int32_t>(status);
if (msg) {
return ::ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(err,
msg);
} else {
return ::ndk::ScopedAStatus::fromServiceSpecificError(err);
}
}
}

View File

@@ -7,7 +7,6 @@
#ifndef WV_CREATE_PLUGIN_FACTORIES_H_
#define WV_CREATE_PLUGIN_FACTORIES_H_
#include "WVCryptoFactory.h"
#include "WVDrmFactory.h"
namespace wvdrm {
@@ -16,7 +15,6 @@ namespace drm {
namespace widevine {
std::shared_ptr<WVDrmFactory> createDrmFactory();
std::shared_ptr<WVCryptoFactory> createCryptoFactory();
} // namespace widevine
} // namespace drm

View File

@@ -1,45 +0,0 @@
//
// 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_CRYPTO_FACTORY_H_
#define WV_CRYPTO_FACTORY_H_
#include <aidl/android/hardware/drm/BnCryptoFactory.h>
#include <aidl/android/hardware/drm/ICryptoFactory.h>
#include <aidl/android/hardware/drm/ICryptoPlugin.h>
#include "WVTypes.h"
namespace wvdrm {
namespace hardware {
namespace drm {
namespace widevine {
struct WVCryptoFactory : public ::aidl::android::hardware::drm::BnCryptoFactory {
public:
WVCryptoFactory() {}
virtual ~WVCryptoFactory() {}
::ndk::ScopedAStatus createPlugin(
const ::aidl::android::hardware::drm::Uuid& in_uuid,
const std::vector<uint8_t>& in_initData,
std::shared_ptr<::aidl::android::hardware::drm::ICryptoPlugin>*
_aidl_return) override;
::ndk::ScopedAStatus isCryptoSchemeSupported(
const ::aidl::android::hardware::drm::Uuid& in_uuid,
bool* _aidl_return) override;
private:
WVDRM_DISALLOW_COPY_AND_ASSIGN(WVCryptoFactory);
};
} // namespace widevine
} // namespace drm
} // namespace hardware
} // namespace wvdrm
#endif // WV_CRYPTO_FACTORY_H_

View File

@@ -23,29 +23,26 @@ struct WVDrmFactory : public ::aidl::android::hardware::drm::BnDrmFactory {
WVDrmFactory() {}
virtual ~WVDrmFactory() {}
::ndk::ScopedAStatus createPlugin(
::ndk::ScopedAStatus createDrmPlugin(
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 createCryptoPlugin(
const ::aidl::android::hardware::drm::Uuid& in_uuid,
const std::vector<uint8_t>& in_initData,
std::shared_ptr<::aidl::android::hardware::drm::ICryptoPlugin>*
_aidl_return) override;
::ndk::ScopedAStatus getSupportedCryptoSchemes(
std::vector<::aidl::android::hardware::drm::Uuid>* _aidl_return) override;
::aidl::android::hardware::drm::CryptoSchemes* _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
// This 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: