Add the camera extended info getter/setter methods
This change declares and implement newer version of methods to
manage vendor-defined camera extended information.
Bug: 142888670
Test: m -j android.hardware.automotive.evs@1.1-service
Change-Id: If6baf9cea7eefd13fd269ca8bb5af715cc3a8bab
Signed-off-by: Changyeon Jo <changyeon@google.com>
diff --git a/automotive/evs/1.1/IEvsCamera.hal b/automotive/evs/1.1/IEvsCamera.hal
index fc68e60..38e6c42 100644
--- a/automotive/evs/1.1/IEvsCamera.hal
+++ b/automotive/evs/1.1/IEvsCamera.hal
@@ -178,4 +178,41 @@
* values as backing camera devices.
*/
getIntParameter(CameraParam id) generates(EvsResult result, vec<int32_t> value);
+
+ /**
+ * Request driver specific information from the HAL implementation.
+ *
+ * The values allowed for opaqueIdentifier are driver specific,
+ * but no value passed in may crash the driver. The driver should
+ * return EvsResult::INVALID_ARG for any unrecognized opaqueIdentifier.
+ *
+ * @param opaqueIdentifier An unique identifier of the information to
+ * request.
+ * @return result EvsResult::OK if the driver recognizes a given
+ * identifier.
+ * EvsResult::INVALID_ARG, otherwise.
+ * @return value Requested information. Zero-size vector is
+ * returned if the driver does not recognize a
+ * given identifier.
+ */
+ getExtendedInfo_1_1(uint32_t opaqueIdentifier)
+ generates (EvsResult result, vec<uint8_t> value);
+
+ /**
+ * Send a driver specific value to the HAL implementation.
+ *
+ * This extension is provided to facilitate car specific
+ * extensions, but no HAL implementation may require this call
+ * in order to function in a default state.
+ * INVALID_ARG is returned if the opaqueValue is not meaningful to
+ * the driver implementation.
+ *
+ * @param opaqueIdentifier An unique identifier of the information to
+ * program.
+ * opaqueValue A value to program.
+ * @return result EvsResult::OK is returned if this call is successful.
+ * EvsResult::INVALID_ARG, otherwise.
+ */
+ setExtendedInfo_1_1(uint32_t opaqueIdentifier, vec<uint8_t> opaqueValue)
+ generates (EvsResult result);
};
diff --git a/automotive/evs/1.1/default/EvsCamera.cpp b/automotive/evs/1.1/default/EvsCamera.cpp
index f9cdb88..5196c95 100644
--- a/automotive/evs/1.1/default/EvsCamera.cpp
+++ b/automotive/evs/1.1/default/EvsCamera.cpp
@@ -334,6 +334,27 @@
}
+Return<EvsResult> EvsCamera::setExtendedInfo_1_1(uint32_t opaqueIdentifier,
+ const hidl_vec<uint8_t>& opaqueValue) {
+ // Default implementation does not use an extended info.
+ (void)opaqueIdentifier;
+ (void)opaqueValue;
+ return EvsResult::INVALID_ARG;
+}
+
+
+Return<void> EvsCamera::getExtendedInfo_1_1(uint32_t opaqueIdentifier,
+ getExtendedInfo_1_1_cb _hidl_cb) {
+ // Default implementation does not use an extended info.
+ (void)opaqueIdentifier;
+
+ hidl_vec<uint8_t> value;
+ _hidl_cb(EvsResult::INVALID_ARG, value);
+ return Void();
+}
+
+
+
bool EvsCamera::setAvailableFrames_Locked(unsigned bufferCount) {
if (bufferCount < 1) {
ALOGE("Ignoring request to set buffer count to zero");
diff --git a/automotive/evs/1.1/default/EvsCamera.h b/automotive/evs/1.1/default/EvsCamera.h
index a49db46..0fa83b4 100644
--- a/automotive/evs/1.1/default/EvsCamera.h
+++ b/automotive/evs/1.1/default/EvsCamera.h
@@ -78,6 +78,10 @@
setIntParameter_cb _hidl_cb) override;
Return<void> getIntParameter(CameraParam id,
getIntParameter_cb _hidl_cb) override;
+ Return<EvsResult> setExtendedInfo_1_1(uint32_t opaqueIdentifier,
+ const hidl_vec<uint8_t>& opaqueValue) override;
+ Return<void> getExtendedInfo_1_1(uint32_t opaqueIdentifier,
+ getExtendedInfo_1_1_cb _hidl_cb) override;
static sp<EvsCamera> Create(const char *deviceName);
static sp<EvsCamera> Create(const char *deviceName,
diff --git a/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp b/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp
index ce02973..2c8c1e1 100644
--- a/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp
+++ b/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp
@@ -296,6 +296,17 @@
}
);
+ // Verify methods for extended info
+ const auto id = 0xFFFFFFFF; // meaningless id
+ hidl_vec<uint8_t> values;
+ auto err = pCam->setExtendedInfo_1_1(id, values);
+ ASSERT_EQ(EvsResult::INVALID_ARG, err);
+
+ pCam->getExtendedInfo_1_1(id, [](const auto& result, const auto& data) {
+ ASSERT_EQ(EvsResult::INVALID_ARG, result);
+ ASSERT_EQ(0, data.size());
+ });
+
// Explicitly close the camera so resources are released right away
pEnumerator->closeCamera(pCam);
}