Add 1.3 widevine hidl target am: 20b7762982 am: 233c4bd3b2

Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/15191998

Change-Id: I1f885760089a9213f5c7e07ee5a2cb5d3d6ca0eb
This commit is contained in:
Robert Shih
2021-07-07 20:17:28 +00:00
committed by Automerger Merge Worker
6 changed files with 164 additions and 5 deletions

View File

@@ -90,7 +90,7 @@ common_widevine_service {
}
cc_defaults {
name: "common_widevine_service-multilib-defaults",
name: "common_widevine_service-multilib-defaults@1.3",
owner: "widevine",
proprietary: true,
relative_install_path: "hw",
@@ -106,12 +106,22 @@ cc_defaults {
"android.hardware.drm@1.1",
"android.hardware.drm@1.2",
"android.hardware.drm@1.3",
"android.hardware.drm@1.4",
"libbase",
"libhidlbase",
"liblog",
"libutils",
"libbinder",
],
}
cc_defaults {
name: "common_widevine_service-multilib-defaults",
defaults: [
"common_widevine_service-multilib-defaults@1.3",
],
shared_libs: [
"android.hardware.drm@1.4",
"libwvhidl",
],
}
@@ -156,12 +166,13 @@ cc_binary {
name: "android.hardware.drm@1.3-service.widevine",
defaults: [
"common_widevine_service-multilib-first",
"common_widevine_service-multilib-defaults",
"common_widevine_service-multilib-defaults@1.3",
],
srcs: ["src_hidl/service.cpp"],
srcs: ["src_hidl/service@1.3.cpp"],
shared_libs: ["libwvhidl@1.3"],
init_rc: ["src_hidl/android.hardware.drm@1.3-service.widevine.rc"],
vintf_fragments: ["manifest_android.hardware.drm@1.4-service.widevine.xml"],
vintf_fragments: ["manifest_android.hardware.drm@1.3-service.widevine.xml"],
}
@@ -392,3 +403,43 @@ cc_library_shared {
proprietary: true,
}
cc_prebuilt_library_shared {
name: "libwvhidl@1.3",
target: {
android_arm: {
srcs: ["prebuilts_hidl/arm/libwvhidl@1.3.so"],
},
android_arm64: {
srcs: ["prebuilts_hidl/arm64/libwvhidl@1.3.so"],
},
android_x86: {
srcs: ["prebuilts_hidl/x86/libwvhidl@1.3.so"],
},
android_x86_64: {
srcs: ["prebuilts_hidl/x86_64/libwvhidl@1.3.so"],
},
},
shared_libs: [
"android.hardware.drm@1.0",
"android.hardware.drm@1.1",
"android.hardware.drm@1.2",
"android.hardware.drm@1.3",
"android.hidl.memory@1.0",
"libbase",
"libcrypto",
"libcutils",
"libdl",
"libhidlbase",
"libhidlmemory",
"liblog",
"libprotobuf-cpp-lite",
"libutils",
],
owner: "widevine",
proprietary: true,
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,108 @@
/*
* Copyright 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "hidl/HidlSupport.h"
#define LOG_TAG "WidevineHidlService"
#include <android-base/logging.h>
#include <android/hardware/drm/1.3/ICryptoFactory.h>
#include <android/hardware/drm/1.3/IDrmFactory.h>
#include <binder/ProcessState.h>
#include <hidl/HidlTransportSupport.h>
#include "WVTypes.h"
namespace drm = ::android::hardware::drm;
namespace wvdrm {
namespace hardware {
namespace drm {
namespace V1_3 {
namespace widevine {
using ::android::hardware::Return;
using ::android::hardware::hidl_array;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::drm::V1_1::SecurityLevel;
struct WVCryptoFactory : public ::drm::V1_3::ICryptoFactory {
public:
WVCryptoFactory() {}
virtual ~WVCryptoFactory() {}
Return<bool> isCryptoSchemeSupported(const hidl_array<uint8_t, 16>& uuid)
override;
Return<void> createPlugin(
const hidl_array<uint8_t, 16>& uuid,
const hidl_vec<uint8_t>& initData,
createPlugin_cb _hidl_cb) override;
private:
WVDRM_DISALLOW_COPY_AND_ASSIGN(WVCryptoFactory);
};
struct WVDrmFactory : public ::drm::V1_3::IDrmFactory {
WVDrmFactory() {}
virtual ~WVDrmFactory() {}
Return<bool> isCryptoSchemeSupported(
const hidl_array<uint8_t, 16>& uuid) override;
Return<bool> isCryptoSchemeSupported_1_2(const hidl_array<uint8_t, 16>& uuid,
const hidl_string& mimeType,
SecurityLevel level) override;
Return<bool> isContentTypeSupported(const hidl_string& mimeType) override;
Return<void> createPlugin(const hidl_array<uint8_t, 16>& uuid,
const hidl_string& appPackageName,
createPlugin_cb _hidl_cb) override;
Return<void> getSupportedCryptoSchemes(
getSupportedCryptoSchemes_cb _hidl_cb) override;
private:
WVDRM_DISALLOW_COPY_AND_ASSIGN(WVDrmFactory);
};
} // namespace widevine
} // namespace V1_3
} // namespace drm
} // namespace hardware
} // namespace wvdrm
int main(int /* argc */, char** /* argv */) {
using ::android::sp;
using ::wvdrm::hardware::drm::V1_3::widevine::WVCryptoFactory;
using ::wvdrm::hardware::drm::V1_3::widevine::WVDrmFactory;
sp<::drm::V1_3::IDrmFactory> drmFactory = new WVDrmFactory;
sp<::drm::V1_3::ICryptoFactory> cryptoFactory = new WVCryptoFactory;
android::hardware::configureRpcThreadpool(8, true /* callerWillJoin */);
android::hardware::setRequestingSid(drmFactory, true);
android::hardware::setRequestingSid(cryptoFactory, true);
// Setup hwbinder service
CHECK_EQ(drmFactory->registerAsService("widevine"), android::NO_ERROR)
<< "Failed to register Widevine Factory HAL";
CHECK_EQ(cryptoFactory->registerAsService("widevine"), android::NO_ERROR)
<< "Failed to register Widevine Crypto HAL";
android::hardware::joinRpcThreadpool();
}