Camera: Adjust VTS test to relax multi-camera requirement am: dc6da704ed am: 0e9dcbff44

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

Change-Id: I6a3768b5f7ddd5233aaba81bddb43a511ffb54cf
This commit is contained in:
Shuzhen Wang 2021-10-29 20:18:06 +00:00 committed by Automerger Merge Worker
commit 4aec71e7ff

View file

@ -6199,14 +6199,13 @@ TEST_P(CameraHidlTest, grfSMultiCameraTest) {
return; return;
} }
// Test that if more than one color cameras facing the same direction are // Test that if more than one rear-facing color camera is
// supported, there must be at least one logical camera facing that // supported, there must be at least one rear-facing logical camera.
// direction.
hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider); hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
// Front and back facing non-logical color cameras // Back facing non-logical color cameras
std::set<std::string> frontColorCameras, rearColorCameras; std::set<std::string> rearColorCameras;
// Front and back facing logical cameras' physical camera Id sets // Back facing logical cameras' physical camera Id sets
std::set<std::set<std::string>> frontPhysicalIds, rearPhysicalIds; std::set<std::set<std::string>> rearPhysicalIds;
for (const auto& name : cameraDeviceNames) { for (const auto& name : cameraDeviceNames) {
std::string cameraId; std::string cameraId;
int deviceVersion = getCameraDeviceVersionAndId(name, mProviderType, &cameraId); int deviceVersion = getCameraDeviceVersionAndId(name, mProviderType, &cameraId);
@ -6238,8 +6237,8 @@ TEST_P(CameraHidlTest, grfSMultiCameraTest) {
return; return;
} }
// Check camera facing. Skip if facing is neither FRONT // Check camera facing. Skip if facing is not BACK.
// nor BACK. If this is not a logical camera, only note down // If this is not a logical camera, only note down
// the camera ID, and skip. // the camera ID, and skip.
camera_metadata_ro_entry entry; camera_metadata_ro_entry entry;
int retcode = find_camera_metadata_ro_entry( int retcode = find_camera_metadata_ro_entry(
@ -6248,18 +6247,12 @@ TEST_P(CameraHidlTest, grfSMultiCameraTest) {
ASSERT_GT(entry.count, 0); ASSERT_GT(entry.count, 0);
uint8_t facing = entry.data.u8[0]; uint8_t facing = entry.data.u8[0];
bool isLogicalCamera = (isLogicalMultiCamera(metadata) == Status::OK); bool isLogicalCamera = (isLogicalMultiCamera(metadata) == Status::OK);
if (facing == ANDROID_LENS_FACING_FRONT) { if (facing != ANDROID_LENS_FACING_BACK) {
if (!isLogicalCamera) { // Not BACK facing. Skip.
frontColorCameras.insert(cameraId); return;
return; }
} if (!isLogicalCamera) {
} else if (facing == ANDROID_LENS_FACING_BACK) { rearColorCameras.insert(cameraId);
if (!isLogicalCamera) {
rearColorCameras.insert(cameraId);
return;
}
} else {
// Not FRONT or BACK facing. Skip.
return; return;
} }
@ -6268,11 +6261,7 @@ TEST_P(CameraHidlTest, grfSMultiCameraTest) {
std::unordered_set<std::string> physicalCameraIds; std::unordered_set<std::string> physicalCameraIds;
Status s = getPhysicalCameraIds(metadata, &physicalCameraIds); Status s = getPhysicalCameraIds(metadata, &physicalCameraIds);
ASSERT_EQ(Status::OK, s); ASSERT_EQ(Status::OK, s);
if (facing == ANDROID_LENS_FACING_FRONT) { rearPhysicalIds.emplace(physicalCameraIds.begin(), physicalCameraIds.end());
frontPhysicalIds.emplace(physicalCameraIds.begin(), physicalCameraIds.end());
} else {
rearPhysicalIds.emplace(physicalCameraIds.begin(), physicalCameraIds.end());
}
for (const auto& physicalId : physicalCameraIds) { for (const auto& physicalId : physicalCameraIds) {
// Skip if the physicalId is publicly available // Skip if the physicalId is publicly available
for (auto& deviceName : cameraDeviceNames) { for (auto& deviceName : cameraDeviceNames) {
@ -6299,11 +6288,7 @@ TEST_P(CameraHidlTest, grfSMultiCameraTest) {
(camera_metadata_t*)chars.data(); (camera_metadata_t*)chars.data();
if (CameraHidlTest::isColorCamera(physicalMetadata)) { if (CameraHidlTest::isColorCamera(physicalMetadata)) {
if (facing == ANDROID_LENS_FACING_FRONT) { rearColorCameras.insert(physicalId);
frontColorCameras.insert(physicalId);
} else if (facing == ANDROID_LENS_FACING_BACK) {
rearColorCameras.insert(physicalId);
}
} }
}); });
ASSERT_TRUE(ret.isOk()); ASSERT_TRUE(ret.isOk());
@ -6321,20 +6306,9 @@ TEST_P(CameraHidlTest, grfSMultiCameraTest) {
} }
} }
// If there are more than one color cameras facing one direction, a logical // If there are more than one rear-facing color camera, a logical
// multi-camera must be defined consisting of all color cameras facing that // multi-camera must be defined consisting of all rear-facing color
// direction. // cameras.
if (frontColorCameras.size() > 1) {
bool hasFrontLogical = false;
for (const auto& physicalIds : frontPhysicalIds) {
if (std::includes(physicalIds.begin(), physicalIds.end(),
frontColorCameras.begin(), frontColorCameras.end())) {
hasFrontLogical = true;
break;
}
}
ASSERT_TRUE(hasFrontLogical);
}
if (rearColorCameras.size() > 1) { if (rearColorCameras.size() > 1) {
bool hasRearLogical = false; bool hasRearLogical = false;
for (const auto& physicalIds : rearPhysicalIds) { for (const auto& physicalIds : rearPhysicalIds) {