diff options
author | Shuzhen Wang <shuzhenwang@google.com> | 2018-08-17 13:52:40 -0700 |
---|---|---|
committer | Shuzhen Wang <shuzhenwang@google.com> | 2018-09-13 09:25:34 -0700 |
commit | d3feb3d62c139f08879bbb7f7a0513d593dafcc0 (patch) | |
tree | 1edbaace64624647eb5d76763ccb27caeed78745 /camera/common/1.0/default/CameraModule.cpp | |
parent | 51a04b2fe26a5b3941af56cf836def3c2f37477f (diff) |
Camera: Add support for physical camera characteristics query
- Add version 3.5 for ICameraDevice for physical camera characteristics
query.
- Add version 3.5 for ICameraDeviceSession to work around HIDL
versioning bug.
Test: Camera CTS
Bug: 79523700
Change-Id: I8df6cdd4ee6ac5755758510c0dc1ea1cec31aa73
Diffstat (limited to 'camera/common/1.0/default/CameraModule.cpp')
-rw-r--r-- | camera/common/1.0/default/CameraModule.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/camera/common/1.0/default/CameraModule.cpp b/camera/common/1.0/default/CameraModule.cpp index dc4e0f01ff..eb840a74f4 100644 --- a/camera/common/1.0/default/CameraModule.cpp +++ b/camera/common/1.0/default/CameraModule.cpp @@ -319,6 +319,41 @@ int CameraModule::getCameraInfo(int cameraId, struct camera_info *info) { return OK; } +int CameraModule::getPhysicalCameraInfo(int physicalCameraId, camera_metadata_t **physicalInfo) { + ATRACE_CALL(); + Mutex::Autolock lock(mCameraInfoLock); + if (physicalCameraId < 0) { + ALOGE("%s: Invalid physical camera ID %d", __FUNCTION__, physicalCameraId); + return -EINVAL; + } + + // Only query physical camera info for 2.5 version for newer + int apiVersion = mModule->common.module_api_version; + if (apiVersion < CAMERA_MODULE_API_VERSION_2_5) { + ALOGE("%s: Module version must be at least 2.5 to handle getPhysicalCameraInfo", + __FUNCTION__); + return -ENODEV; + } + + ssize_t index = mPhysicalCameraInfoMap.indexOfKey(physicalCameraId); + if (index == NAME_NOT_FOUND) { + // Get physical camera characteristics, and cache it + camera_metadata_t *info = nullptr; + ATRACE_BEGIN("camera_module->get_physical_camera_info"); + int ret = mModule->get_physical_camera_info(physicalCameraId, &info); + ATRACE_END(); + if (ret != 0) { + return ret; + } + + index = mPhysicalCameraInfoMap.add(physicalCameraId, info); + } + + assert(index != NAME_NOT_FOUND); + *physicalInfo = mPhysicalCameraInfoMap[index]; + return OK; +} + int CameraModule::getDeviceVersion(int cameraId) { ssize_t index = mDeviceVersionMap.indexOfKey(cameraId); if (index == NAME_NOT_FOUND) { |