Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dd0c0f71 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add the camera extended info getter/setter methods"

parents 88468c17 93594abe
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
@@ -178,4 +178,41 @@ interface IEvsCamera extends @1.0::IEvsCamera {
     *                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);
};
+21 −0
Original line number Diff line number Diff line
@@ -334,6 +334,27 @@ Return<void> EvsCamera::getIntParameter(CameraParam id,
}


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");
+4 −0
Original line number Diff line number Diff line
@@ -78,6 +78,10 @@ public:
                                      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,
+11 −0
Original line number Diff line number Diff line
@@ -296,6 +296,17 @@ TEST_F(EvsHidlTest, CameraOpenClean) {
                                    }
            );

            // 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);
        }