Add lazy service target to widevine

Test: Run widevine media GTS tests
Bug: 112386116
Change-Id: Id0a735def8d3bf4e71df1952c3d4d8034f3aabda
This commit is contained in:
Peter Kalauskas
2018-10-15 15:43:40 -07:00
parent 54104c7a22
commit 1afc15fba3
6 changed files with 123 additions and 33 deletions

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();
}