Check for stream use case capability before stream use case test

Bug: 299202800

Test: Vendor testing

Merged-In: If30ead47072dc1f950b8fb6384072cc38cd51c58
Change-Id: If30ead47072dc1f950b8fb6384072cc38cd51c58
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
(cherry picked from commit da59822642)
This commit is contained in:
Jayant Chowdhary 2024-01-11 20:41:44 +00:00
parent 990cb24694
commit 5554de2fa8
2 changed files with 22 additions and 13 deletions

View file

@ -313,14 +313,7 @@ void CameraAidlTest::verifyStreamUseCaseCharacteristics(const camera_metadata_t*
// Check capabilities
int retcode =
find_camera_metadata_ro_entry(metadata, ANDROID_REQUEST_AVAILABLE_CAPABILITIES, &entry);
bool hasStreamUseCaseCap = false;
if ((0 == retcode) && (entry.count > 0)) {
if (std::find(entry.data.u8, entry.data.u8 + entry.count,
ANDROID_REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE) !=
entry.data.u8 + entry.count) {
hasStreamUseCaseCap = true;
}
}
bool hasStreamUseCaseCap = supportsStreamUseCaseCap(metadata);
bool supportMandatoryUseCases = false;
retcode = find_camera_metadata_ro_entry(metadata, ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES,
@ -2195,10 +2188,10 @@ void CameraAidlTest::configureStreamUseCaseInternal(const AvailableStream &thres
&cameraDevice /*out*/);
camera_metadata_t* staticMeta = reinterpret_cast<camera_metadata_t*>(meta.metadata.data());
// Check if camera support depth only
if (isDepthOnly(staticMeta) ||
(threshold.format == static_cast<int32_t>(PixelFormat::RAW16) &&
!supportsCroppedRawUseCase(staticMeta))) {
// Check if camera support depth only or doesn't support stream use case capability
if (isDepthOnly(staticMeta) || !supportsStreamUseCaseCap(staticMeta) ||
(threshold.format == static_cast<int32_t>(PixelFormat::RAW16) &&
!supportsCroppedRawUseCase(staticMeta))) {
ndk::ScopedAStatus ret = mSession->close();
mSession = nullptr;
ASSERT_TRUE(ret.isOk());
@ -3212,6 +3205,21 @@ bool CameraAidlTest::supportsCroppedRawUseCase(const camera_metadata_t *staticMe
return false;
}
bool CameraAidlTest::supportsStreamUseCaseCap(const camera_metadata_t* staticMeta) {
camera_metadata_ro_entry entry;
int retcode = find_camera_metadata_ro_entry(staticMeta, ANDROID_REQUEST_AVAILABLE_CAPABILITIES,
&entry);
bool hasStreamUseCaseCap = false;
if ((0 == retcode) && (entry.count > 0)) {
if (std::find(entry.data.u8, entry.data.u8 + entry.count,
ANDROID_REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE) !=
entry.data.u8 + entry.count) {
hasStreamUseCaseCap = true;
}
}
return hasStreamUseCaseCap;
}
bool CameraAidlTest::isPerFrameControl(const camera_metadata_t* staticMeta) {
camera_metadata_ro_entry syncLatencyEntry;
int rc = find_camera_metadata_ro_entry(staticMeta, ANDROID_SYNC_MAX_LATENCY,

View file

@ -415,7 +415,8 @@ class CameraAidlTest : public ::testing::TestWithParam<std::string> {
int32_t frameCount, const bool *overrideSequence, const bool *expectedResults);
bool supportZoomSettingsOverride(const camera_metadata_t* staticMeta);
bool supportsCroppedRawUseCase(const camera_metadata_t *staticMeta);
static bool supportsStreamUseCaseCap(const camera_metadata_t* staticMeta);
static bool supportsCroppedRawUseCase(const camera_metadata_t* staticMeta);
bool isPerFrameControl(const camera_metadata_t* staticMeta);
void getSupportedSizes(const camera_metadata_t* ch, uint32_t tag, int32_t format,