Merge "Add hal_implementation_test on automotive cf to test_mapping"
diff --git a/bluetooth/aidl/TEST_MAPPING b/bluetooth/aidl/TEST_MAPPING
index f059c04..d1de251 100644
--- a/bluetooth/aidl/TEST_MAPPING
+++ b/bluetooth/aidl/TEST_MAPPING
@@ -9,5 +9,16 @@
}
]
}
+ ],
+ "hwasan-presubmit" : [
+ {
+ "name" : "VtsHalBluetoothTargetTest",
+ "options": [
+ {
+ // TODO(b/275847929)
+ "exclude-filter": "VtsHalBluetoothTargetTest.PerInstance/BluetoothAidlTest#Cdd_C_12_1_Bluetooth5Requirements/0_android_hardware_bluetooth_IBluetoothHci_default"
+ }
+ ]
+ }
]
}
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index 5ea6ae2..339a142 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -929,7 +929,7 @@
static Status getMandatoryConcurrentStreams(const camera_metadata_t* staticMeta,
std::vector<AvailableStream>* outputStreams);
- static bool supportsPreviewStabilization(const std::string& name, sp<ICameraProvider> provider);
+
static Status getJpegBufferSize(camera_metadata_t *staticMeta,
uint32_t* outBufSize);
static Status isConstrainedModeAvailable(camera_metadata_t *staticMeta);
@@ -976,9 +976,6 @@
void processCaptureRequestInternal(uint64_t bufferusage, RequestTemplate reqTemplate,
bool useSecureOnlyCameras);
- void processPreviewStabilizationCaptureRequestInternal(
- bool previewStabilizationOn,
- /*inout*/ std::unordered_map<std::string, nsecs_t>& cameraDeviceToTimeLag);
// Used by switchToOffline where a new result queue is created for offline reqs
void updateInflightResultQueue(std::shared_ptr<ResultMetadataQueue> resultQueue);
@@ -1032,11 +1029,7 @@
// Buffers are added by process_capture_result when output buffers
// return from HAL but framework.
- struct StreamBufferAndTimestamp {
- StreamBuffer buffer;
- nsecs_t timeStamp;
- };
- ::android::Vector<StreamBufferAndTimestamp> resultOutputBuffers;
+ ::android::Vector<StreamBuffer> resultOutputBuffers;
std::unordered_set<std::string> expectedPhysicalResults;
@@ -1453,25 +1446,8 @@
return notify;
}
- for (const auto& buffer : results.outputBuffers) {
- // wait for the fence timestamp and store it along with the buffer
- // TODO: Check if we really need the dup here
- sp<android::Fence> releaseFence = nullptr;
- if (buffer.releaseFence && (buffer.releaseFence->numFds == 1) &&
- buffer.releaseFence->data[0] >= 0) {
- releaseFence = new android::Fence(dup(buffer.releaseFence->data[0]));
- }
- InFlightRequest::StreamBufferAndTimestamp streamBufferAndTimestamp;
- streamBufferAndTimestamp.buffer = buffer;
- streamBufferAndTimestamp.timeStamp = systemTime();
- if (releaseFence && releaseFence->isValid()) {
- releaseFence->wait(/*ms*/ 300);
- nsecs_t releaseTime = releaseFence->getSignalTime();
- if (streamBufferAndTimestamp.timeStamp < releaseTime)
- streamBufferAndTimestamp.timeStamp = releaseTime;
- }
- request->resultOutputBuffers.push_back(streamBufferAndTimestamp);
- }
+ request->resultOutputBuffers.appendArray(results.outputBuffers.data(),
+ results.outputBuffers.size());
// If shutter event is received notify the pending threads.
if (request->shutterTimestamp != 0) {
notify = true;
@@ -4841,7 +4817,7 @@
ASSERT_FALSE(inflightReq.errorCodeValid);
ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u);
- ASSERT_EQ(testStream.id, inflightReq.resultOutputBuffers[0].buffer.streamId);
+ ASSERT_EQ(testStream.id, inflightReq.resultOutputBuffers[0].streamId);
request.frameNumber++;
// Empty settings should be supported after the first call
@@ -4879,7 +4855,7 @@
ASSERT_FALSE(inflightReq.errorCodeValid);
ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u);
- ASSERT_EQ(testStream.id, inflightReq.resultOutputBuffers[0].buffer.streamId);
+ ASSERT_EQ(testStream.id, inflightReq.resultOutputBuffers[0].streamId);
}
if (useHalBufManager) {
@@ -5460,7 +5436,7 @@
ASSERT_FALSE(inflightReqs[i].errorCodeValid);
ASSERT_NE(inflightReqs[i].resultOutputBuffers.size(), 0u);
- ASSERT_EQ(previewStream.id, inflightReqs[i].resultOutputBuffers[0].buffer.streamId);
+ ASSERT_EQ(previewStream.id, inflightReqs[i].resultOutputBuffers[0].streamId);
ASSERT_FALSE(inflightReqs[i].collectedResult.isEmpty());
ASSERT_TRUE(inflightReqs[i].collectedResult.exists(ANDROID_SENSOR_SENSITIVITY));
camera_metadata_entry_t isoResult = inflightReqs[i].collectedResult.find(
@@ -5744,7 +5720,7 @@
ASSERT_FALSE(inflightReqs[i].errorCodeValid);
ASSERT_NE(inflightReqs[i].resultOutputBuffers.size(), 0u);
- ASSERT_EQ(stream.id, inflightReqs[i].resultOutputBuffers[0].buffer.streamId);
+ ASSERT_EQ(stream.id, inflightReqs[i].resultOutputBuffers[0].streamId);
ASSERT_FALSE(inflightReqs[i].collectedResult.isEmpty());
}
@@ -5940,7 +5916,7 @@
if (!inflightReq.errorCodeValid) {
ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u);
- ASSERT_EQ(previewStream.id, inflightReq.resultOutputBuffers[0].buffer.streamId);
+ ASSERT_EQ(previewStream.id, inflightReq.resultOutputBuffers[0].streamId);
} else {
switch (inflightReq.errorCode) {
case ErrorCode::ERROR_REQUEST:
@@ -6346,7 +6322,7 @@
AvailableStream depthPreviewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
static_cast<int32_t>(PixelFormat::Y16)};
const AvailableStream* depthThreshold =
- (threshold != nullptr) ? threshold : &depthPreviewThreshold;
+ isDepthOnly(staticMeta) ? &depthPreviewThreshold : threshold;
fillOutputStreams(&depthEntry, outputStreams, depthThreshold,
ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_OUTPUT);
}
@@ -7427,47 +7403,6 @@
previewStream, halStreamConfig, supportsPartialResults,
partialResultCount, useHalBufManager, outCb, streamConfigCounter);
}
-
-bool CameraHidlTest::supportsPreviewStabilization(const std::string& name,
- sp<ICameraProvider> provider) {
- Return<void> ret;
- sp<ICameraDevice> device3_x = nullptr;
- ret = provider->getCameraDeviceInterface_V3_x(name, [&](auto status, const auto& device) {
- ALOGI("getCameraDeviceInterface_V3_x returns status:%d", (int)status);
- ASSERT_EQ(Status::OK, status);
- ASSERT_NE(device, nullptr);
- device3_x = device;
- });
- if (!(ret.isOk())) {
- ADD_FAILURE() << "Failed to get camera device interface for " << name;
- }
-
- camera_metadata_t* staticMeta = nullptr;
- ret = device3_x->getCameraCharacteristics([&](Status s, CameraMetadata metadata) {
- ASSERT_EQ(Status::OK, s);
- staticMeta =
- clone_camera_metadata(reinterpret_cast<const camera_metadata_t*>(metadata.data()));
- });
- if (!(ret.isOk())) {
- ADD_FAILURE() << "Failed to get camera characteristics for " << name;
- }
- // Go through the characteristics and see if video stabilization modes have
- // preview stabilization
- camera_metadata_ro_entry entry;
-
- int retcode = find_camera_metadata_ro_entry(
- staticMeta, ANDROID_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES, &entry);
- if ((0 == retcode) && (entry.count > 0)) {
- for (auto i = 0; i < entry.count; i++) {
- if (entry.data.u8[i] ==
- ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION) {
- return true;
- }
- }
- }
- return false;
-}
-
// Open a device session and configure a preview stream.
void CameraHidlTest::configureSingleStream(
const std::string& name, int32_t deviceVersion, sp<ICameraProvider> provider,
diff --git a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
index 2c98db8..b764ad6 100644
--- a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
+++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
@@ -2002,6 +2002,8 @@
ASSERT_NE(std::cv_status::timeout, mResultCondition.wait_until(l, timeout));
}
+ waitForReleaseFence(inflightReq->resultOutputBuffers);
+
ASSERT_FALSE(inflightReq->errorCodeValid);
ASSERT_NE(inflightReq->resultOutputBuffers.size(), 0u);
verify10BitMetadata(mHandleImporter, *inflightReq, profile);
diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp
index 573b8f1..137c521 100644
--- a/camera/provider/aidl/vts/camera_aidl_test.cpp
+++ b/camera/provider/aidl/vts/camera_aidl_test.cpp
@@ -34,6 +34,7 @@
#include <grallocusage/GrallocUsageConversion.h>
#include <hardware/gralloc1.h>
#include <simple_device_cb.h>
+#include <ui/Fence.h>
#include <ui/GraphicBufferAllocator.h>
#include <regex>
#include <typeinfo>
@@ -139,6 +140,25 @@
}
}
+void CameraAidlTest::waitForReleaseFence(
+ std::vector<InFlightRequest::StreamBufferAndTimestamp>& resultOutputBuffers) {
+ for (auto& bufferAndTimestamp : resultOutputBuffers) {
+ // wait for the fence timestamp and store it along with the buffer
+ android::sp<android::Fence> releaseFence = nullptr;
+ const native_handle_t* releaseFenceHandle = bufferAndTimestamp.buffer.releaseFence;
+ if (releaseFenceHandle != nullptr && releaseFenceHandle->numFds == 1 &&
+ releaseFenceHandle->data[0] >= 0) {
+ releaseFence = new android::Fence(releaseFenceHandle->data[0]);
+ }
+ if (releaseFence && releaseFence->isValid()) {
+ releaseFence->wait(/*ms*/ 300);
+ nsecs_t releaseTime = releaseFence->getSignalTime();
+ if (bufferAndTimestamp.timeStamp < releaseTime)
+ bufferAndTimestamp.timeStamp = releaseTime;
+ }
+ }
+}
+
std::vector<std::string> CameraAidlTest::getCameraDeviceNames(
std::shared_ptr<ICameraProvider>& provider, bool addSecureOnly) {
std::vector<std::string> cameraDeviceNames;
@@ -779,7 +799,7 @@
AvailableStream depthPreviewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
static_cast<int32_t>(PixelFormat::Y16)};
const AvailableStream* depthThreshold =
- (threshold != nullptr) ? threshold : &depthPreviewThreshold;
+ isDepthOnly(staticMeta) ? &depthPreviewThreshold : threshold;
fillOutputStreams(&depthEntry, outputStreams, depthThreshold,
ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_OUTPUT);
}
@@ -2376,6 +2396,7 @@
std::chrono::seconds(kStreamBufferTimeoutSec);
ASSERT_NE(std::cv_status::timeout, mResultCondition.wait_until(l, timeout));
}
+ waitForReleaseFence(inflightReq->resultOutputBuffers);
ASSERT_FALSE(inflightReq->errorCodeValid);
ASSERT_NE(inflightReq->resultOutputBuffers.size(), 0u);
diff --git a/camera/provider/aidl/vts/camera_aidl_test.h b/camera/provider/aidl/vts/camera_aidl_test.h
index 3741a64..d4d9bdd 100644
--- a/camera/provider/aidl/vts/camera_aidl_test.h
+++ b/camera/provider/aidl/vts/camera_aidl_test.h
@@ -491,6 +491,9 @@
aidl::android::hardware::camera::metadata::RequestAvailableDynamicRangeProfilesMap
profile);
+ static void waitForReleaseFence(
+ std::vector<InFlightRequest::StreamBufferAndTimestamp>& resultOutputBuffers);
+
// Map from frame number to the in-flight request state
typedef std::unordered_map<uint32_t, std::shared_ptr<InFlightRequest>> InFlightMap;
diff --git a/camera/provider/aidl/vts/device_cb.cpp b/camera/provider/aidl/vts/device_cb.cpp
index 3ec96a1..ca2f904 100644
--- a/camera/provider/aidl/vts/device_cb.cpp
+++ b/camera/provider/aidl/vts/device_cb.cpp
@@ -19,7 +19,6 @@
#include <aidl/android/hardware/graphics/common/PixelFormat.h>
#include <aidlcommonsupport/NativeHandle.h>
#include <grallocusage/GrallocUsageConversion.h>
-#include <ui/Fence.h>
#include <cinttypes>
using ::aidl::android::hardware::camera::device::BufferStatus;
@@ -419,13 +418,6 @@
}
for (const auto& buffer : results.outputBuffers) {
- // wait for the fence timestamp and store it along with the buffer
- // TODO: Check if we really need the dup here
- android::sp<android::Fence> releaseFence = nullptr;
- if (buffer.releaseFence.fds.size() == 1 && buffer.releaseFence.fds[0].get() >= 0) {
- releaseFence = new android::Fence(dup(buffer.releaseFence.fds[0].get()));
- }
-
CameraAidlTest::InFlightRequest::StreamBufferAndTimestamp streamBufferAndTimestamp;
auto outstandingBuffers = mUseHalBufManager ? mOutstandingBufferIds :
request->mOutstandingBufferIds;
@@ -439,12 +431,6 @@
::android::makeFromAidl(buffer.acquireFence),
::android::makeFromAidl(buffer.releaseFence)};
streamBufferAndTimestamp.timeStamp = systemTime();
- if (releaseFence && releaseFence->isValid()) {
- releaseFence->wait(/*ms*/ 300);
- nsecs_t releaseTime = releaseFence->getSignalTime();
- if (streamBufferAndTimestamp.timeStamp < releaseTime)
- streamBufferAndTimestamp.timeStamp = releaseTime;
- }
request->resultOutputBuffers.push_back(streamBufferAndTimestamp);
}
// If shutter event is received notify the pending threads.