分享

mtk framework hal学习--未完成

 新用户8389DdzY 2021-09-22

Framework层提供给app层的类:

CameraManagerCameraCharacteristics,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的实例。

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多