camera API2的ICameraDeviceUser.aidl接口
ICameraService.aidl定义了ICameraService 接口,实现主要通过CameraService类来实现,主要接口如下:
• getNumberOfCameras: 获取系统中支持的Camera 个数
• connectDevice():打开一个Camera 设备
• addListener(): 添加针对Camera 设备以及闪光灯的监听对象
ICameraDeviceCallbacks.aidl文件中定义了ICameraDeviceCallbacks接口,其实现主要由Framework中的CameraDeviceCallbacks类进行实现,主要接口如下:
• onResultReceived: 一旦Service收到结果数据,便会调用该接口发送至Framework
• onCaptureStarted(): 一旦开始进行图像的采集,便调用该接口将部分信息以及时间戳上传至Framework
• onDeviceError(): 一旦发生了错误,通过调用该接口通知Framework
ICameraDeviceCallbacks.aidl--->./out/soong/.intermediates/frameworks/av/camera/libcamera_client/android_arm_armv7-a-neon_core_shared_platform/gen/aidl/android/hardware/camera2/ICameraDeviceCallbacks.h
./out/soong/.intermediates/frameworks/av/camera/libcamera_client/android_arm_armv7-a-neon_core_shared_platform/gen/aidl/android/hardware/camera2/BnCameraDeviceCallbacks.h
frameworks/av/camera/ndk/impl/ACameraDevice.h
这是获取当前Camera Device状态的回调,在操作camera device之前需要判断当前的camera是否可用。CameraDevice是连接在安卓设备上的单个相机的抽象表示,CameraDevice支持在高帧率下对捕获的图像进行细粒度控制和后期处理。
ICameraDeviceUser.aidl定义了ICameraDeviceUser接口,由CameraDeviceClient最终实现,主要接口如下:
• disconnect: 关闭Camera 设备
• submitRequestList:发送request
• beginConfigure: 开始配置Camera 设备,需要在所有关于数据流的操作之前
• endConfigure: 结束关于Camera 设备的配置,该接口需要在所有Request下发之前被调用
• createDefaultRequest: 创建一个具有默认配置的Request
ICameraDeviceUser.aidl--->./out/soong/.intermediates/frameworks/av/camera/libcamera_client/android_arm_armv7-a-neon_core_shared_platform/gen/aidl/android/hardware/camera2/ICameraDeviceUser.h
./out/soong/.intermediates/frameworks/av/camera/libcamera_client/android_arm_armv7-a-neon_core_shared_platform/gen/aidl/android/hardware/camera2/BnCameraDeviceUser.h继承了ICameraDeviceUser.h
./frameworks/av/services/camera/libcameraservice/api2/CameraDeviceClient.h中又发现了继承BnCameraDeviceUser.h的代码
这个IPC调用时为了操作底层的Camera Device,获取camera device重要信息,并操作Camera Device,提供了int createStream(in OutputConfiguration outputConfiguration);来创建captute session机制,Surface getInputSurface();来返回相应的输入流。
ICameraService.aidl
./out/soong/.intermediates/frameworks/av/camera/libcamera_client/android_arm_armv7-a-neon_core_shared_platform/gen/aidl/android/hardware/ICameraService.h
./out/soong/.intermediates/frameworks/av/camera/libcamera_client/android_arm_armv7-a-neon_core_shared_platform/gen/aidl/android/hardware/BnCameraService.h
frameworks/av/services/camera/libcameraservice/CameraService.h
ICameraServiceProxy.aidl
./out/soong/.intermediates/frameworks/av/camera/libcamera_client/android_arm_armv7-a-neon_core_shared_platform/gen/aidl/android/hardware/ICameraServiceProxy.h
./out/soong/.intermediates/frameworks/av/camera/libcamera_client/android_arm_armv7-a-neon_core_shared_platform/gen/aidl/android/hardware/BnCameraServiceProxy.h
frameworks/base/services/core/java/com/android/server/camera/CameraServiceProxy.java
ICameraServiceListener.aidl
./out/soong/.intermediates/frameworks/av/camera/libcamera_client/android_arm_armv7-a-neon_core_shared_platform/gen/aidl/android/hardware/ICameraServiceListener.h
./out/soong/.intermediates/frameworks/av/camera/libcamera_client/android_arm_armv7-a-neon_core_shared_platform/gen/aidl/android/hardware/BnCameraServiceListener.h
frameworks/base/core/java/android/hardware/camera2/CameraManager.java
onStatusChanged: 用于告知当前Camera 设备的状态的变更
原文链接:https://blog.csdn.net/u011279649/article/details/80776797
https://blog.csdn.net/cpongo1/article/details/102473130
https://www.jianshu.com/p/2eb683037379