Merge "Camera: VTS: Wait for release fence before consuming buffers" into android13-tests-dev
diff --git a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
index 98e49a2..478482d 100644
--- a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
+++ b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
@@ -1698,26 +1698,6 @@
ASSERT_EQ(0U, framesLost);
}
-TEST_P(InputStreamTest, getCapturePosition) {
- doc::test(
- "The capture position of a non prepared stream should not be "
- "retrievable or 0");
- uint64_t frames;
- uint64_t time;
- ASSERT_OK(stream->getCapturePosition(returnIn(res, frames, time)));
- // Although 'getCapturePosition' is mandatory in V7, legacy implementations
- // may return -ENOSYS (which is translated to NOT_SUPPORTED) in cases when
- // the capture position can't be retrieved, e.g. when the stream isn't
- // running. Because of this, we don't fail when getting NOT_SUPPORTED
- // in this test. Behavior of 'getCapturePosition' for running streams is
- // tested in 'PcmOnlyConfigInputStreamTest' for V7.
- ASSERT_RESULT(okOrInvalidStateOrNotSupported, res);
- if (res == Result::OK) {
- ASSERT_EQ(0U, frames);
- ASSERT_LE(0U, time);
- }
-}
-
//////////////////////////////////////////////////////////////////////////////
///////////////////////////////// StreamOut //////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
diff --git a/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.xml b/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.xml
index ea7adc9..6010c60 100644
--- a/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.xml
+++ b/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.xml
@@ -24,8 +24,10 @@
<target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
<option name="run-command" value="settings put global ble_scan_always_enabled 0" />
- <option name="run-command" value="su u$(am get-current-user)_system svc bluetooth disable" />
- <option name="teardown-command" value="su u$(am get-current-user)_system svc bluetooth enable" />
+ <option name="run-command" value="cmd bluetooth_manager disable" />
+ <option name="run-command" value="cmd bluetooth_manager wait-for-state:STATE_OFF" />
+ <option name="teardown-command" value="cmd bluetooth_manager enable" />
+ <option name="teardown-command" value="cmd bluetooth_manager wait-for-state:STATE_ON" />
<option name="teardown-command" value="settings put global ble_scan_always_enabled 1" />
</target_preparer>
diff --git a/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.xml b/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.xml
index 98b62ef..0234dc8 100644
--- a/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.xml
+++ b/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.xml
@@ -22,8 +22,10 @@
<target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
<option name="run-command" value="settings put global ble_scan_always_enabled 0" />
- <option name="run-command" value="su u$(am get-current-user)_system svc bluetooth disable" />
- <option name="teardown-command" value="su u$(am get-current-user)_system svc bluetooth enable" />
+ <option name="run-command" value="cmd bluetooth_manager disable" />
+ <option name="run-command" value="cmd bluetooth_manager wait-for-state:STATE_OFF" />
+ <option name="teardown-command" value="cmd bluetooth_manager enable" />
+ <option name="teardown-command" value="cmd bluetooth_manager wait-for-state:STATE_ON" />
<option name="teardown-command" value="settings put global ble_scan_always_enabled 1" />
</target_preparer>
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index 2a5f90f..339a142 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -6294,8 +6294,6 @@
std::vector<AvailableStream>& outputStreams,
const AvailableStream* threshold,
bool maxResolution) {
- AvailableStream depthPreviewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
- static_cast<int32_t>(PixelFormat::Y16)};
if (nullptr == staticMeta) {
return Status::ILLEGAL_ARGUMENT;
}
@@ -6321,8 +6319,12 @@
}
if(foundDepth == 0 && (0 == (depthEntry.count % 4))) {
- fillOutputStreams(&depthEntry, outputStreams, &depthPreviewThreshold,
- ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_OUTPUT);
+ AvailableStream depthPreviewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
+ static_cast<int32_t>(PixelFormat::Y16)};
+ const AvailableStream* depthThreshold =
+ isDepthOnly(staticMeta) ? &depthPreviewThreshold : threshold;
+ fillOutputStreams(&depthEntry, outputStreams, depthThreshold,
+ ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_OUTPUT);
}
return Status::OK;
diff --git a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
index be5bcb5..b764ad6 100644
--- a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
+++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
@@ -1846,7 +1846,6 @@
// Generate and verify 10-bit dynamic range request
TEST_P(CameraAidlTest, process10BitDynamicRangeRequest) {
std::vector<std::string> cameraDeviceNames = getCameraDeviceNames(mProvider);
- int64_t bufferId = 1;
CameraMetadata settings;
for (const auto& name : cameraDeviceNames) {
@@ -1927,12 +1926,12 @@
// Stream as long as needed to fill the Hal inflight queue
std::vector<CaptureRequest> requests(halStreams[0].maxBuffers);
- for (int32_t frameNumber = 0; frameNumber < requests.size(); frameNumber++) {
+ for (int32_t requestId = 0; requestId < requests.size(); requestId++) {
std::shared_ptr<InFlightRequest> inflightReq = std::make_shared<InFlightRequest>(
static_cast<ssize_t>(halStreams.size()), false, supportsPartialResults,
partialResultCount, std::unordered_set<std::string>(), resultQueue);
- CaptureRequest& request = requests[frameNumber];
+ CaptureRequest& request = requests[requestId];
std::vector<StreamBuffer>& outputBuffers = request.outputBuffers;
outputBuffers.resize(halStreams.size());
@@ -1941,6 +1940,7 @@
std::vector<buffer_handle_t> graphicBuffers;
graphicBuffers.reserve(halStreams.size());
+ auto bufferId = requestId + 1; // Buffer id value 0 is not valid
for (const auto& halStream : halStreams) {
buffer_handle_t buffer_handle;
if (useHalBufManager) {
@@ -1959,14 +1959,13 @@
outputBuffers[k] = {halStream.id, bufferId,
android::makeToAidl(buffer_handle), BufferStatus::OK, NativeHandle(),
NativeHandle()};
- bufferId++;
}
k++;
}
request.inputBuffer = {
-1, 0, NativeHandle(), BufferStatus::ERROR, NativeHandle(), NativeHandle()};
- request.frameNumber = frameNumber;
+ request.frameNumber = bufferId;
request.fmqSettingsSize = 0;
request.settings = settings;
request.inputWidth = 0;
@@ -1974,7 +1973,7 @@
{
std::unique_lock<std::mutex> l(mLock);
- mInflightMap[frameNumber] = inflightReq;
+ mInflightMap[bufferId] = inflightReq;
}
}
@@ -1990,7 +1989,10 @@
std::vector<int32_t> {halStreams[0].id});
ASSERT_TRUE(returnStatus.isOk());
- for (int32_t frameNumber = 0; frameNumber < requests.size(); frameNumber++) {
+ // We are keeping frame numbers and buffer ids consistent. Buffer id value of 0
+ // is used to indicate a buffer that is not present/available so buffer ids as well
+ // as frame numbers begin with 1.
+ for (int32_t frameNumber = 1; frameNumber <= requests.size(); frameNumber++) {
const auto& inflightReq = mInflightMap[frameNumber];
std::unique_lock<std::mutex> l(mLock);
while (!inflightReq->errorCodeValid &&
diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp
index c352d7d..137c521 100644
--- a/camera/provider/aidl/vts/camera_aidl_test.cpp
+++ b/camera/provider/aidl/vts/camera_aidl_test.cpp
@@ -187,7 +187,7 @@
ScopedAStatus physicalCameraDeviceStatusChange(
const std::string&, const std::string&,
::aidl::android::hardware::camera::common::CameraDeviceStatus) override {
- return ndk::ScopedAStatus();
+ return ScopedAStatus::ok();
}
std::vector<std::string> externalCameraDeviceNames;
@@ -771,8 +771,6 @@
std::vector<AvailableStream>& outputStreams,
const AvailableStream* threshold,
bool maxResolution) {
- AvailableStream depthPreviewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
- static_cast<int32_t>(PixelFormat::Y16)};
if (nullptr == staticMeta) {
return Status::ILLEGAL_ARGUMENT;
}
@@ -798,7 +796,11 @@
}
if (foundDepth == 0 && (0 == (depthEntry.count % 4))) {
- fillOutputStreams(&depthEntry, outputStreams, &depthPreviewThreshold,
+ AvailableStream depthPreviewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
+ static_cast<int32_t>(PixelFormat::Y16)};
+ const AvailableStream* depthThreshold =
+ isDepthOnly(staticMeta) ? &depthPreviewThreshold : threshold;
+ fillOutputStreams(&depthEntry, outputStreams, depthThreshold,
ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_OUTPUT);
}
@@ -2352,6 +2354,7 @@
request.fmqSettingsSize = 0;
request.settings.metadata =
std::vector(rawMetadata, rawMetadata + get_camera_metadata_size(releasedMetadata));
+ overrideRotateAndCrop(&request.settings);
request.outputBuffers = std::vector<StreamBuffer>(1);
StreamBuffer& outputBuffer = request.outputBuffers[0];
if (useHalBufManager) {
diff --git a/camera/provider/aidl/vts/device_cb.cpp b/camera/provider/aidl/vts/device_cb.cpp
index b23c691..ca2f904 100644
--- a/camera/provider/aidl/vts/device_cb.cpp
+++ b/camera/provider/aidl/vts/device_cb.cpp
@@ -421,10 +421,11 @@
CameraAidlTest::InFlightRequest::StreamBufferAndTimestamp streamBufferAndTimestamp;
auto outstandingBuffers = mUseHalBufManager ? mOutstandingBufferIds :
request->mOutstandingBufferIds;
+ auto bufferId = mUseHalBufManager ? buffer.bufferId : results.frameNumber;
auto outputBuffer = outstandingBuffers.empty() ? ::android::makeFromAidl(buffer.buffer) :
- outstandingBuffers[buffer.streamId][buffer.bufferId];
+ outstandingBuffers[buffer.streamId][bufferId];
streamBufferAndTimestamp.buffer = {buffer.streamId,
- buffer.bufferId,
+ bufferId,
outputBuffer,
buffer.status,
::android::makeFromAidl(buffer.acquireFence),
diff --git a/drm/aidl/vts/drm_hal_common.cpp b/drm/aidl/vts/drm_hal_common.cpp
index 7de8167..f0445a5 100644
--- a/drm/aidl/vts/drm_hal_common.cpp
+++ b/drm/aidl/vts/drm_hal_common.cpp
@@ -187,6 +187,12 @@
auto svc = GetParamService();
const string drmInstance = HalFullName(kDrmIface, svc);
+ if (!vendorModule) {
+ ASSERT_NE(drmInstance, HalFullName(kDrmIface, "widevine")) << "Widevine requires vendor module.";
+ ASSERT_NE(drmInstance, HalFullName(kDrmIface, "clearkey")) << "Clearkey requires vendor module.";
+ GTEST_SKIP() << "No vendor module installed";
+ }
+
if (drmInstance.find("IDrmFactory") != std::string::npos) {
drmFactory = IDrmFactory::fromBinder(
::ndk::SpAIBinder(AServiceManager_waitForService(drmInstance.c_str())));
@@ -195,12 +201,6 @@
cryptoPlugin = createCryptoPlugin();
}
- if (!vendorModule) {
- ASSERT_NE(drmInstance, "widevine") << "Widevine requires vendor module.";
- ASSERT_NE(drmInstance, "clearkey") << "Clearkey requires vendor module.";
- GTEST_SKIP() << "No vendor module installed";
- }
-
ASSERT_EQ(HalBaseName(drmInstance), vendorModule->getServiceName());
contentConfigurations = vendorModule->getContentConfigurations();
@@ -263,6 +263,9 @@
}
bool DrmHalTest::isCryptoSchemeSupported(Uuid uuid, SecurityLevel level, std::string mime) {
+ if (drmFactory == nullptr) {
+ return false;
+ }
CryptoSchemes schemes{};
auto ret = drmFactory->getSupportedCryptoSchemes(&schemes);
EXPECT_OK(ret);
diff --git a/drm/aidl/vts/drm_hal_test.cpp b/drm/aidl/vts/drm_hal_test.cpp
index 14b3acf..847a4dc 100644
--- a/drm/aidl/vts/drm_hal_test.cpp
+++ b/drm/aidl/vts/drm_hal_test.cpp
@@ -198,6 +198,18 @@
EXPECT_NE(keySetId, keySetId2.keySetId);
}
+ for (auto level : {kHwSecureAll, kSwSecureCrypto}) {
+ Status err = Status::OK;
+ auto sid = openSession(level, &err);
+ if (err == Status::OK) {
+ closeSession(sid);
+ } else if (err == Status::ERROR_DRM_CANNOT_HANDLE) {
+ continue;
+ } else {
+ EXPECT_EQ(Status::ERROR_DRM_NOT_PROVISIONED, err);
+ provision();
+ }
+ }
ret = drmPlugin->removeOfflineLicense({keySetId});
EXPECT_TXN(ret);
EXPECT_EQ(Status::BAD_VALUE, DrmErr(ret));
diff --git a/gnss/aidl/vts/gnss_hal_test.cpp b/gnss/aidl/vts/gnss_hal_test.cpp
index 3907f57..64e51c7 100644
--- a/gnss/aidl/vts/gnss_hal_test.cpp
+++ b/gnss/aidl/vts/gnss_hal_test.cpp
@@ -447,6 +447,7 @@
const int numMeasurementEvents,
const int timeoutSeconds,
std::vector<int>& deltasMs) {
+ callback->gnss_data_cbq_.reset(); // throw away the initial measurements if any
int64_t lastElapsedRealtimeMillis = 0;
for (int i = 0; i < numMeasurementEvents; i++) {
GnssData lastGnssData;
diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp
index 3696233..c7fc32a 100644
--- a/gnss/aidl/vts/gnss_hal_test_cases.cpp
+++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp
@@ -526,6 +526,11 @@
EXPECT_EQ(gnssPowerIndicationCallback->capabilities_cbq_.calledCount(), 1);
+ if (gnssPowerIndicationCallback->last_capabilities_ == 0) {
+ // Skipping the test since GnssPowerIndication is not supported.
+ return;
+ }
+
// Request and verify a GnssPowerStats is received
gnssPowerIndicationCallback->gnss_power_stats_cbq_.reset();
iGnssPowerIndication->requestGnssPowerStats();
diff --git a/graphics/mapper/3.0/utils/vts/MapperVts.cpp b/graphics/mapper/3.0/utils/vts/MapperVts.cpp
index c470a4a..48e5736 100644
--- a/graphics/mapper/3.0/utils/vts/MapperVts.cpp
+++ b/graphics/mapper/3.0/utils/vts/MapperVts.cpp
@@ -99,11 +99,7 @@
descriptor, count,
[&](const auto& tmpError, const auto& tmpStride, const auto& tmpBuffers) {
if (tmpError != Error::NONE) {
- if (base::GetIntProperty("ro.vendor.build.version.sdk", 0, 0, INT_MAX) < 33) {
- GTEST_SKIP() << "Old vendor grallocs may not support P010";
- } else {
- GTEST_FAIL() << "failed to allocate buffers";
- }
+ GTEST_FAIL() << "failed to allocate buffers";
}
ASSERT_EQ(count, tmpBuffers.size()) << "invalid buffer array";
diff --git a/graphics/mapper/3.0/vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp b/graphics/mapper/3.0/vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp
index 3b1bfab..997af97 100644
--- a/graphics/mapper/3.0/vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp
+++ b/graphics/mapper/3.0/vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp
@@ -21,6 +21,7 @@
#include <vector>
#include <android-base/logging.h>
+#include <android-base/properties.h>
#include <gtest/gtest.h>
#include <hidl/GtestPrinter.h>
#include <hidl/ServiceManagement.h>
@@ -330,6 +331,9 @@
* Test IMapper::lockYCbCr. This locks a YCbCr_P010 buffer and verifies that it's initialized.
*/
TEST_P(GraphicsMapperHidlTest, LockYCbCrP010) {
+ if (base::GetIntProperty("ro.vendor.api_level", __ANDROID_API_FUTURE__) < __ANDROID_API_T__) {
+ GTEST_SKIP() << "Old vendor grallocs may not support P010";
+ }
auto info = mDummyDescriptorInfo;
info.format = PixelFormat::YCBCR_P010;
diff --git a/graphics/mapper/4.0/utils/vts/MapperVts.cpp b/graphics/mapper/4.0/utils/vts/MapperVts.cpp
index c6c9834..d70c6ef 100644
--- a/graphics/mapper/4.0/utils/vts/MapperVts.cpp
+++ b/graphics/mapper/4.0/utils/vts/MapperVts.cpp
@@ -111,11 +111,7 @@
}
if (error != Error::NONE) {
- if (base::GetIntProperty("ro.vendor.build.version.sdk", 0, 0, INT_MAX) < 33) {
- GTEST_SKIP() << "Old vendor grallocs may not support P010";
- } else {
- GTEST_FAIL() << "failed to allocate buffers";
- }
+ GTEST_FAIL() << "failed to allocate buffers";
}
ASSERT_EQ(count, buffers.size()) << "invalid buffer array";
diff --git a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp
index 5a450e3..2ec98d4 100644
--- a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp
+++ b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp
@@ -29,12 +29,14 @@
#include <aidlcommonsupport/NativeHandle.h>
#include <android-base/logging.h>
+#include <android-base/properties.h>
#include <android-base/unique_fd.h>
#include <android/sync.h>
#include <gralloctypes/Gralloc4.h>
#include <gtest/gtest.h>
#include <hidl/GtestPrinter.h>
#include <hidl/ServiceManagement.h>
+
#include <mapper-vts/4.0/MapperVts.h>
#include <system/graphics.h>
@@ -1000,6 +1002,9 @@
}
TEST_P(GraphicsMapperHidlTest, Lock_YCBCR_P010) {
+ if (base::GetIntProperty("ro.vendor.api_level", __ANDROID_API_FUTURE__) < __ANDROID_API_T__) {
+ GTEST_SKIP() << "Old vendor grallocs may not support P010";
+ }
auto info = mDummyDescriptorInfo;
info.format = PixelFormat::YCBCR_P010;
diff --git a/identity/aidl/vts/Util.cpp b/identity/aidl/vts/Util.cpp
index f3d7c30..4f5c121 100644
--- a/identity/aidl/vts/Util.cpp
+++ b/identity/aidl/vts/Util.cpp
@@ -523,8 +523,24 @@
int64_t allowDriftSecs = 10;
EXPECT_LE(-allowDriftSecs, diffSecs);
EXPECT_GE(allowDriftSecs, diffSecs);
- constexpr uint64_t kSecsInOneYear = 365 * 24 * 60 * 60;
- EXPECT_EQ(notBefore + kSecsInOneYear, notAfter);
+
+ // The AIDL spec used to call for "one year in the future (365
+ // days)" but was updated to say "current time and 31536000
+ // seconds in the future (approximately 365 days)" to clarify that
+ // this was the original intention.
+ //
+ // However a number of implementations interpreted this as a
+ // "literal year" which started causing problems in March 2023
+ // because 2024 is a leap year. Since the extra day doesn't really
+ // matter (the validity period is specified in the MSO anyway and
+ // that's what RPs use), we allow both interpretations.
+ //
+ // For simplicity, we just require that that notAfter is after
+ // 31536000 and which also covers the case if there's a leap-day
+ // and possible leap-seconds.
+ //
+ constexpr uint64_t kSecsIn365Days = 365 * 24 * 60 * 60;
+ EXPECT_LE(notBefore + kSecsIn365Days, notAfter);
}
vector<RequestNamespace> buildRequestNamespaces(const vector<TestEntryData> entries) {
diff --git a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp
index fb5048a..728cc91 100644
--- a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp
+++ b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp
@@ -4866,6 +4866,11 @@
if (vsr_api_level < 33) {
GTEST_SKIP() << "Applies only to VSR API level 33, this device is: " << vsr_api_level;
}
+ char soc_model[PROPERTY_VALUE_MAX] = {};
+ property_get("ro.soc.model", soc_model, "");
+ if (!strcmp(soc_model, "SM8550")) {
+ GTEST_SKIP() << "Skip QTI SM8550 chipset, the SOC model of this device is: " << soc_model;
+ }
FAIL() << "VSR 13+ requires KeyMint version 2";
}
diff --git a/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp b/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp
old mode 100755
new mode 100644
index 00e9837..d80e651
--- a/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp
+++ b/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp
@@ -374,21 +374,16 @@
}
}
-static int getFirstApiLevel() {
- int boardApiLevel = android::base::GetIntProperty("ro.board.first_api_level", 0);
- if (boardApiLevel != 0) {
- return boardApiLevel;
- }
-
- return android::base::GetIntProperty("ro.product.first_api_level", __ANDROID_API_T__);
-}
-
static bool isTV() {
return testing::deviceSupportsFeature("android.software.leanback");
}
// list components and roles.
TEST_P(StoreHidlTest, OmxCodecAllowedTest) {
+ static int sBoardFirstApiLevel = android::base::GetIntProperty("ro.board.first_api_level", 0);
+ if (sBoardFirstApiLevel == 0) {
+ GTEST_SKIP() << "board first API level not detected";
+ }
hidl_vec<IOmx::ComponentInfo> componentInfos = getComponentInfoList(omx);
for (IOmx::ComponentInfo info : componentInfos) {
for (std::string role : info.mRoles) {
@@ -396,27 +391,27 @@
role.find("video_encoder") != std::string::npos) {
// Codec2 is not mandatory on Android TV devices that launched with Android S
if (isTV()) {
- ASSERT_LT(getFirstApiLevel(), __ANDROID_API_T__)
+ ASSERT_LT(sBoardFirstApiLevel, __ANDROID_API_T__)
<< " Component: " << info.mName.c_str() << " Role: " << role.c_str()
<< " not allowed for devices launching with Android T and above";
} else {
std::string codecName = info.mName;
bool isAndroidCodec = (codecName.rfind("OMX.google", 0) != std::string::npos);
- if (isAndroidCodec && (getFirstApiLevel() <= __ANDROID_API_S__)) {
+ if (isAndroidCodec && (sBoardFirstApiLevel <= __ANDROID_API_S__)) {
// refer b/230582620
// S AOSP build did not remove the OMX.google video codecs
// so it is infeasible to require no OMX.google.* video codecs
// on S launching devices
} else {
- ASSERT_LT(getFirstApiLevel(), __ANDROID_API_S__)
- << " Component: " << info.mName.c_str() << " Role: " << role.c_str()
- << " not allowed for devices launching with Android S and above";
+ ASSERT_LT(sBoardFirstApiLevel, __ANDROID_API_S__)
+ << " Component: " << info.mName.c_str() << " Role: " << role.c_str()
+ << " not allowed for devices launching with Android S and above";
}
}
}
if (role.find("audio_decoder") != std::string::npos ||
role.find("audio_encoder") != std::string::npos) {
- ASSERT_LT(getFirstApiLevel(), __ANDROID_API_T__)
+ ASSERT_LT(sBoardFirstApiLevel, __ANDROID_API_T__)
<< " Component: " << info.mName.c_str() << " Role: " << role.c_str()
<< " not allowed for devices launching with Android T and above";
}
diff --git a/radio/1.4/vts/functional/radio_hidl_hal_api.cpp b/radio/1.4/vts/functional/radio_hidl_hal_api.cpp
index b0b984c..8f357a0 100644
--- a/radio/1.4/vts/functional/radio_hidl_hal_api.cpp
+++ b/radio/1.4/vts/functional/radio_hidl_hal_api.cpp
@@ -232,7 +232,8 @@
EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial);
ALOGI("setPreferredNetworkTypeBitmap, rspInfo.error = %s\n",
toString(radioRsp_v1_4->rspInfo.error).c_str());
- EXPECT_EQ(RadioError::NONE, radioRsp_v1_4->rspInfo.error);
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error,
+ {RadioError::NONE, RadioError::MODE_NOT_SUPPORTED}));
if (radioRsp_v1_4->rspInfo.error == RadioError::NONE) {
// give some time for modem to set the value.
sleep(3);
diff --git a/radio/1.5/vts/functional/radio_hidl_hal_api.cpp b/radio/1.5/vts/functional/radio_hidl_hal_api.cpp
index 152858f..316c308 100644
--- a/radio/1.5/vts/functional/radio_hidl_hal_api.cpp
+++ b/radio/1.5/vts/functional/radio_hidl_hal_api.cpp
@@ -564,23 +564,23 @@
TEST_P(RadioHidlTest_v1_5, startNetworkScan) {
serial = GetRandomSerialNumber();
- ::android::hardware::radio::V1_5::RadioAccessSpecifier::Bands bandP900;
- bandP900.geranBands() = {GeranBands::BAND_P900};
- ::android::hardware::radio::V1_5::RadioAccessSpecifier::Bands band850;
- band850.geranBands() = {GeranBands::BAND_850};
- ::android::hardware::radio::V1_5::RadioAccessSpecifier specifierP900 = {
- .radioAccessNetwork = ::android::hardware::radio::V1_5::RadioAccessNetworks::GERAN,
- .bands = bandP900,
+ ::android::hardware::radio::V1_5::RadioAccessSpecifier::Bands band17;
+ band17.eutranBands({::android::hardware::radio::V1_5::EutranBands::BAND_17});
+ ::android::hardware::radio::V1_5::RadioAccessSpecifier::Bands band20;
+ band20.eutranBands({::android::hardware::radio::V1_5::EutranBands::BAND_20});
+ ::android::hardware::radio::V1_5::RadioAccessSpecifier specifier17 = {
+ .radioAccessNetwork = ::android::hardware::radio::V1_5::RadioAccessNetworks::EUTRAN,
+ .bands = band17,
.channels = {1, 2}};
- ::android::hardware::radio::V1_5::RadioAccessSpecifier specifier850 = {
- .radioAccessNetwork = ::android::hardware::radio::V1_5::RadioAccessNetworks::GERAN,
- .bands = band850,
+ ::android::hardware::radio::V1_5::RadioAccessSpecifier specifier20 = {
+ .radioAccessNetwork = ::android::hardware::radio::V1_5::RadioAccessNetworks::EUTRAN,
+ .bands = band20,
.channels = {128, 129}};
::android::hardware::radio::V1_5::NetworkScanRequest request = {
.type = ScanType::ONE_SHOT,
.interval = 60,
- .specifiers = {specifierP900, specifier850},
+ .specifiers = {specifier17, specifier20},
.maxSearchTime = 60,
.incrementalResults = false,
.incrementalResultsPeriodicity = 1};
@@ -595,12 +595,17 @@
if (cardStatus.base.base.base.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_5->rspInfo.error, {RadioError::SIM_ABSENT}));
} else if (cardStatus.base.base.base.cardState == CardState::PRESENT) {
- // OPERATION_NOT_ALLOWED should not be allowed; however, some vendors do
- // not support the required manual GSM search functionality. This is
- // tracked in b/112206766. Modems have "GSM" rat scan need to
+ // Modems support 3GPP RAT family need to
// support scanning requests combined with some parameters.
- ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_5->rspInfo.error,
- {RadioError::NONE, RadioError::OPERATION_NOT_ALLOWED}));
+ if (deviceSupportsFeature(FEATURE_TELEPHONY_GSM)) {
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_5->rspInfo.error,
+ {RadioError::NONE, RadioError::OPERATION_NOT_ALLOWED}));
+ } else {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_v1_5->rspInfo.error,
+ {RadioError::NONE, RadioError::OPERATION_NOT_ALLOWED,
+ RadioError::REQUEST_NOT_SUPPORTED, RadioError::INVALID_ARGUMENTS}));
+ }
}
if (radioRsp_v1_5->rspInfo.error == RadioError::NONE) {
diff --git a/radio/aidl/vts/radio_data_test.cpp b/radio/aidl/vts/radio_data_test.cpp
index f38a958..5986ff1 100644
--- a/radio/aidl/vts/radio_data_test.cpp
+++ b/radio/aidl/vts/radio_data_test.cpp
@@ -143,9 +143,21 @@
TrafficDescriptor trafficDescriptor;
OsAppId osAppId;
- std::string osAppIdString("osAppId");
- std::vector<unsigned char> osAppIdVec(osAppIdString.begin(), osAppIdString.end());
- osAppId.osAppId = osAppIdVec;
+ // hardcode osAppId for ENTERPRISE
+ osAppId.osAppId = {static_cast<unsigned char>(-105), static_cast<unsigned char>(-92),
+ static_cast<unsigned char>(-104), static_cast<unsigned char>(-29),
+ static_cast<unsigned char>(-4), static_cast<unsigned char>(-110),
+ static_cast<unsigned char>(92), static_cast<unsigned char>(-108),
+ static_cast<unsigned char>(-119), static_cast<unsigned char>(-122),
+ static_cast<unsigned char>(3), static_cast<unsigned char>(51),
+ static_cast<unsigned char>(-48), static_cast<unsigned char>(110),
+ static_cast<unsigned char>(78), static_cast<unsigned char>(71),
+ static_cast<unsigned char>(10), static_cast<unsigned char>(69),
+ static_cast<unsigned char>(78), static_cast<unsigned char>(84),
+ static_cast<unsigned char>(69), static_cast<unsigned char>(82),
+ static_cast<unsigned char>(80), static_cast<unsigned char>(82),
+ static_cast<unsigned char>(73), static_cast<unsigned char>(83),
+ static_cast<unsigned char>(69)};
trafficDescriptor.osAppId = osAppId;
DataProfileInfo dataProfileInfo;
diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp
index c83571e..61b34d7 100644
--- a/radio/aidl/vts/radio_network_test.cpp
+++ b/radio/aidl/vts/radio_network_test.cpp
@@ -829,20 +829,20 @@
TEST_P(RadioNetworkTest, startNetworkScan) {
serial = GetRandomSerialNumber();
- RadioAccessSpecifierBands bandP900 =
- RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::geranBands>(
- {GeranBands::BAND_P900});
- RadioAccessSpecifierBands band850 =
- RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::geranBands>(
- {GeranBands::BAND_850});
- RadioAccessSpecifier specifierP900 = {
- .accessNetwork = AccessNetwork::GERAN, .bands = bandP900, .channels = {1, 2}};
- RadioAccessSpecifier specifier850 = {
- .accessNetwork = AccessNetwork::GERAN, .bands = band850, .channels = {128, 129}};
+ RadioAccessSpecifierBands band17 =
+ RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::eutranBands>(
+ {EutranBands::BAND_17});
+ RadioAccessSpecifierBands band20 =
+ RadioAccessSpecifierBands::make<RadioAccessSpecifierBands::eutranBands>(
+ {EutranBands::BAND_20});
+ RadioAccessSpecifier specifier17 = {
+ .accessNetwork = AccessNetwork::EUTRAN, .bands = band17, .channels = {1, 2}};
+ RadioAccessSpecifier specifier20 = {
+ .accessNetwork = AccessNetwork::EUTRAN, .bands = band20, .channels = {128, 129}};
NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_ONE_SHOT,
.interval = 60,
- .specifiers = {specifierP900, specifier850},
+ .specifiers = {specifier17, specifier20},
.maxSearchTime = 60,
.incrementalResults = false,
.incrementalResultsPeriodicity = 1};
@@ -858,12 +858,17 @@
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, {RadioError::SIM_ABSENT}));
} else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
- // OPERATION_NOT_ALLOWED should not be allowed; however, some vendors do
- // not support the required manual GSM search functionality. This is
- // tracked in b/112206766. Modems have "GSM" rat scan need to
- // support scanning requests combined with some parameters.
- ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
- {RadioError::NONE, RadioError::OPERATION_NOT_ALLOWED}));
+ if (deviceSupportsFeature(FEATURE_TELEPHONY_GSM)) {
+ // Modems support 3GPP RAT family need to
+ // support scanning requests combined with some parameters.
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::OPERATION_NOT_ALLOWED}));
+ } else {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::OPERATION_NOT_ALLOWED, RadioError::NONE,
+ RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED}));
+ }
}
if (radioRsp_network->rspInfo.error == RadioError::NONE) {
diff --git a/security/keymint/aidl/vts/functional/Android.bp b/security/keymint/aidl/vts/functional/Android.bp
index ef5b0bd..f30e29c 100644
--- a/security/keymint/aidl/vts/functional/Android.bp
+++ b/security/keymint/aidl/vts/functional/Android.bp
@@ -31,8 +31,10 @@
"VtsHalTargetTestDefaults",
],
shared_libs: [
+ "libbinder",
"libbinder_ndk",
"libcrypto",
+ "packagemanager_aidl-cpp",
],
static_libs: [
"android.hardware.security.secureclock-V1-ndk",
diff --git a/security/keymint/aidl/vts/functional/AttestKeyTest.cpp b/security/keymint/aidl/vts/functional/AttestKeyTest.cpp
index ca517ac..b9968f8 100644
--- a/security/keymint/aidl/vts/functional/AttestKeyTest.cpp
+++ b/security/keymint/aidl/vts/functional/AttestKeyTest.cpp
@@ -35,7 +35,17 @@
} // namespace
class AttestKeyTest : public KeyMintAidlTestBase {
+ public:
+ void SetUp() override {
+ check_skip_test();
+ KeyMintAidlTestBase::SetUp();
+ }
+
protected:
+ const string FEATURE_KEYSTORE_APP_ATTEST_KEY = "android.hardware.keystore.app_attest_key";
+
+ const string FEATURE_STRONGBOX_KEYSTORE = "android.hardware.strongbox_keystore";
+
ErrorCode GenerateAttestKey(const AuthorizationSet& key_desc,
const optional<AttestationKey>& attest_key,
vector<uint8_t>* key_blob,
@@ -60,6 +70,59 @@
}
return GenerateKey(key_desc, attest_key, key_blob, key_characteristics, cert_chain);
}
+
+ // Check if ATTEST_KEY feature is disabled
+ bool is_attest_key_feature_disabled(void) const {
+ if (!check_feature(FEATURE_KEYSTORE_APP_ATTEST_KEY)) {
+ GTEST_LOG_(INFO) << "Feature " + FEATURE_KEYSTORE_APP_ATTEST_KEY + " is disabled";
+ return true;
+ }
+
+ return false;
+ }
+
+ // Check if StrongBox KeyStore is enabled
+ bool is_strongbox_enabled(void) const {
+ if (check_feature(FEATURE_STRONGBOX_KEYSTORE)) {
+ GTEST_LOG_(INFO) << "Feature " + FEATURE_STRONGBOX_KEYSTORE + " is enabled";
+ return true;
+ }
+
+ return false;
+ }
+
+ // Check if chipset has received a waiver allowing it to be launched with
+ // Android S (or later) with Keymaster 4.0 in StrongBox
+ bool is_chipset_allowed_km4_strongbox(void) const {
+ std::array<char, PROPERTY_VALUE_MAX> buffer;
+
+ auto res = property_get("ro.vendor.qti.soc_model", buffer.data(), nullptr);
+ if (res <= 0) return false;
+
+ const string allowed_soc_models[] = {"SM8450", "SM8475", "SM8550", "SXR2230P"};
+
+ for (const string model : allowed_soc_models) {
+ if (model.compare(buffer.data()) == 0) {
+ GTEST_LOG_(INFO) << "QTI SOC Model " + model + " is allowed SB KM 4.0";
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ // Skip the test if all the following conditions hold:
+ // 1. ATTEST_KEY feature is disabled
+ // 2. STRONGBOX is enabled
+ // 3. The device is running one of the chipsets that have received a waiver
+ // allowing it to be launched with Android S (or later) with Keymaster 4.0
+ // in StrongBox
+ void check_skip_test(void) const {
+ if (is_attest_key_feature_disabled() && is_strongbox_enabled() &&
+ is_chipset_allowed_km4_strongbox()) {
+ GTEST_SKIP() << "Test is not applicable";
+ }
+ }
};
/*
diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
index 46db4f0..20c0bf5 100644
--- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
+++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
@@ -23,6 +23,7 @@
#include <android-base/logging.h>
#include <android/binder_manager.h>
+#include <android/content/pm/IPackageManagerNative.h>
#include <cppbor_parse.h>
#include <cutils/properties.h>
#include <gmock/gmock.h>
@@ -1923,6 +1924,29 @@
*signingKey = std::move(pubKey);
}
+// Check whether the given named feature is available.
+bool check_feature(const std::string& name) {
+ ::android::sp<::android::IServiceManager> sm(::android::defaultServiceManager());
+ ::android::sp<::android::IBinder> binder(sm->getService(::android::String16("package_native")));
+ if (binder == nullptr) {
+ GTEST_LOG_(ERROR) << "getService package_native failed";
+ return false;
+ }
+ ::android::sp<::android::content::pm::IPackageManagerNative> packageMgr =
+ ::android::interface_cast<::android::content::pm::IPackageManagerNative>(binder);
+ if (packageMgr == nullptr) {
+ GTEST_LOG_(ERROR) << "Cannot find package manager";
+ return false;
+ }
+ bool hasFeature = false;
+ auto status = packageMgr->hasSystemFeature(::android::String16(name.c_str()), 0, &hasFeature);
+ if (!status.isOk()) {
+ GTEST_LOG_(ERROR) << "hasSystemFeature('" << name << "') failed: " << status;
+ return false;
+ }
+ return hasFeature;
+}
+
} // namespace test
} // namespace aidl::android::hardware::security::keymint
diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h
index 8f9df24..7d3bc30 100644
--- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h
+++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h
@@ -386,6 +386,7 @@
void check_maced_pubkey(const MacedPublicKey& macedPubKey, bool testMode,
vector<uint8_t>* payload_value);
void p256_pub_key(const vector<uint8_t>& coseKeyData, EVP_PKEY_Ptr* signingKey);
+bool check_feature(const std::string& name);
AuthorizationSet HwEnforcedAuthorizations(const vector<KeyCharacteristics>& key_characteristics);
AuthorizationSet SwEnforcedAuthorizations(const vector<KeyCharacteristics>& key_characteristics);
diff --git a/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp b/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp
index d536e29..35220a2 100644
--- a/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp
+++ b/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp
@@ -98,6 +98,7 @@
CHECK_TYPE_STRING_FOR_SENSOR_TYPE(TILT_DETECTOR);
CHECK_TYPE_STRING_FOR_SENSOR_TYPE(WAKE_GESTURE);
CHECK_TYPE_STRING_FOR_SENSOR_TYPE(WRIST_TILT_GESTURE);
+ CHECK_TYPE_STRING_FOR_SENSOR_TYPE(HINGE_ANGLE);
default:
FAIL() << "Type " << static_cast<int>(type)
<< " in android defined range is not checked, "
diff --git a/sensors/common/vts/2_X/VtsHalSensorsV2_XTargetTest.h b/sensors/common/vts/2_X/VtsHalSensorsV2_XTargetTest.h
index 7e22b19..aa6e881 100644
--- a/sensors/common/vts/2_X/VtsHalSensorsV2_XTargetTest.h
+++ b/sensors/common/vts/2_X/VtsHalSensorsV2_XTargetTest.h
@@ -559,6 +559,11 @@
}
TEST_P(SensorsHidlTest, CleanupConnectionsOnInitialize) {
+ if (getSensorsList().size() == 0) {
+ // No sensors
+ return;
+ }
+
activateAllSensors(true);
// Verify that events are received
diff --git a/tv/tuner/1.0/vts/functional/DvrTests.cpp b/tv/tuner/1.0/vts/functional/DvrTests.cpp
index 83f9858..cab5867 100644
--- a/tv/tuner/1.0/vts/functional/DvrTests.cpp
+++ b/tv/tuner/1.0/vts/functional/DvrTests.cpp
@@ -203,7 +203,6 @@
void DvrCallback::stopRecordThread() {
mKeepReadingRecordFMQ = false;
mRecordThreadRunning = false;
- android::Mutex::Autolock autoLock(mRecordThreadLock);
}
AssertionResult DvrTests::openDvrInDemux(DvrType type, uint32_t bufferSize) {
diff --git a/tv/tuner/config/TunerTestingConfigReaderV1_0.h b/tv/tuner/config/TunerTestingConfigReaderV1_0.h
index d049b07..fb76de7 100644
--- a/tv/tuner/config/TunerTestingConfigReaderV1_0.h
+++ b/tv/tuner/config/TunerTestingConfigReaderV1_0.h
@@ -65,6 +65,7 @@
using android::hardware::tv::tuner::V1_0::LnbVoltage;
using android::hardware::tv::tuner::V1_0::PlaybackSettings;
using android::hardware::tv::tuner::V1_0::RecordSettings;
+using android::hardware::tv::tuner::V1_0::FrontendAtscSettings;
const string emptyHardwareId = "";
@@ -241,6 +242,7 @@
break;
case FrontendTypeEnum::ATSC:
type = FrontendType::ATSC;
+ frontendMap[id].settings.atsc(readAtscFrontendSettings(feConfig));
break;
case FrontendTypeEnum::ATSC3:
type = FrontendType::ATSC3;
@@ -627,6 +629,13 @@
return dvbsSettings;
}
+ static FrontendAtscSettings readAtscFrontendSettings(Frontend feConfig) {
+ FrontendAtscSettings atscSettings{
+ .frequency = (uint32_t)feConfig.getFrequency(),
+ };
+ return atscSettings;
+ }
+
static bool readFilterTypeAndSettings(Filter filterConfig, DemuxFilterType& type,
DemuxFilterSettings& settings) {
auto mainType = filterConfig.getMainType();
diff --git a/wifi/1.6/vts/functional/wifi_nan_iface_hidl_test.cpp b/wifi/1.6/vts/functional/wifi_nan_iface_hidl_test.cpp
index 7bcc6d3..37c55e7 100644
--- a/wifi/1.6/vts/functional/wifi_nan_iface_hidl_test.cpp
+++ b/wifi/1.6/vts/functional/wifi_nan_iface_hidl_test.cpp
@@ -68,17 +68,10 @@
virtual void TearDown() override { stopWifi(GetInstanceName()); }
- /* Used as a mechanism to inform the test about data/event callback */
- inline void notify() {
- std::unique_lock<std::mutex> lock(mtx_);
- count_++;
- cv_.notify_one();
- }
enum CallbackType {
- INVALID = -2,
ANY_CALLBACK = -1,
-
+ INVALID = 0,
NOTIFY_CAPABILITIES_RESPONSE = 0,
NOTIFY_ENABLE_RESPONSE,
NOTIFY_CONFIG_RESPONSE,
@@ -114,8 +107,14 @@
EVENT_DATA_PATH_CONFIRM_1_6,
};
+ /* Used as a mechanism to inform the test about data/event callback */
+ inline void notify(CallbackType callbackType) {
+ std::unique_lock<std::mutex> lock(mtx_);
+ callbackEventBitMap |= (0x1 << callbackType);
+ cv_.notify_one();
+ }
/* Test code calls this function to wait for data/event callback */
- /* Must set callbackType = INVALID before call this function */
+ /* Must set callbackEventBitMap = INVALID before call this function */
inline std::cv_status wait(CallbackType waitForCallbackType) {
std::unique_lock<std::mutex> lock(mtx_);
@@ -124,15 +123,11 @@
std::cv_status status = std::cv_status::no_timeout;
auto now = std::chrono::system_clock::now();
- while (count_ == 0) {
+ while (!(callbackEventBitMap & (0x1 << waitForCallbackType))) {
status = cv_.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD));
- if (status == std::cv_status::timeout) return status;
- if (waitForCallbackType != ANY_CALLBACK && callbackType != INVALID &&
- callbackType != waitForCallbackType) {
- count_--;
- }
+ if (status == std::cv_status::timeout)
+ return status;
}
- count_--;
return status;
}
@@ -148,340 +143,276 @@
Return<void> notifyCapabilitiesResponse(
uint16_t id, const WifiNanStatus& status,
const ::android::hardware::wifi::V1_0::NanCapabilities& capabilities) override {
- parent_.callbackType = NOTIFY_CAPABILITIES_RESPONSE;
-
parent_.id = id;
parent_.status = status;
parent_.capabilities = capabilities;
- parent_.notify();
+ parent_.notify(NOTIFY_CAPABILITIES_RESPONSE);
return Void();
}
Return<void> notifyCapabilitiesResponse_1_5(
uint16_t id, const WifiNanStatus& status,
const ::android::hardware::wifi::V1_5::NanCapabilities& capabilities) override {
- parent_.callbackType = NOTIFY_CAPABILITIES_RESPONSE_1_5;
-
parent_.id = id;
parent_.status = status;
parent_.capabilities_1_5 = capabilities;
- parent_.notify();
+ parent_.notify(NOTIFY_CAPABILITIES_RESPONSE_1_5);
return Void();
}
Return<void> notifyEnableResponse(uint16_t id, const WifiNanStatus& status) override {
- parent_.callbackType = NOTIFY_ENABLE_RESPONSE;
-
parent_.id = id;
parent_.status = status;
- parent_.notify();
+ parent_.notify(NOTIFY_ENABLE_RESPONSE);
return Void();
}
Return<void> notifyConfigResponse(uint16_t id, const WifiNanStatus& status) override {
- parent_.callbackType = NOTIFY_CONFIG_RESPONSE;
-
parent_.id = id;
parent_.status = status;
- parent_.notify();
+ parent_.notify(NOTIFY_CONFIG_RESPONSE);
return Void();
}
Return<void> notifyDisableResponse(uint16_t id, const WifiNanStatus& status) override {
- parent_.callbackType = NOTIFY_DISABLE_RESPONSE;
-
parent_.id = id;
parent_.status = status;
- parent_.notify();
+ parent_.notify(NOTIFY_DISABLE_RESPONSE);
return Void();
}
Return<void> notifyStartPublishResponse(uint16_t id, const WifiNanStatus& status,
uint8_t sessionId) override {
- parent_.callbackType = NOTIFY_START_PUBLISH_RESPONSE;
-
parent_.id = id;
parent_.status = status;
parent_.sessionId = sessionId;
- parent_.notify();
+ parent_.notify(NOTIFY_START_PUBLISH_RESPONSE);
return Void();
}
Return<void> notifyStopPublishResponse(uint16_t id, const WifiNanStatus& status) override {
- parent_.callbackType = NOTIFY_STOP_PUBLISH_RESPONSE;
-
parent_.id = id;
parent_.status = status;
- parent_.notify();
+ parent_.notify(NOTIFY_STOP_PUBLISH_RESPONSE);
return Void();
}
Return<void> notifyStartSubscribeResponse(uint16_t id, const WifiNanStatus& status,
uint8_t sessionId) override {
- parent_.callbackType = NOTIFY_START_SUBSCRIBE_RESPONSE;
-
parent_.id = id;
parent_.status = status;
parent_.sessionId = sessionId;
- parent_.notify();
+ parent_.notify(NOTIFY_START_SUBSCRIBE_RESPONSE);
return Void();
}
Return<void> notifyStopSubscribeResponse(uint16_t id,
const WifiNanStatus& status) override {
- parent_.callbackType = NOTIFY_STOP_SUBSCRIBE_RESPONSE;
-
parent_.id = id;
parent_.status = status;
- parent_.notify();
+ parent_.notify(NOTIFY_STOP_SUBSCRIBE_RESPONSE);
return Void();
}
Return<void> notifyTransmitFollowupResponse(uint16_t id,
const WifiNanStatus& status) override {
- parent_.callbackType = NOTIFY_TRANSMIT_FOLLOWUP_RESPONSE;
-
parent_.id = id;
parent_.status = status;
- parent_.notify();
+ parent_.notify(NOTIFY_TRANSMIT_FOLLOWUP_RESPONSE);
return Void();
}
Return<void> notifyCreateDataInterfaceResponse(uint16_t id,
const WifiNanStatus& status) override {
- parent_.callbackType = NOTIFY_CREATE_DATA_INTERFACE_RESPONSE;
-
parent_.id = id;
parent_.status = status;
- parent_.notify();
+ parent_.notify(NOTIFY_CREATE_DATA_INTERFACE_RESPONSE);
return Void();
}
Return<void> notifyDeleteDataInterfaceResponse(uint16_t id,
const WifiNanStatus& status) override {
- parent_.callbackType = NOTIFY_DELETE_DATA_INTERFACE_RESPONSE;
-
parent_.id = id;
parent_.status = status;
- parent_.notify();
+ parent_.notify(NOTIFY_DELETE_DATA_INTERFACE_RESPONSE);
return Void();
}
Return<void> notifyInitiateDataPathResponse(uint16_t id, const WifiNanStatus& status,
uint32_t ndpInstanceId) override {
- parent_.callbackType = NOTIFY_INITIATE_DATA_PATH_RESPONSE;
-
parent_.id = id;
parent_.status = status;
parent_.ndpInstanceId = ndpInstanceId;
- parent_.notify();
+ parent_.notify(NOTIFY_INITIATE_DATA_PATH_RESPONSE);
return Void();
}
Return<void> notifyRespondToDataPathIndicationResponse(
uint16_t id, const WifiNanStatus& status) override {
- parent_.callbackType = NOTIFY_RESPOND_TO_DATA_PATH_INDICATION_RESPONSE;
-
parent_.id = id;
parent_.status = status;
- parent_.notify();
+ parent_.notify(NOTIFY_RESPOND_TO_DATA_PATH_INDICATION_RESPONSE);
return Void();
}
Return<void> notifyTerminateDataPathResponse(uint16_t id,
const WifiNanStatus& status) override {
- parent_.callbackType = NOTIFY_TERMINATE_DATA_PATH_RESPONSE;
-
parent_.id = id;
parent_.status = status;
- parent_.notify();
+ parent_.notify(NOTIFY_TERMINATE_DATA_PATH_RESPONSE);
return Void();
}
Return<void> eventClusterEvent(const NanClusterEventInd& event) override {
- parent_.callbackType = EVENT_CLUSTER_EVENT;
-
parent_.nanClusterEventInd = event;
- parent_.notify();
+ parent_.notify(EVENT_CLUSTER_EVENT);
return Void();
}
Return<void> eventDisabled(const WifiNanStatus& status) override {
- parent_.callbackType = EVENT_DISABLED;
-
parent_.status = status;
- parent_.notify();
+ parent_.notify(EVENT_DISABLED);
return Void();
}
Return<void> eventPublishTerminated(uint8_t sessionId,
const WifiNanStatus& status) override {
- parent_.callbackType = EVENT_PUBLISH_TERMINATED;
-
parent_.sessionId = sessionId;
parent_.status = status;
- parent_.notify();
+ parent_.notify(EVENT_PUBLISH_TERMINATED);
return Void();
}
Return<void> eventSubscribeTerminated(uint8_t sessionId,
const WifiNanStatus& status) override {
- parent_.callbackType = EVENT_SUBSCRIBE_TERMINATED;
-
parent_.sessionId = sessionId;
parent_.status = status;
- parent_.notify();
+ parent_.notify(EVENT_SUBSCRIBE_TERMINATED);
return Void();
}
Return<void> eventMatch(
const ::android::hardware::wifi::V1_0::NanMatchInd& event) override {
- parent_.callbackType = EVENT_MATCH;
-
parent_.nanMatchInd = event;
- parent_.notify();
+ parent_.notify(EVENT_MATCH);
return Void();
}
Return<void> eventMatchExpired(uint8_t discoverySessionId, uint32_t peerId) override {
- parent_.callbackType = EVENT_MATCH_EXPIRED;
-
parent_.sessionId = discoverySessionId;
parent_.peerId = peerId;
- parent_.notify();
+ parent_.notify(EVENT_MATCH_EXPIRED);
return Void();
}
Return<void> eventFollowupReceived(const NanFollowupReceivedInd& event) override {
- parent_.callbackType = EVENT_FOLLOWUP_RECEIVED;
-
parent_.nanFollowupReceivedInd = event;
- parent_.notify();
+ parent_.notify(EVENT_FOLLOWUP_RECEIVED);
return Void();
}
Return<void> eventTransmitFollowup(uint16_t id, const WifiNanStatus& status) override {
- parent_.callbackType = EVENT_TRANSMIT_FOLLOWUP;
-
parent_.id = id;
parent_.status = status;
- parent_.notify();
+ parent_.notify(EVENT_TRANSMIT_FOLLOWUP);
return Void();
}
Return<void> eventDataPathRequest(const NanDataPathRequestInd& event) override {
- parent_.callbackType = EVENT_DATA_PATH_REQUEST;
-
parent_.nanDataPathRequestInd = event;
- parent_.notify();
+ parent_.notify(EVENT_DATA_PATH_REQUEST);
return Void();
}
Return<void> eventDataPathConfirm(
const ::android::hardware::wifi::V1_0::NanDataPathConfirmInd& event) override {
- parent_.callbackType = EVENT_DATA_PATH_CONFIRM;
-
parent_.nanDataPathConfirmInd = event;
- parent_.notify();
+ parent_.notify(EVENT_DATA_PATH_CONFIRM);
return Void();
}
Return<void> eventDataPathTerminated(uint32_t ndpInstanceId) override {
- parent_.callbackType = EVENT_DATA_PATH_TERMINATED;
-
parent_.ndpInstanceId = ndpInstanceId;
- parent_.notify();
+ parent_.notify(EVENT_DATA_PATH_TERMINATED);
return Void();
}
Return<void> eventDataPathConfirm_1_2(
const ::android::hardware::wifi::V1_2::NanDataPathConfirmInd& event) override {
- parent_.callbackType = EVENT_DATA_PATH_CONFIRM_1_2;
-
parent_.nanDataPathConfirmInd_1_2 = event;
- parent_.notify();
+ parent_.notify(EVENT_DATA_PATH_CONFIRM_1_2);
return Void();
}
Return<void> eventDataPathScheduleUpdate(
const ::android::hardware::wifi::V1_2::NanDataPathScheduleUpdateInd& event)
override {
- parent_.callbackType = EVENT_DATA_PATH_SCHEDULE_UPDATE;
-
parent_.nanDataPathScheduleUpdateInd_1_2 = event;
- parent_.notify();
+ parent_.notify(EVENT_DATA_PATH_SCHEDULE_UPDATE);
return Void();
}
Return<void> eventMatch_1_6(
const ::android::hardware::wifi::V1_6::NanMatchInd& event) override {
- parent_.callbackType = EVENT_MATCH_1_6;
-
parent_.nanMatchInd_1_6 = event;
- parent_.notify();
+ parent_.notify(EVENT_MATCH_1_6);
return Void();
}
Return<void> notifyCapabilitiesResponse_1_6(
uint16_t id, const WifiNanStatus& status,
const ::android::hardware::wifi::V1_6::NanCapabilities& capabilities) override {
- parent_.callbackType = NOTIFY_CAPABILITIES_RESPONSE_1_6;
-
parent_.id = id;
parent_.status = status;
parent_.capabilities_1_6 = capabilities;
- parent_.notify();
+ parent_.notify(NOTIFY_CAPABILITIES_RESPONSE_1_6);
return Void();
}
Return<void> eventDataPathScheduleUpdate_1_6(
const ::android::hardware::wifi::V1_6::NanDataPathScheduleUpdateInd& event)
override {
- parent_.callbackType = EVENT_DATA_PATH_SCHEDULE_UPDATE_1_6;
-
parent_.nanDataPathScheduleUpdateInd_1_6 = event;
- parent_.notify();
+ parent_.notify(EVENT_DATA_PATH_SCHEDULE_UPDATE_1_6);
return Void();
}
Return<void> eventDataPathConfirm_1_6(
const ::android::hardware::wifi::V1_6::NanDataPathConfirmInd& event) override {
- parent_.callbackType = EVENT_DATA_PATH_CONFIRM_1_6;
-
parent_.nanDataPathConfirmInd_1_6 = event;
- parent_.notify();
+ parent_.notify(EVENT_DATA_PATH_CONFIRM_1_6);
return Void();
}
};
@@ -490,7 +421,6 @@
// synchronization objects
std::mutex mtx_;
std::condition_variable cv_;
- int count_ = 0;
protected:
android::sp<::android::hardware::wifi::V1_6::IWifiNanIface> iwifiNanIface;
@@ -498,7 +428,7 @@
// Data from IWifiNanIfaceEventCallback callbacks: this is the collection of
// all arguments to all callbacks. They are set by the callback
// (notifications or events) and can be retrieved by tests.
- CallbackType callbackType;
+ uint32_t callbackEventBitMap;
uint16_t id;
WifiNanStatus status;
uint8_t sessionId;
@@ -535,7 +465,7 @@
*/
TEST_P(WifiNanIfaceHidlTest, enableRequest_1_6InvalidArgs) {
uint16_t inputCmdId = 10;
- callbackType = INVALID;
+ callbackEventBitMap = INVALID;
::android::hardware::wifi::V1_4::NanEnableRequest nanEnableRequest = {};
::android::hardware::wifi::V1_6::NanConfigRequestSupplemental nanConfigRequestSupp = {};
const auto& halStatus = HIDL_INVOKE(iwifiNanIface, enableRequest_1_6, inputCmdId,
@@ -545,7 +475,7 @@
// wait for a callback
ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_ENABLE_RESPONSE));
- ASSERT_EQ(NOTIFY_ENABLE_RESPONSE, callbackType);
+ ASSERT_EQ(0x1 << NOTIFY_ENABLE_RESPONSE, callbackEventBitMap & (0x1 << NOTIFY_ENABLE_RESPONSE));
ASSERT_EQ(id, inputCmdId);
ASSERT_EQ(status.status, NanStatusType::INVALID_ARGS);
}
@@ -572,7 +502,7 @@
*/
TEST_P(WifiNanIfaceHidlTest, configRequest_1_6InvalidArgs) {
uint16_t inputCmdId = 10;
- callbackType = INVALID;
+ callbackEventBitMap = INVALID;
::android::hardware::wifi::V1_4::NanConfigRequest nanConfigRequest = {};
::android::hardware::wifi::V1_6::NanConfigRequestSupplemental nanConfigRequestSupp = {};
const auto& halStatus = HIDL_INVOKE(iwifiNanIface, configRequest_1_6, inputCmdId,
@@ -583,7 +513,7 @@
// wait for a callback
ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_CONFIG_RESPONSE));
- ASSERT_EQ(NOTIFY_CONFIG_RESPONSE, callbackType);
+ ASSERT_EQ(0x1 << NOTIFY_CONFIG_RESPONSE, callbackEventBitMap & (0x1 << NOTIFY_CONFIG_RESPONSE));
ASSERT_EQ(id, inputCmdId);
ASSERT_EQ(status.status, NanStatusType::INVALID_ARGS);
}
@@ -610,12 +540,12 @@
*/
TEST_P(WifiNanIfaceHidlTest, notifyCapabilitiesResponse_1_6) {
uint16_t inputCmdId = 10;
- callbackType = INVALID;
+ callbackEventBitMap = INVALID;
const auto& halStatus = HIDL_INVOKE(iwifiNanIface, getCapabilitiesRequest_1_5, inputCmdId).code;
ASSERT_EQ(WifiStatusCode::SUCCESS, halStatus);
// wait for a callback
ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_CAPABILITIES_RESPONSE_1_6));
- ASSERT_EQ(NOTIFY_CAPABILITIES_RESPONSE_1_6, callbackType);
+ ASSERT_EQ(0x1 << NOTIFY_CAPABILITIES_RESPONSE_1_6, callbackEventBitMap & (0x1 << NOTIFY_CAPABILITIES_RESPONSE_1_6));
ASSERT_EQ(id, inputCmdId);
ASSERT_EQ(status.status, NanStatusType::SUCCESS);
@@ -711,7 +641,7 @@
nanConfigRequestSupp.V1_5.V1_2.numberOfSpatialStreamsInDiscovery = 0;
nanConfigRequestSupp.V1_5.V1_2.enableDiscoveryWindowEarlyTermination = false;
- callbackType = INVALID;
+ callbackEventBitMap = INVALID;
const auto& halStatus =
HIDL_INVOKE(iwifiNanIface, enableRequest_1_6, inputCmdId, req, nanConfigRequestSupp);
@@ -720,7 +650,7 @@
// wait for a callback
ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_ENABLE_RESPONSE));
- ASSERT_EQ(NOTIFY_ENABLE_RESPONSE, callbackType);
+ ASSERT_EQ(0x1 << NOTIFY_ENABLE_RESPONSE, callbackEventBitMap & (0x1 << NOTIFY_ENABLE_RESPONSE));
ASSERT_EQ(id, inputCmdId);
ASSERT_EQ(status.status, NanStatusType::SUCCESS);
}
@@ -749,7 +679,7 @@
// wait for a callback
ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_START_PUBLISH_RESPONSE));
- ASSERT_EQ(NOTIFY_START_PUBLISH_RESPONSE, callbackType);
+ ASSERT_EQ(0x1 << NOTIFY_START_PUBLISH_RESPONSE, callbackEventBitMap & (0x1 << NOTIFY_START_PUBLISH_RESPONSE));
ASSERT_EQ(id, inputCmdId + 1);
ASSERT_EQ(status.status, NanStatusType::SUCCESS);
}
@@ -760,7 +690,7 @@
*/
TEST_P(WifiNanIfaceHidlTest, respondToDataPathIndicationRequest_1_6ShimInvalidArgs) {
uint16_t inputCmdId = 10;
- callbackType = INVALID;
+ callbackEventBitMap = INVALID;
::android::hardware::wifi::V1_6::NanRespondToDataPathIndicationRequest
nanRespondToDataPathIndicationRequest = {};
nanRespondToDataPathIndicationRequest.ifaceName = "AwareinterfaceNameTooLong";
@@ -777,7 +707,7 @@
*/
TEST_P(WifiNanIfaceHidlTest, initiateDataPathRequest_1_6ShimInvalidArgs) {
uint16_t inputCmdId = 10;
- callbackType = INVALID;
+ callbackEventBitMap = INVALID;
::android::hardware::wifi::V1_6::NanInitiateDataPathRequest nanInitiateDataPathRequest = {};
nanInitiateDataPathRequest.ifaceName = "AwareinterfaceNameTooLong";
const auto& halStatus = HIDL_INVOKE(iwifiNanIface, initiateDataPathRequest_1_6, inputCmdId,