Add separate lazy service target to cas
Test: Run cts test android.media.cts.MediaCasTest Bug: 119050069 Change-Id: I5117e4d10931affe85f2a0bb437d2fefb291e18f
This commit is contained in:
parent
f919d0a0b8
commit
f646be06ed
4 changed files with 59 additions and 15 deletions
|
@ -1,6 +1,5 @@
|
|||
cc_binary {
|
||||
name: "android.hardware.cas@1.0-service",
|
||||
vintf_fragments: ["android.hardware.cas@1.0-service.xml"],
|
||||
cc_defaults {
|
||||
name: "cas_service_defaults",
|
||||
defaults: ["hidl_defaults"],
|
||||
vendor: true,
|
||||
relative_install_path: "hw",
|
||||
|
@ -14,7 +13,6 @@ cc_binary {
|
|||
],
|
||||
|
||||
compile_multilib: "32",
|
||||
init_rc: ["android.hardware.cas@1.0-service.rc"],
|
||||
|
||||
shared_libs: [
|
||||
"android.hardware.cas@1.0",
|
||||
|
@ -32,3 +30,19 @@ cc_binary {
|
|||
"media_plugin_headers",
|
||||
],
|
||||
}
|
||||
|
||||
cc_binary {
|
||||
name: "android.hardware.cas@1.0-service",
|
||||
vintf_fragments: ["android.hardware.cas@1.0-service.xml"],
|
||||
defaults: ["cas_service_defaults"],
|
||||
init_rc: ["android.hardware.cas@1.0-service.rc"],
|
||||
}
|
||||
|
||||
cc_binary {
|
||||
name: "android.hardware.cas@1.0-service-lazy",
|
||||
vintf_fragments: ["android.hardware.cas@1.0-service-lazy.xml"],
|
||||
overrides: ["android.hardware.cas@1.0-service"],
|
||||
defaults: ["cas_service_defaults"],
|
||||
init_rc: ["android.hardware.cas@1.0-service-lazy.rc"],
|
||||
cflags: ["-DLAZY_SERVICE"],
|
||||
}
|
||||
|
|
9
cas/1.0/default/android.hardware.cas@1.0-service-lazy.rc
Normal file
9
cas/1.0/default/android.hardware.cas@1.0-service-lazy.rc
Normal file
|
@ -0,0 +1,9 @@
|
|||
service vendor.cas-hal-1-0 /vendor/bin/hw/android.hardware.cas@1.0-service
|
||||
interface android.hardware.cas@1.0::IMediaCasService default
|
||||
oneshot
|
||||
disabled
|
||||
class hal
|
||||
user media
|
||||
group mediadrm drmrpc
|
||||
ioprio rt 4
|
||||
writepid /dev/cpuset/foreground/tasks
|
11
cas/1.0/default/android.hardware.cas@1.0-service-lazy.xml
Normal file
11
cas/1.0/default/android.hardware.cas@1.0-service-lazy.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<manifest version="1.0" type="device">
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.cas</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IMediaCasService</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</manifest>
|
|
@ -15,7 +15,11 @@
|
|||
*/
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#ifdef LAZY_SERVICE
|
||||
#define LOG_TAG "android.hardware.cas@1.0-service-lazy"
|
||||
#else
|
||||
#define LOG_TAG "android.hardware.cas@1.0-service"
|
||||
#endif
|
||||
|
||||
#include <binder/ProcessState.h>
|
||||
#include <hidl/HidlTransportSupport.h>
|
||||
|
@ -25,24 +29,30 @@
|
|||
|
||||
using android::hardware::configureRpcThreadpool;
|
||||
using android::hardware::joinRpcThreadpool;
|
||||
using android::hardware::cas::V1_0::implementation::MediaCasService;
|
||||
using android::hardware::LazyServiceRegistrar;
|
||||
using android::hardware::cas::V1_0::IMediaCasService;
|
||||
using android::hardware::cas::V1_0::implementation::MediaCasService;
|
||||
|
||||
#ifdef LAZY_SERVICE
|
||||
const bool kLazyService = true;
|
||||
#else
|
||||
const bool kLazyService = false;
|
||||
#endif
|
||||
|
||||
int main() {
|
||||
ALOGD("android.hardware.cas@1.0-service starting...");
|
||||
|
||||
// The CAS HAL may communicate to other vendor components via
|
||||
// /dev/vndbinder
|
||||
android::ProcessState::initWithDriver("/dev/vndbinder");
|
||||
|
||||
configureRpcThreadpool(8, true /* callerWillJoin */);
|
||||
|
||||
// Setup hwbinder service
|
||||
android::sp<IMediaCasService> service = new MediaCasService();
|
||||
android::status_t status = service->registerAsService();
|
||||
LOG_ALWAYS_FATAL_IF(
|
||||
status != android::OK,
|
||||
"Error while registering cas service: %d", status);
|
||||
android::status_t status;
|
||||
if (kLazyService) {
|
||||
auto serviceRegistrar = std::make_shared<LazyServiceRegistrar>();
|
||||
status = serviceRegistrar->registerServiceWithCallback(service);
|
||||
} else {
|
||||
status = service->registerAsService();
|
||||
}
|
||||
LOG_ALWAYS_FATAL_IF(status != android::OK, "Error while registering cas service: %d", status);
|
||||
|
||||
joinRpcThreadpool();
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue