Fix how displays are used in test cases am: 017cb98ee9 am: b536f21f4c

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2305821

Change-Id: Iaa46d152ba8feae7d63d1d8ebdd26427421ce1c3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Changyeon Jo 2023-01-25 19:33:40 +00:00 committed by Automerger Merge Worker
commit c5353bf7ce
2 changed files with 76 additions and 77 deletions

View file

@ -630,29 +630,29 @@ TEST_P(EvsHidlTest, CameraToDisplayRoundTrip) {
targetDisplayId = ids[0]; targetDisplayId = ids[0];
}); });
// 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.";
// Get the display descriptor
pDisplay->getDisplayInfo_1_1([](const HwDisplayConfig& config, const HwDisplayState& state) {
ASSERT_GT(config.size(), 0);
ASSERT_GT(state.size(), 0);
android::ui::DisplayMode* pConfig = (android::ui::DisplayMode*)config.data();
const auto width = pConfig->resolution.getWidth();
const auto height = pConfig->resolution.getHeight();
LOG(INFO) << " Resolution: " << width << "x" << height;
ASSERT_GT(width, 0);
ASSERT_GT(height, 0);
android::ui::DisplayState* pState = (android::ui::DisplayState*)state.data();
ASSERT_NE(pState->layerStack, android::ui::INVALID_LAYER_STACK);
});
// Test each reported camera // Test each reported camera
for (auto&& cam: cameraInfo) { 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 already in use.";
// Get the display descriptor
pDisplay->getDisplayInfo_1_1([](const HwDisplayConfig& config, const HwDisplayState& state) {
ASSERT_GT(config.size(), 0);
ASSERT_GT(state.size(), 0);
android::ui::DisplayMode* pConfig = (android::ui::DisplayMode*)config.data();
const auto width = pConfig->resolution.getWidth();
const auto height = pConfig->resolution.getHeight();
LOG(INFO) << " Resolution: " << width << "x" << height;
ASSERT_GT(width, 0);
ASSERT_GT(height, 0);
android::ui::DisplayState* pState = (android::ui::DisplayState*)state.data();
ASSERT_NE(pState->layerStack, android::ui::INVALID_LAYER_STACK);
});
bool isLogicalCam = false; bool isLogicalCam = false;
getPhysicalCameraIds(cam.v1.cameraId, isLogicalCam); getPhysicalCameraIds(cam.v1.cameraId, isLogicalCam);
if (mIsHwModule && isLogicalCam) { if (mIsHwModule && isLogicalCam) {
@ -707,10 +707,10 @@ TEST_P(EvsHidlTest, CameraToDisplayRoundTrip) {
// Explicitly release the camera // Explicitly release the camera
pEnumerator->closeCamera(pCam); pEnumerator->closeCamera(pCam);
activeCameras.clear(); activeCameras.clear();
}
// Explicitly release the display // Explicitly release the display
pEnumerator->closeDisplay(pDisplay); pEnumerator->closeDisplay(pDisplay);
}
} }
@ -1631,12 +1631,12 @@ TEST_P(EvsHidlTest, HighPriorityCameraClient) {
// Get the camera list // Get the camera list
loadCameraList(); loadCameraList();
// Request exclusive access to the EVS display
sp<IEvsDisplay_1_0> pDisplay = pEnumerator->openDisplay();
ASSERT_NE(pDisplay, nullptr);
// Test each reported camera // Test each reported camera
for (auto&& cam: cameraInfo) { for (auto&& cam: cameraInfo) {
// Request exclusive access to the EVS display
sp<IEvsDisplay_1_0> pDisplay = pEnumerator->openDisplay();
ASSERT_NE(pDisplay, nullptr);
// Read a target resolution from the metadata // Read a target resolution from the metadata
Stream targetCfg = Stream targetCfg =
getFirstStreamConfiguration(reinterpret_cast<camera_metadata_t*>(cam.metadata.data())); getFirstStreamConfiguration(reinterpret_cast<camera_metadata_t*>(cam.metadata.data()));
@ -1978,10 +1978,9 @@ TEST_P(EvsHidlTest, HighPriorityCameraClient) {
pEnumerator->closeCamera(pCam1); pEnumerator->closeCamera(pCam1);
activeCameras.clear(); activeCameras.clear();
// Explicitly release the display
pEnumerator->closeDisplay(pDisplay);
} }
// Explicitly release the display
pEnumerator->closeDisplay(pDisplay);
} }
@ -1997,12 +1996,12 @@ TEST_P(EvsHidlTest, CameraUseStreamConfigToDisplay) {
// Get the camera list // Get the camera list
loadCameraList(); loadCameraList();
// Request exclusive access to the EVS display
sp<IEvsDisplay_1_0> pDisplay = pEnumerator->openDisplay();
ASSERT_NE(pDisplay, nullptr);
// Test each reported camera // Test each reported camera
for (auto&& cam: cameraInfo) { for (auto&& cam: cameraInfo) {
// Request exclusive access to the EVS display
sp<IEvsDisplay_1_0> pDisplay = pEnumerator->openDisplay();
ASSERT_NE(pDisplay, nullptr);
// choose a configuration that has a frame rate faster than minReqFps. // choose a configuration that has a frame rate faster than minReqFps.
Stream targetCfg = {}; Stream targetCfg = {};
const int32_t minReqFps = 15; const int32_t minReqFps = 15;
@ -2078,10 +2077,10 @@ TEST_P(EvsHidlTest, CameraUseStreamConfigToDisplay) {
// Explicitly release the camera // Explicitly release the camera
pEnumerator->closeCamera(pCam); pEnumerator->closeCamera(pCam);
activeCameras.clear(); activeCameras.clear();
}
// Explicitly release the display // Explicitly release the display
pEnumerator->closeDisplay(pDisplay); pEnumerator->closeDisplay(pDisplay);
}
} }

