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
diff --git a/camera/device/3.5/ICameraDevice.hal b/camera/device/3.5/ICameraDevice.hal
index e7e8dd3..a77380f 100644
--- a/camera/device/3.5/ICameraDevice.hal
+++ b/camera/device/3.5/ICameraDevice.hal
@@ -36,11 +36,24 @@
* this logical camera device. This information may not change between consecutive calls.
*
* Note that HAL must support this function for physical camera IDs that are
- * not exposed via ICameraProvider::getCameraIdList().
+ * not exposed via ICameraProvider::getCameraIdList(). Calling
+ * getCameraDeviceInterface_V3_x() on these camera IDs must return ILLEGAL_ARGUMENT.
+ *
+ * The characteristics of all cameras returned by
+ * ICameraProvider::getCameraIdList() must be queried via
+ * getCameraCharacteristics(). Calling getPhysicalCameraCharacteristics() on
+ * those cameras must return ILLEGAL_ARGUMENT.
+ *
+ * @param physicalCameraId The physical camera id parsed from the logical
+ * camera's ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS static metadata
+ * key. The framework assumes that this ID is just the <id> part of fully
+ * qualified camera device name "device@<major>.<minor>/<type>/<id>". And
+ * the physical camera must be of the same version and type as the parent
+ * logical camera device.
*
* @return status Status code for the operation, one of:
* OK:
- * On a successful query of the camera device characteristics
+ * On a successful query of the physical camera device characteristics
* INTERNAL_ERROR:
* The camera device cannot be opened due to an internal
* error.
@@ -50,6 +63,9 @@
* instance must be acquired if the device is reconnected. All
* subsequent calls on this interface must return
* CAMERA_DISCONNECTED.
+ * ILLEGAL_ARGUMENT:
+ * If the physicalCameraId is not a valid physical camera Id outside
+ * of ICameraProvider::getCameraIdList().
*
* @return cameraCharacteristics
* The static metadata for this logical camera device's physical device, or an empty
diff --git a/camera/device/3.5/default/CameraDevice.cpp b/camera/device/3.5/default/CameraDevice.cpp
index c5d6c57..a6969af 100644
--- a/camera/device/3.5/default/CameraDevice.cpp
+++ b/camera/device/3.5/default/CameraDevice.cpp
@@ -79,6 +79,10 @@
int ret = mModule->getPhysicalCameraInfo((int)id, &physicalInfo);
if (ret == OK) {
V3_2::implementation::convertToHidl(physicalInfo, &cameraCharacteristics);
+ } else if (ret == -EINVAL) {
+ ALOGE("%s: %s is not a valid physical camera Id outside of getCameraIdList()",
+ __FUNCTION__, physicalCameraId.c_str());
+ status = Status::ILLEGAL_ARGUMENT;
} else {
ALOGE("%s: Failed to get physical camera %s info: %s (%d)!", __FUNCTION__,
physicalCameraId.c_str(), strerror(-ret), ret);