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

Commit 6caf74b0 authored by Changyeon Jo's avatar Changyeon Jo
Browse files

Implement getPhysicalCameraInfo() method



This change adds a new method, getPhysicalCameraInfo(), to IEvsCamera
interface, implements it in the default implementation, and update
corresponding VTS test cases.

Bug: 142275664
Test: VtsHalEvsV1_1TargetTest
Change-Id: Ic993d5670c34f05ef8d807708f27dec75008b04b
Signed-off-by: default avatarChangyeon Jo <changyeon@google.com>
parent a203a13b
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -33,6 +33,23 @@ interface IEvsCamera extends @1.0::IEvsCamera {
     */
    getCameraInfo_1_1() generates (CameraDesc info);

    /**
     * Returns the description of the physical camera device that backs this
     * logical camera.
     *
     * If a requested device does not either exist or back this logical device,
     * this method returns a null camera descriptor.  And, if this is called on
     * a physical camera device, this method is the same as getCameraInfo_1_1()
     * method if a given device ID is matched.  Otherwise, this will return a
     * null camera descriptor.
     *
     * @param  deviceId Physical camera device identifier string.
     * @return info     The description of a member physical camera device.
     *                  This must be the same value as reported by
     *                  EvsEnumerator::getCameraList_1_1().
     */
    getPhysicalCameraInfo(string deviceId) generates (CameraDesc info);

    /**
     * Requests to pause EVS camera stream events.
     *
+11 −0
Original line number Diff line number Diff line
@@ -240,6 +240,17 @@ Return<void> EvsCamera::getCameraInfo_1_1(getCameraInfo_1_1_cb _hidl_cb) {
}


Return<void> EvsCamera::getPhysicalCameraInfo(const hidl_string& id,
                                              getCameraInfo_1_1_cb _hidl_cb) {
    ALOGD("%s", __FUNCTION__);

    // This works exactly same as getCameraInfo_1_1() in default implementation.
    (void)id;
    _hidl_cb(mDescription);
    return Void();
}


Return<EvsResult> EvsCamera::doneWithFrame_1_1(const hidl_vec<BufferDesc_1_1>& buffers)  {
    std::lock_guard <std::mutex> lock(mAccessLock);

+2 −0
Original line number Diff line number Diff line
@@ -62,6 +62,8 @@ public:

    // Methods from ::android::hardware::automotive::evs::V1_1::IEvsCamera follow.
    Return<void>      getCameraInfo_1_1(getCameraInfo_1_1_cb _hidl_cb)  override;
    Return<void>      getPhysicalCameraInfo(const hidl_string& id,
                                            getPhysicalCameraInfo_cb _hidl_cb)  override;
    Return<EvsResult> pauseVideoStream() override;
    Return<EvsResult> resumeVideoStream() override;
    Return<EvsResult> doneWithFrame_1_1(const hidl_vec<BufferDesc_1_1>& buffer) override;
+9 −0
Original line number Diff line number Diff line
@@ -273,6 +273,15 @@ TEST_F(EvsHidlTest, CameraOpenClean) {
                .withDefault(nullptr);
            ASSERT_NE(pCam, nullptr);

            for (auto&& devName : devices) {
                bool matched = false;
                pCam->getPhysicalCameraInfo(devName,
                                            [&devName, &matched](const CameraDesc& info) {
                                                matched = devName == info.v1.cameraId;
                                            });
                ASSERT_TRUE(matched);
            }

            // Store a camera handle for a clean-up
            activeCameras.push_back(pCam);