Framework层提供给app层的类: CameraManager,CameraCharacteristics,CameraDevice,CameraCaptureSession,CameraRequest 常用api: CameraManager manager = (CameraManager)getSystemService(Context.CAMERA_SERVICE); manager.getCameraIdList() CameraCharacteristics cameraCharacteristics = manager.getCameraCharacteristics(cameraId) Integer facing = cameraCharacteristics.get(CameraCharacteristics.LENS_FACING); manager.openCamera(mCameraId, stateCallback, workThreadManager.getBackgroundHandler()); mPreviewRequestBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW); mCameraDevice.createCaptureSession(Arrays.asList(surface, imageReader.getSurface()), stateCallback, null); mCaptureSession.setRepeatingRequest(mPreviewRequestBuilder.build(), mCaptureCallback, workThreadManager.getBackgroundHandler()); captureBuilder.addTarget(imageReader.getSurface()) mCaptureSession.stopRepeating(); mCaptureSession.abortCaptures(); mCaptureSession.capture(captureBuilder.build(), captureCallback, null); frameworks\base\core\java\android\hardware\camera2\CameraManager.java openCamera(); out/soong/.intermediates/frameworks/base/framework/android_common/gen/aidl/frameworks/av/camera/aidl/android/hardware/ICameraService.java ICameraDeviceUser connectDevice(){mRemote.transact(Stub.TRANSACTION_connectDevice, _data, _reply, 0);} out\soong\.intermediates\frameworks\av\camera\libcamera_client\android_arm64_armv8-a_cortex-a53_core_shared\gen\aidl\frameworks\av\camera\aidl\android\hardware\ICameraService.cpp BnCameraService::onTransact() {connectDevice(in_callbacks, in_cameraId, in_opPackageName, in_clientUid, &_aidl_return); _aidl_reply->writeStrongBinder(::android::hardware::camera2::ICameraDeviceUser::asBinder(_aidl_return)); } \frameworks\av\services\camera\libcameraservice\CameraService.cpp CameraService::connectDevice() makeClient() *client = new CameraDeviceClient() //api2 + hal3 client->initialize() \frameworks\av\services\camera\libcameraservice\api2\CameraDeviceClient.cpp CameraDeviceClient() CameraDeviceClient::initialize() initializeImpl(manager, monitorTags); \frameworks\av\services\camera\libcameraservice\common\Camera2ClientBase.cpp Camera2ClientBase(); mDevice = new Camera3Device(cameraId); Camera2ClientBase::initialize() initializeImpl() mDevice->initialize() mDevice->setNotifyCallback \frameworks\av\services\camera\libcameraservice\device3\Camera3Device.cpp Camera3Device() manager->openSession() manager->getCameraCharacteristics() session->getCaptureRequestMetadataQueue() mInterface = new HalInterface(session, queue); manager->getProviderTagIdLocked() mTagMonitor.initialize(mVendorTagId); initializeCommonLocked() \frameworks\av\services\camera\libcameraservice\common\CameraProviderManager.cpp CameraProviderManager::openSession() findDeviceInfoLocked() deviceInfo3->mInterface->open() cameraproviderManager.cpp中providerInfo的mInterface:= mServiceProxy->getService(newProvider) CameraProviderManager::ProviderInfo::DeviceInfo3中的mInterface=getDeviceInterface<typename DeviceInfoT::InterfaceT>(name);调用的是provider service的getCameraDeviceInterface_V3_x();这边就会调用到main\hal\devicemgr\provider\2.4\CameraProviderImpl.cpp中的getCameraDeviceInterface()=》mManager->getDeviceInterface();=》main\hal\devicemgr\CameraDeviceManagerBase.cpp getDeviceInterface() => pDevice->getDeviceInterfaceBase(rpDevice); =>mtkcam3\main\hal\device\3.x\device\CameraDevice3Impl.cpp getDeviceInterfaceBase(rpDevice) {rpDevice = const_cast<IBase*>(static_cast<const IBase*>(this));} 所以,这个mInterface就是CameraDevice3Impl的实例。 |
|
来自: 新用户8389DdzY > 《mtk》