Merge "Camera: fix various VTS issues" into oc-dr1-dev
This commit is contained in:
commit
5311547c05
3 changed files with 38 additions and 8 deletions
|
@ -923,6 +923,7 @@ Return<void> CameraDeviceSession::configureStreams(
|
||||||
status = Status::INTERNAL_ERROR;
|
status = Status::INTERNAL_ERROR;
|
||||||
} else {
|
} else {
|
||||||
convertToHidl(stream_list, &outStreams);
|
convertToHidl(stream_list, &outStreams);
|
||||||
|
mFirstRequest = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
_hidl_cb(status, outStreams);
|
_hidl_cb(status, outStreams);
|
||||||
|
@ -1022,7 +1023,13 @@ Status CameraDeviceSession::processOneCaptureRequest(const CaptureRequest& reque
|
||||||
|
|
||||||
if (!converted) {
|
if (!converted) {
|
||||||
ALOGE("%s: capture request settings metadata is corrupt!", __FUNCTION__);
|
ALOGE("%s: capture request settings metadata is corrupt!", __FUNCTION__);
|
||||||
return Status::INTERNAL_ERROR;
|
return Status::ILLEGAL_ARGUMENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mFirstRequest && halRequest.settings == nullptr) {
|
||||||
|
ALOGE("%s: capture request settings must not be null for first request!",
|
||||||
|
__FUNCTION__);
|
||||||
|
return Status::ILLEGAL_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
hidl_vec<buffer_handle_t*> allBufPtrs;
|
hidl_vec<buffer_handle_t*> allBufPtrs;
|
||||||
|
@ -1031,6 +1038,12 @@ Status CameraDeviceSession::processOneCaptureRequest(const CaptureRequest& reque
|
||||||
request.inputBuffer.bufferId != 0);
|
request.inputBuffer.bufferId != 0);
|
||||||
size_t numOutputBufs = request.outputBuffers.size();
|
size_t numOutputBufs = request.outputBuffers.size();
|
||||||
size_t numBufs = numOutputBufs + (hasInputBuf ? 1 : 0);
|
size_t numBufs = numOutputBufs + (hasInputBuf ? 1 : 0);
|
||||||
|
|
||||||
|
if (numOutputBufs == 0) {
|
||||||
|
ALOGE("%s: capture request must have at least one output buffer!", __FUNCTION__);
|
||||||
|
return Status::ILLEGAL_ARGUMENT;
|
||||||
|
}
|
||||||
|
|
||||||
status = importRequest(request, allBufPtrs, allFences);
|
status = importRequest(request, allBufPtrs, allFences);
|
||||||
if (status != Status::OK) {
|
if (status != Status::OK) {
|
||||||
return status;
|
return status;
|
||||||
|
@ -1102,6 +1115,7 @@ Status CameraDeviceSession::processOneCaptureRequest(const CaptureRequest& reque
|
||||||
return Status::INTERNAL_ERROR;
|
return Status::INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mFirstRequest = false;
|
||||||
return Status::OK;
|
return Status::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,6 +148,7 @@ private:
|
||||||
static HandleImporter sHandleImporter;
|
static HandleImporter sHandleImporter;
|
||||||
|
|
||||||
bool mInitFail;
|
bool mInitFail;
|
||||||
|
bool mFirstRequest = false;
|
||||||
|
|
||||||
common::V1_0::helper::CameraMetadata mDeviceInfo;
|
common::V1_0::helper::CameraMetadata mDeviceInfo;
|
||||||
|
|
||||||
|
|
|
@ -132,22 +132,34 @@ namespace {
|
||||||
const char *kHAL1_0 = "1.0";
|
const char *kHAL1_0 = "1.0";
|
||||||
|
|
||||||
bool matchDeviceName(const hidl_string& deviceName,
|
bool matchDeviceName(const hidl_string& deviceName,
|
||||||
const hidl_string &providerType, std::smatch& sm) {
|
const hidl_string &providerType,
|
||||||
|
std::string* deviceVersion,
|
||||||
|
std::string* cameraId) {
|
||||||
::android::String8 pattern;
|
::android::String8 pattern;
|
||||||
pattern.appendFormat(kDeviceNameRE, providerType.c_str());
|
pattern.appendFormat(kDeviceNameRE, providerType.c_str());
|
||||||
std::regex e(pattern.string());
|
std::regex e(pattern.string());
|
||||||
std::string deviceNameStd(deviceName.c_str());
|
std::string deviceNameStd(deviceName.c_str());
|
||||||
return std::regex_match(deviceNameStd, sm, e);
|
std::smatch sm;
|
||||||
|
if (std::regex_match(deviceNameStd, sm, e)) {
|
||||||
|
if (deviceVersion != nullptr) {
|
||||||
|
*deviceVersion = sm[1];
|
||||||
|
}
|
||||||
|
if (cameraId != nullptr) {
|
||||||
|
*cameraId = sm[2];
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getCameraDeviceVersion(const hidl_string& deviceName,
|
int getCameraDeviceVersion(const hidl_string& deviceName,
|
||||||
const hidl_string &providerType) {
|
const hidl_string &providerType) {
|
||||||
std::smatch sm;
|
std::string version;
|
||||||
bool match = matchDeviceName(deviceName, providerType, sm);
|
bool match = matchDeviceName(deviceName, providerType, &version, nullptr);
|
||||||
if (!match) {
|
if (!match) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
std::string version = sm[1].str();
|
|
||||||
if (version.compare(kHAL3_2) == 0) {
|
if (version.compare(kHAL3_2) == 0) {
|
||||||
// maybe switched to 3.4 or define the hidl version enumlater
|
// maybe switched to 3.4 or define the hidl version enumlater
|
||||||
return CAMERA_DEVICE_API_VERSION_3_2;
|
return CAMERA_DEVICE_API_VERSION_3_2;
|
||||||
|
@ -2982,6 +2994,9 @@ TEST_F(CameraHidlTest, processCaptureRequestPreview) {
|
||||||
//Empty settings should be supported after the first call
|
//Empty settings should be supported after the first call
|
||||||
//for repeating requests.
|
//for repeating requests.
|
||||||
request.settings.setToExternal(nullptr, 0, true);
|
request.settings.setToExternal(nullptr, 0, true);
|
||||||
|
// The buffer has been registered to HAL by bufferId, so per
|
||||||
|
// API contract we should send a null handle for this buffer
|
||||||
|
request.outputBuffers[0].buffer = nullptr;
|
||||||
mInflightMap.clear();
|
mInflightMap.clear();
|
||||||
inflightReq = {1, false, supportsPartialResults,
|
inflightReq = {1, false, supportsPartialResults,
|
||||||
partialResultCount, resultQueue};
|
partialResultCount, resultQueue};
|
||||||
|
@ -3078,7 +3093,7 @@ TEST_F(CameraHidlTest, processCaptureRequestInvalidSinglePreview) {
|
||||||
numRequestProcessed = n;
|
numRequestProcessed = n;
|
||||||
});
|
});
|
||||||
ASSERT_TRUE(ret.isOk());
|
ASSERT_TRUE(ret.isOk());
|
||||||
ASSERT_EQ(Status::INTERNAL_ERROR, status);
|
ASSERT_EQ(Status::ILLEGAL_ARGUMENT, status);
|
||||||
ASSERT_EQ(numRequestProcessed, 0u);
|
ASSERT_EQ(numRequestProcessed, 0u);
|
||||||
|
|
||||||
ret = session->close();
|
ret = session->close();
|
||||||
|
@ -3139,7 +3154,7 @@ TEST_F(CameraHidlTest, processCaptureRequestInvalidBuffer) {
|
||||||
numRequestProcessed = n;
|
numRequestProcessed = n;
|
||||||
});
|
});
|
||||||
ASSERT_TRUE(ret.isOk());
|
ASSERT_TRUE(ret.isOk());
|
||||||
ASSERT_EQ(Status::INTERNAL_ERROR, status);
|
ASSERT_EQ(Status::ILLEGAL_ARGUMENT, status);
|
||||||
ASSERT_EQ(numRequestProcessed, 0u);
|
ASSERT_EQ(numRequestProcessed, 0u);
|
||||||
|
|
||||||
ret = session->close();
|
ret = session->close();
|
||||||
|
|
Loading…
Reference in a new issue