https://deepinout.com/android-camera-native-framework/cameraserver-process-overview.html
- Cameraserver 源码路径
- Cameraserver 跑的32位还是64位
- Cameraserver 对外开的服务
- Cameraserver rc文件
- Cameraserver Manifest文件
1 Cameraserver 源码路径
1.1 Cameraserver bin
/frameworks/av/camera/cameraserver/
Android.bp
// Copyright 2018 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.
package {
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "frameworks_av_camera_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["frameworks_av_camera_license"],
}
cc_binary {
name: "cameraserver",
srcs: ["main_cameraserver.cpp"],
header_libs: [
"libmedia_headers",
],
shared_libs: [
"libcameraservice",
"liblog",
"libutils",
"libui",
"libgui",
"libbinder",
"libhidlbase",
"android.hardware.camera.common@1.0",
"android.hardware.camera.provider@2.4",
"android.hardware.camera.provider@2.5",
"android.hardware.camera.provider@2.6",
"android.hardware.camera.provider@2.7",
"android.hardware.camera.device@1.0",
"android.hardware.camera.device@3.2",
"android.hardware.camera.device@3.4",
],
compile_multilib: "first", //决定是编译32位还是64位
cflags: [
"-Wall",
"-Wextra",
"-Werror",
"-Wno-unused-parameter",
],
init_rc: ["cameraserver.rc"],
vintf_fragments: [
"manifest_android.frameworks.cameraservice.service@2.2.xml",
],
}
cameraserver.rc
service cameraserver /system/bin/cameraserver
class main
user cameraserver
group audio camera input drmrpc
ioprio rt 4
task_profiles CameraServiceCapacity MaxPerformance
rlimit rtprio 10 10
main_cameraserver.cpp
/*
* Copyright (C) 2015 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 "cameraserver"
//#define LOG_NDEBUG 0
#include "CameraService.h"
#include <hidl/HidlTransportSupport.h>
using namespace android;
int main(int argc __unused, char** argv __unused)
{
signal(SIGPIPE, SIG_IGN);
// Set 5 threads for HIDL calls. Now cameraserver will serve HIDL calls in
// addition to consuming them from the Camera HAL as well.
hardware::configureRpcThreadpool(5, /*willjoin*/ false);
sp<ProcessState> proc(ProcessState::self());
sp<IServiceManager> sm = defaultServiceManager();
ALOGI("ServiceManager: %p", sm.get());
CameraService::instantiate();
ALOGI("ServiceManager: %p done instantiate", sm.get());
ProcessState::self()->startThreadPool();
IPCThreadState::self()->joinThreadPool();
}
manifest_android.frameworks.cameraservice.service@2.2.xml
<manifest version="1.0" type="framework">
<hal>
<name>android.frameworks.cameraservice.service</name>
<transport>hwbinder</transport>
<version>2.2</version>
<interface>
<name>ICameraService</name>
<instance>default</instance>
</interface>
</hal>
</manifest>
2 查看 Cameraserver 跑的32位还是64位
方法1 查看bin文件属性
file /system/bin/cameraserver
/system/bin/cameraserver: ELF shared object, 64-bit LSB x86-64, dynamic (/system/bin/linker64), for Android 33, BuildID=ef069dc22fc302b0e657c2eb124d45a9, stripped
方法2 通过查看smaps
3 Cameraserver 对外开的服务
4 Cameraserver rc文件
rc(run command/run configure) 是进程启动时的配置文件。
rc文件在设备(如Android手机)中的存放路径:
/system/etc/init/
用于核心系统项,例如 SurfaceFlinger, MediaService和Cameraserver
/vendor/etc/init/
针对SoC供应商的项目,如SoC核心功能所需的actions或守护进程
/odm/etc/init/
用于设备制造商的项目,如actions或运动传感器或其他外围功能所需的守护进程
5 Cameraserver Manifest文件
Manifest文件用于定义Vendor Interface接口,供ServiceManager使用。
Manifest文件在设备(如Android手机)中的存放路径:
/system/etc/vintf/manifest/
/vendor/etc/vintf/manifest/
/product/etc/vintf/manifest/
LSHAL 是一种设备端工具,可以列出向 hwservicemanager 注册的所有 HIDL HAL。
lshal --init-vintf|grep -i camera
AIDL HAL可以通过dumpsys -l 或service list查看。
dumpsys -l