diff options
author | Shuzhen Wang <shuzhenwang@google.com> | 2018-09-05 09:40:00 -0700 |
---|---|---|
committer | Shuzhen Wang <shuzhenwang@google.com> | 2018-10-04 11:56:20 -0700 |
commit | 6bdeaf55bf5cb7d313628d0ff092413c42b5782c (patch) | |
tree | de9cc1958f6cbf6050dfd8af50bb9fbb51ea10ff /camera/common/1.0/default/CameraModule.cpp | |
parent | c9816c691fdee653c1773fec8a40cef1fcc1c8af (diff) |
VTS: Add test for device version 3.5
Also includes:
- Add test for getPhysicalCameraCharacteristics.
- Doc update for the new HIDL API.
- Tighten boundary check for camera ID in CameraModule.
Test: vts-tradefed run commandAndExit vts --skip-all-system-status-check
--skip-preconditions --module VtsHalCameraProviderV2_4Target -l INFO
Bug: 79523700
Bug: 115969176
Bug: 116512585
Change-Id: I051d1b0c91834781a1f8d893ed5ebfa579b03774
Diffstat (limited to 'camera/common/1.0/default/CameraModule.cpp')
-rw-r--r-- | camera/common/1.0/default/CameraModule.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/camera/common/1.0/default/CameraModule.cpp b/camera/common/1.0/default/CameraModule.cpp index eb840a74f4..392ebbc237 100644 --- a/camera/common/1.0/default/CameraModule.cpp +++ b/camera/common/1.0/default/CameraModule.cpp @@ -235,7 +235,7 @@ void CameraModule::appendAvailableKeys(CameraMetadata &chars, chars.update(keyTag, availableKeys); } -CameraModule::CameraModule(camera_module_t *module) { +CameraModule::CameraModule(camera_module_t *module) : mNumberOfCameras(0) { if (module == NULL) { ALOGE("%s: camera hardware module must not be null", __FUNCTION__); assert(0); @@ -264,7 +264,8 @@ int CameraModule::init() { res = mModule->init(); ATRACE_END(); } - mCameraInfoMap.setCapacity(getNumberOfCameras()); + mNumberOfCameras = getNumberOfCameras(); + mCameraInfoMap.setCapacity(mNumberOfCameras); return res; } @@ -322,7 +323,7 @@ int CameraModule::getCameraInfo(int cameraId, struct camera_info *info) { int CameraModule::getPhysicalCameraInfo(int physicalCameraId, camera_metadata_t **physicalInfo) { ATRACE_CALL(); Mutex::Autolock lock(mCameraInfoLock); - if (physicalCameraId < 0) { + if (physicalCameraId < mNumberOfCameras) { ALOGE("%s: Invalid physical camera ID %d", __FUNCTION__, physicalCameraId); return -EINVAL; } @@ -334,6 +335,10 @@ int CameraModule::getPhysicalCameraInfo(int physicalCameraId, camera_metadata_t __FUNCTION__); return -ENODEV; } + if (mModule->get_physical_camera_info == nullptr) { + ALOGE("%s: get_physical_camera is NULL for module version 2.5", __FUNCTION__); + return -EINVAL; + } ssize_t index = mPhysicalCameraInfoMap.indexOfKey(physicalCameraId); if (index == NAME_NOT_FOUND) { |