Merge "Add lazy service target to widevine"

This commit is contained in:
Peter Kalauskas
2019-01-30 21:54:58 +00:00
committed by Android (Google) Code Review
6 changed files with 123 additions and 33 deletions

View File

@@ -44,37 +44,23 @@ include $(BUILD_PREBUILT)
#
include $(CLEAR_VARS)
include $(LOCAL_PATH)/common_widevine_service.mk
LOCAL_SRC_FILES := src_hidl/service.cpp
LOCAL_C_INCLUDES := \
vendor/widevine/libwvdrmengine/include_hidl \
vendor/widevine/libwvdrmengine/mediadrm/include \
vendor/widevine/libwvdrmengine/oemcrypto/include \
LOCAL_SHARED_LIBRARIES := \
android.hardware.drm@1.0 \
android.hardware.drm@1.1 \
android.hardware.drm@1.2 \
libbase \
libhidltransport \
libhwbinder \
liblog \
libutils \
libwvhidl \
libbinder \
LOCAL_HEADER_LIBRARIES := \
libstagefright_foundation_headers
LOCAL_MODULE := android.hardware.drm@1.2-service.widevine
LOCAL_INIT_RC := src_hidl/android.hardware.drm@1.2-service.widevine.rc
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/bin/hw
LOCAL_PROPRIETARY_MODULE := true
LOCAL_MODULE_OWNER := widevine
ifneq ($(TARGET_ENABLE_MEDIADRM_64), true)
LOCAL_MODULE_TARGET_ARCH := arm x86 mips
endif
include $(BUILD_EXECUTABLE)
# -----------------------------------------------------------------------------
# Builds android.hardware.drm@1.1-service-lazy.widevine
#
include $(CLEAR_VARS)
include $(LOCAL_PATH)/common_widevine_service.mk
LOCAL_SRC_FILES := src_hidl/serviceLazy.cpp
LOCAL_MODULE := android.hardware.drm@1.2-service-lazy.widevine
LOCAL_OVERRIDES_MODULES := android.hardware.drm@1.2-service.widevine
LOCAL_INIT_RC := src_hidl/android.hardware.drm@1.2-service-lazy.widevine.rc
include $(BUILD_EXECUTABLE)

View File

@@ -0,0 +1,33 @@
# -----------------------------------------------------------------------------
# Common rules for android.hardware.drm@1.2-service.widevine and
# android.hardware.drm@1.1-service-lazy.widevine
#
LOCAL_C_INCLUDES := \
vendor/widevine/libwvdrmengine/include_hidl \
vendor/widevine/libwvdrmengine/mediadrm/include \
vendor/widevine/libwvdrmengine/oemcrypto/include \
LOCAL_SHARED_LIBRARIES := \
android.hardware.drm@1.0 \
android.hardware.drm@1.1 \
android.hardware.drm@1.2 \
libbase \
libhidlbase \
libhidltransport \
libhwbinder \
liblog \
libutils \
libwvhidl \
libbinder \
LOCAL_HEADER_LIBRARIES := \
libstagefright_foundation_headers
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/bin/hw
LOCAL_PROPRIETARY_MODULE := true
LOCAL_MODULE_OWNER := widevine
ifneq ($(TARGET_ENABLE_MEDIADRM_64), true)
LOCAL_MODULE_TARGET_ARCH := arm x86 mips
endif

View File

@@ -0,0 +1,26 @@
on property:init.svc.mediadrm=running
mkdir /data/vendor/mediadrm 0770 media mediadrm
start vendor.move_data_sh
service vendor.move_data_sh /system/bin/move_widevine_data.sh
class late_start
user media
group media mediadrm system
disabled
oneshot
service vendor.drm-widevine-hal-1-2 /vendor/bin/hw/android.hardware.drm@1.2-service-lazy.widevine
interface android.hardware.drm@1.0::ICryptoFactory widevine
interface android.hardware.drm@1.0::IDrmFactory widevine
interface android.hardware.drm@1.1::ICryptoFactory widevine
interface android.hardware.drm@1.1::IDrmFactory widevine
interface android.hardware.drm@1.2::ICryptoFactory widevine
interface android.hardware.drm@1.2::IDrmFactory widevine
interface android.hidl.base@1.0::IBase widevine
oneshot
disabled
class hal
user media
group media mediadrm drmrpc
ioprio rt 4
writepid /dev/cpuset/foreground/tasks

View File

@@ -10,6 +10,13 @@ service vendor.move_data_sh /system/bin/move_widevine_data.sh
oneshot
service vendor.drm-widevine-hal-1-2 /vendor/bin/hw/android.hardware.drm@1.2-service.widevine
interface android.hardware.drm@1.0::ICryptoFactory widevine
interface android.hardware.drm@1.0::IDrmFactory widevine
interface android.hardware.drm@1.1::ICryptoFactory widevine
interface android.hardware.drm@1.1::IDrmFactory widevine
interface android.hardware.drm@1.2::ICryptoFactory widevine
interface android.hardware.drm@1.2::IDrmFactory widevine
interface android.hidl.base@1.0::IBase widevine
class hal
user media
group media mediadrm drmrpc

View File

@@ -26,12 +26,6 @@ using wvdrm::hardware::drm::V1_2::widevine::WVCryptoFactory;
using wvdrm::hardware::drm::V1_2::widevine::WVDrmFactory;
int main(int /* argc */, char** /* argv */) {
ALOGD("android.hardware.drm@1.2-service.widevine starting...");
// The DRM HAL may communicate to other vendor components via
// /dev/vndbinder
android::ProcessState::initWithDriver("/dev/vndbinder");
sp<IDrmFactory> drmFactory = new WVDrmFactory;
sp<ICryptoFactory> cryptoFactory = new WVCryptoFactory;

View File

@@ -0,0 +1,44 @@
/*
* Copyright 2019 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.
*/
#define LOG_TAG "WidevineHidlService"
#include <android-base/logging.h>
#include <binder/ProcessState.h>
#include <hidl/HidlLazyUtils.h>
#include <hidl/HidlTransportSupport.h>
#include "WVCryptoFactory.h"
#include "WVDrmFactory.h"
using wvdrm::hardware::drm::V1_2::widevine::WVCryptoFactory;
using wvdrm::hardware::drm::V1_2::widevine::WVDrmFactory;
using android::hardware::LazyServiceRegistrar;
int main(int /* argc */, char** /* argv */) {
sp<IDrmFactory> drmFactory = new WVDrmFactory;
sp<ICryptoFactory> cryptoFactory = new WVCryptoFactory;
configureRpcThreadpool(8, true /* callerWillJoin */);
// Setup hwbinder service
LazyServiceRegistrar serviceRegistrar;
CHECK_EQ(serviceRegistrar.registerService(drmFactory, "widevine"), android::NO_ERROR)
<< "Failed to register Widevine Factory HAL";
CHECK_EQ(serviceRegistrar.registerService(cryptoFactory, "widevine"), android::NO_ERROR)
<< "Failed to register Widevine Crypto HAL";
joinRpcThreadpool();
}