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

Commit 017cb98e authored by Changyeon Jo's avatar Changyeon Jo
Browse files

Fix how displays are used in test cases

Open and close the display for each camera instance.

Bug: 259449376
Test: atest VtsHalEvsTargetTest VtsHalEvsV1_1TargetTest
Change-Id: I0f3d2c0b2c9f8a5e527d0abd5c9b248c84dddfbb
parent 715b8ec2
Loading
Loading
Loading
Loading
+37 −38
Original line number Diff line number Diff line
@@ -630,10 +630,12 @@ TEST_P(EvsHidlTest, CameraToDisplayRoundTrip) {
        targetDisplayId = ids[0];
    });

    // Test each reported camera
    for (auto&& cam: cameraInfo) {
        // Request exclusive access to the first EVS display
        sp<IEvsDisplay_1_1> pDisplay = pEnumerator->openDisplay_1_1(targetDisplayId);
        ASSERT_NE(pDisplay, nullptr);
    LOG(INFO) << "Display " << targetDisplayId << " is alreay in use.";
        LOG(INFO) << "Display " << targetDisplayId << " is already in use.";

        // Get the display descriptor
        pDisplay->getDisplayInfo_1_1([](const HwDisplayConfig& config, const HwDisplayState& state) {
@@ -651,8 +653,6 @@ TEST_P(EvsHidlTest, CameraToDisplayRoundTrip) {
            ASSERT_NE(pState->layerStack, android::ui::INVALID_LAYER_STACK);
        });

    // Test each reported camera
    for (auto&& cam: cameraInfo) {
        bool isLogicalCam = false;
        getPhysicalCameraIds(cam.v1.cameraId, isLogicalCam);
        if (mIsHwModule && isLogicalCam) {
@@ -707,11 +707,11 @@ TEST_P(EvsHidlTest, CameraToDisplayRoundTrip) {
        // Explicitly release the camera
        pEnumerator->closeCamera(pCam);
        activeCameras.clear();
    }

        // Explicitly release the display
        pEnumerator->closeDisplay(pDisplay);
    }
}


/*
@@ -1631,12 +1631,12 @@ TEST_P(EvsHidlTest, HighPriorityCameraClient) {
    // Get the camera list
    loadCameraList();

    // Test each reported camera
    for (auto&& cam: cameraInfo) {
        // Request exclusive access to the EVS display
        sp<IEvsDisplay_1_0> pDisplay = pEnumerator->openDisplay();
        ASSERT_NE(pDisplay, nullptr);

    // Test each reported camera
    for (auto&& cam: cameraInfo) {
        // Read a target resolution from the metadata
        Stream targetCfg =
            getFirstStreamConfiguration(reinterpret_cast<camera_metadata_t*>(cam.metadata.data()));
@@ -1978,11 +1978,10 @@ TEST_P(EvsHidlTest, HighPriorityCameraClient) {
        pEnumerator->closeCamera(pCam1);
        activeCameras.clear();

    }

        // Explicitly release the display
        pEnumerator->closeDisplay(pDisplay);
    }
}


/*
@@ -1997,12 +1996,12 @@ TEST_P(EvsHidlTest, CameraUseStreamConfigToDisplay) {
    // Get the camera list
    loadCameraList();

    // Test each reported camera
    for (auto&& cam: cameraInfo) {
        // Request exclusive access to the EVS display
        sp<IEvsDisplay_1_0> pDisplay = pEnumerator->openDisplay();
        ASSERT_NE(pDisplay, nullptr);

    // Test each reported camera
    for (auto&& cam: cameraInfo) {
        // choose a configuration that has a frame rate faster than minReqFps.
        Stream targetCfg = {};
        const int32_t minReqFps = 15;
@@ -2078,11 +2077,11 @@ TEST_P(EvsHidlTest, CameraUseStreamConfigToDisplay) {
        // Explicitly release the camera
        pEnumerator->closeCamera(pCam);
        activeCameras.clear();
    }

        // Explicitly release the display
        pEnumerator->closeDisplay(pDisplay);
    }
}


/*
+39 −39
Original line number Diff line number Diff line
@@ -600,6 +600,8 @@ TEST_P(EvsAidlTest, CameraToDisplayRoundTrip) {
    EXPECT_GT(displayIds.size(), 0);
    targetDisplayId = displayIds[0];

    // Test each reported camera
    for (auto&& cam : mCameraInfo) {
        // Request exclusive access to the first EVS display
        std::shared_ptr<IEvsDisplay> pDisplay;
        ASSERT_TRUE(mEnumerator->openDisplay(targetDisplayId, &pDisplay).isOk());
@@ -613,8 +615,6 @@ TEST_P(EvsAidlTest, CameraToDisplayRoundTrip) {
        ASSERT_GT(displayDesc.width, 0);
        ASSERT_GT(displayDesc.height, 0);

    // Test each reported camera
    for (auto&& cam : mCameraInfo) {
        bool isLogicalCam = false;
        getPhysicalCameraIds(cam.id, isLogicalCam);
        if (mIsHwModule && isLogicalCam) {
@@ -668,11 +668,11 @@ TEST_P(EvsAidlTest, CameraToDisplayRoundTrip) {
        // Explicitly release the camera
        ASSERT_TRUE(mEnumerator->closeCamera(pCam).isOk());
        mActiveCameras.clear();
    }

        // Explicitly release the display
        ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay).isOk());
    }
}

/*
 * MultiCameraStream:
@@ -1395,6 +1395,8 @@ TEST_P(EvsAidlTest, HighPriorityCameraClient) {
    // Get the camera list
    loadCameraList();

    // Test each reported camera
    for (auto&& cam : mCameraInfo) {
        // Request available display IDs
        uint8_t targetDisplayId = 0;
        std::vector<uint8_t> displayIds;
@@ -1407,8 +1409,6 @@ TEST_P(EvsAidlTest, HighPriorityCameraClient) {
        ASSERT_TRUE(mEnumerator->openDisplay(targetDisplayId, &pDisplay).isOk());
        EXPECT_NE(pDisplay, nullptr);

    // Test each reported camera
    for (auto&& cam : mCameraInfo) {
        // Read a target resolution from the metadata
        Stream targetCfg = getFirstStreamConfiguration(
                reinterpret_cast<camera_metadata_t*>(cam.metadata.data()));
@@ -1687,11 +1687,11 @@ TEST_P(EvsAidlTest, HighPriorityCameraClient) {
        ASSERT_TRUE(mEnumerator->closeCamera(pCam0).isOk());
        ASSERT_TRUE(mEnumerator->closeCamera(pCam1).isOk());
        mActiveCameras.clear();
    }

        // Explicitly release the display
        ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay).isOk());
    }
}

/*
 * CameraUseStreamConfigToDisplay:
@@ -1712,13 +1712,13 @@ TEST_P(EvsAidlTest, CameraUseStreamConfigToDisplay) {
    EXPECT_GT(displayIds.size(), 0);
    targetDisplayId = displayIds[0];

    // Test each reported camera
    for (auto&& cam : mCameraInfo) {
        // Request exclusive access to the EVS display
        std::shared_ptr<IEvsDisplay> pDisplay;
        ASSERT_TRUE(mEnumerator->openDisplay(targetDisplayId, &pDisplay).isOk());
        EXPECT_NE(pDisplay, nullptr);

    // Test each reported camera
    for (auto&& cam : mCameraInfo) {
        // choose a configuration that has a frame rate faster than minReqFps.
        Stream targetCfg = {};
        const int32_t minReqFps = 15;
@@ -1791,11 +1791,11 @@ TEST_P(EvsAidlTest, CameraUseStreamConfigToDisplay) {
        // Explicitly release the camera
        ASSERT_TRUE(mEnumerator->closeCamera(pCam).isOk());
        mActiveCameras.clear();
    }

        // Explicitly release the display
        ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay).isOk());
    }
}

/*
 * MultiCameraStreamUseConfig: