Camera架构
Camera的架构与Android系统的整体架构保持一致,如下图所示:
分层
Framework:
frameworks/base/core/java/android/hardware/Camera.java
Android Runtime:
frameworks/base/core/jni/android_hardware_Camera.cpp
C/C++ Libraries:
- Client:
frameworks/av/camera/CameraBase.cpp frameworks/av/camera/Camera.cpp frameworks/av/camera/ICamera.cpp frameworks/av/camera/aidl/android/hardware/ICamera.aidl frameworks/av/camera/aidl/android/hardware/ICameraClient.aidl
- Server:
frameworks/av/camera/cameraserver/main_cameraserver.cpp frameworks/av/services/camera/libcameraservice/CameraService.cpp frameworks/av/services/camera/libcameraservice/api1/CameraClient.cpp frameworks/av/camera/aidl/android/hardware/ICameraService.aidl
- Client:
HAL:
- HAL 1:
frameworks/av/services/camera/libcameraservice/device1/CameraHardwareInterface.h
- HAL 3:(主要学习了 HAL 1 的机制,HAL 3 以后再补充)
frameworks/av/services/camera/libcameraservice/device3/***
- HAL 1:
C/S架构
Android Camera 框架是 一个 client/service 的架构。
- service进程
属于服务端,由native c/c++代码实现,主要负责 通过HAL层和linux kernel中的camera driver交互。搜集camera driver 传递过来的数据,响应client端的请求
- client进程
属于客户端,由java和native c/c++ 代码实现。可以看成应用程序。调用关系大致如下:
app –>camera2 api framework –> android_hardware_camera.cpp –>libcamera_client.so
目标
本系列的目标是从应用层 -> framework ->HAL –>driver 详细的分析学习Android Camera系统。