View file

@ -600,21 +600,21 @@ TEST_P(EvsAidlTest, CameraToDisplayRoundTrip) {
EXPECT_GT(displayIds.size(), 0); EXPECT_GT(displayIds.size(), 0);
targetDisplayId = displayIds[0]; targetDisplayId = displayIds[0];
// Request exclusive access to the first EVS display
std::shared_ptr<IEvsDisplay> pDisplay;
ASSERT_TRUE(mEnumerator->openDisplay(targetDisplayId, &pDisplay).isOk());
EXPECT_NE(pDisplay, nullptr);
LOG(INFO) << "Display " << static_cast<int>(targetDisplayId) << " is in use.";
// Get the display descriptor
DisplayDesc displayDesc;
ASSERT_TRUE(pDisplay->getDisplayInfo(&displayDesc).isOk());
LOG(INFO) << " Resolution: " << displayDesc.width << "x" << displayDesc.height;
ASSERT_GT(displayDesc.width, 0);
ASSERT_GT(displayDesc.height, 0);
// Test each reported camera // Test each reported camera
for (auto&& cam : mCameraInfo) { for (auto&& cam : mCameraInfo) {
// Request exclusive access to the first EVS display
std::shared_ptr<IEvsDisplay> pDisplay;
ASSERT_TRUE(mEnumerator->openDisplay(targetDisplayId, &pDisplay).isOk());
EXPECT_NE(pDisplay, nullptr);
LOG(INFO) << "Display " << static_cast<int>(targetDisplayId) << " is in use.";
// Get the display descriptor
DisplayDesc displayDesc;
ASSERT_TRUE(pDisplay->getDisplayInfo(&displayDesc).isOk());
LOG(INFO) << " Resolution: " << displayDesc.width << "x" << displayDesc.height;
ASSERT_GT(displayDesc.width, 0);
ASSERT_GT(displayDesc.height, 0);
bool isLogicalCam = false; bool isLogicalCam = false;
getPhysicalCameraIds(cam.id, isLogicalCam); getPhysicalCameraIds(cam.id, isLogicalCam);
if (mIsHwModule && isLogicalCam) { if (mIsHwModule && isLogicalCam) {
@ -668,10 +668,10 @@ TEST_P(EvsAidlTest, CameraToDisplayRoundTrip) {
// Explicitly release the camera // Explicitly release the camera
ASSERT_TRUE(mEnumerator->closeCamera(pCam).isOk()); ASSERT_TRUE(mEnumerator->closeCamera(pCam).isOk());
mActiveCameras.clear(); mActiveCameras.clear();
}
// Explicitly release the display // Explicitly release the display
ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay).isOk()); ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay).isOk());
}
} }
/* /*
@ -1395,20 +1395,20 @@ TEST_P(EvsAidlTest, HighPriorityCameraClient) {
// Get the camera list // Get the camera list
loadCameraList(); loadCameraList();
// Request available display IDs
uint8_t targetDisplayId = 0;
std::vector<uint8_t> displayIds;
ASSERT_TRUE(mEnumerator->getDisplayIdList(&displayIds).isOk());
EXPECT_GT(displayIds.size(), 0);
targetDisplayId = displayIds[0];
// 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 // Test each reported camera
for (auto&& cam : mCameraInfo) { for (auto&& cam : mCameraInfo) {
// Request available display IDs
uint8_t targetDisplayId = 0;
std::vector<uint8_t> displayIds;
ASSERT_TRUE(mEnumerator->getDisplayIdList(&displayIds).isOk());
EXPECT_GT(displayIds.size(), 0);
targetDisplayId = displayIds[0];
// Request exclusive access to the EVS display
std::shared_ptr<IEvsDisplay> pDisplay;
ASSERT_TRUE(mEnumerator->openDisplay(targetDisplayId, &pDisplay).isOk());
EXPECT_NE(pDisplay, nullptr);
// Read a target resolution from the metadata // Read a target resolution from the metadata
Stream targetCfg = getFirstStreamConfiguration( Stream targetCfg = getFirstStreamConfiguration(
reinterpret_cast<camera_metadata_t*>(cam.metadata.data())); reinterpret_cast<camera_metadata_t*>(cam.metadata.data()));
@ -1687,10 +1687,10 @@ TEST_P(EvsAidlTest, HighPriorityCameraClient) {
ASSERT_TRUE(mEnumerator->closeCamera(pCam0).isOk()); ASSERT_TRUE(mEnumerator->closeCamera(pCam0).isOk());
ASSERT_TRUE(mEnumerator->closeCamera(pCam1).isOk()); ASSERT_TRUE(mEnumerator->closeCamera(pCam1).isOk());
mActiveCameras.clear(); mActiveCameras.clear();
}
// Explicitly release the display // Explicitly release the display
ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay).isOk()); ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay).isOk());
}
} }
/* /*
@ -1712,13 +1712,13 @@ TEST_P(EvsAidlTest, CameraUseStreamConfigToDisplay) {
EXPECT_GT(displayIds.size(), 0); EXPECT_GT(displayIds.size(), 0);
targetDisplayId = displayIds[0]; targetDisplayId = displayIds[0];
// 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 // Test each reported camera
for (auto&& cam : mCameraInfo) { 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);
// choose a configuration that has a frame rate faster than minReqFps. // choose a configuration that has a frame rate faster than minReqFps.
Stream targetCfg = {}; Stream targetCfg = {};
const int32_t minReqFps = 15; const int32_t minReqFps = 15;
@ -1791,10 +1791,10 @@ TEST_P(EvsAidlTest, CameraUseStreamConfigToDisplay) {
// Explicitly release the camera // Explicitly release the camera
ASSERT_TRUE(mEnumerator->closeCamera(pCam).isOk()); ASSERT_TRUE(mEnumerator->closeCamera(pCam).isOk());
mActiveCameras.clear(); mActiveCameras.clear();
}
// Explicitly release the display // Explicitly release the display
ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay).isOk()); ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay).isOk());
}
} }
/* /*