CameraService运行在MediaServer进程,在MediaServer进程的入口函数main()中调用CameraService::instantiate()进行实例化,
相关代码在main_mediaserver.cpp中.CameraService是BinderService的派生类,而instantiate()函数在BinderService中定义,如下:
template<typename SERVICE>
class BinderService
{
public:
static status_t publish(bool allowIsolated = false) {
sp<IServiceManager> sm(defaultServiceManager());
return sm->addService(
String16(SERVICE::getServiceName()),
new SERVICE(), allowIsolated);
}
static void publishAndJoinThreadPool(bool allowIsolated = false) {
&nbs
相关代码在main_mediaserver.cpp中.CameraService是BinderService的派生类,而instantiate()函数在BinderService中定义,如下:
template<typename SERVICE>
class BinderService
{
public:
static status_t publish(bool allowIsolated = false) {
sp<IServiceManager> sm(defaultServiceManager());
return sm->addService(
String16(SERVICE::getServiceName()),
new SERVICE(), allowIsolated);
}
static void publishAndJoinThreadPool(bool allowIsolated = false) {
&nbs

本文详细介绍了Android系统中CameraService的初始化过程,包括在MediaServer进程中的实例化、注册到ServiceManager,以及onFirstRef()函数的执行逻辑,涉及硬件模块加载、相机设备数量获取、回调接口设置和版本条件判断等关键步骤。
最低0.47元/天 解锁文章
2073

被折叠的 条评论
为什么被折叠?



