diff options
61 files changed, 764 insertions, 579 deletions
diff --git a/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp index 505c54c1df..95564e010b 100644 --- a/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp +++ b/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp @@ -687,7 +687,12 @@ class PcmOnlyConfigInputStreamTest : public InputStreamTest { InputStreamTest::TearDown(); } - bool canQueryCapturePosition() const { return !xsd::isTelephonyDevice(address.deviceType); } + bool canQueryCapturePosition() const { + // See b/263305254 and b/259636577. Must use the device initially passed in + // as a parameter, not 'address' which gets adjusted during test setup for + // the telephony case. + return !xsd::isTelephonyDevice(getAttachedDeviceAddress().deviceType); + } void createPatchIfNeeded() { if (areAudioPatchesSupported()) { diff --git a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h index e46e5b4f52..478482d412 100644 --- a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h +++ b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h @@ -1014,9 +1014,8 @@ class StreamWriter : public StreamWorker<StreamWriter> { if (mDataPosition == 0) mOnDataStart(); const size_t dataSize = std::min(mData.size() - mDataPosition, mDataMQ->availableToWrite()); bool success = mDataMQ->write(mData.data() + mDataPosition, dataSize); + bool wrapped = false; ALOGE_IF(!success, "data message queue write failed"); - mDataPosition += dataSize; - if (mDataPosition >= mData.size()) mDataPosition = 0; mEfGroup->wake(static_cast<uint32_t>(MessageQueueFlagBits::NOT_EMPTY)); uint32_t efState = 0; @@ -1034,6 +1033,11 @@ class StreamWriter : public StreamWorker<StreamWriter> { ALOGE("bad write status: %d", writeStatus.retval); success = false; } + mDataPosition += writeStatus.reply.written; + if (mDataPosition >= mData.size()) { + mDataPosition = 0; + wrapped = true; + } } if (ret == -EAGAIN || ret == -EINTR) { // Spurious wakeup. This normally retries no more than once. @@ -1042,7 +1046,7 @@ class StreamWriter : public StreamWorker<StreamWriter> { ALOGE("bad wait status: %d", ret); success = false; } - if (success && mDataPosition == 0) { + if (wrapped) { success = mOnDataWrap(); } return success; @@ -1270,6 +1274,8 @@ class InputStreamTest if (!xsd::isTelephonyDevice(address.deviceType)) { metadata.source = toString(xsd::AudioSource::AUDIO_SOURCE_UNPROCESSED); metadata.channelMask = getConfig().base.channelMask; + } else { + address.deviceType = toString(xsd::AudioDevice::AUDIO_DEVICE_IN_DEFAULT); } #if MAJOR_VERSION == 7 && MINOR_VERSION >= 1 auto flagsIt = std::find(flags.begin(), flags.end(), @@ -1692,26 +1698,6 @@ TEST_P(InputStreamTest, GetInputFramesLost) { 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/audio/effect/all-versions/default/Effect.cpp b/audio/effect/all-versions/default/Effect.cpp index 87e1ab7a7d..5aecd324eb 100644 --- a/audio/effect/all-versions/default/Effect.cpp +++ b/audio/effect/all-versions/default/Effect.cpp @@ -240,16 +240,6 @@ class ProcessThread : public Thread { }; bool ProcessThread::threadLoop() { - // For a spatializer effect, we perform scheduler adjustments to reduce glitches and power. - { - effect_descriptor_t halDescriptor{}; - if ((*mEffect)->get_descriptor(mEffect, &halDescriptor) == NO_ERROR && - memcmp(&halDescriptor.type, FX_IID_SPATIALIZER, sizeof(effect_uuid_t)) == 0) { - const status_t status = scheduler::updateSpatializerPriority(gettid()); - ALOGW_IF(status != OK, "Failed to update Spatializer priority"); - } - } - // This implementation doesn't return control back to the Thread until it decides to stop, // as the Thread uses mutexes, and this can lead to priority inversion. while (!std::atomic_load_explicit(mStop, std::memory_order_acquire)) { @@ -570,6 +560,15 @@ Return<void> Effect::prepareForProcessing(prepareForProcessing_cb _hidl_cb) { return Void(); } + // For a spatializer effect, we perform scheduler adjustments to reduce glitches and power. + // We do it here instead of the ProcessThread::threadLoop to ensure that mHandle is valid. + if (effect_descriptor_t halDescriptor{}; + (*mHandle)->get_descriptor(mHandle, &halDescriptor) == NO_ERROR && + memcmp(&halDescriptor.type, FX_IID_SPATIALIZER, sizeof(effect_uuid_t)) == 0) { + const status_t status = scheduler::updateSpatializerPriority(mProcessThread->getTid()); + ALOGW_IF(status != OK, "Failed to update Spatializer priority"); + } + mStatusMQ = std::move(tempStatusMQ); _hidl_cb(Result::OK, *mStatusMQ->getDesc()); return Void(); diff --git a/audio/policy/1.0/xml/api/current.txt b/audio/policy/1.0/xml/api/current.txt index 0b77d45539..84a2b710b8 100644 --- a/audio/policy/1.0/xml/api/current.txt +++ b/audio/policy/1.0/xml/api/current.txt @@ -217,6 +217,10 @@ package audio.policy.V1_0 { enum_constant public static final audio.policy.V1_0.UsageEnumType AUDIO_USAGE_GAME; enum_constant public static final audio.policy.V1_0.UsageEnumType AUDIO_USAGE_MEDIA; enum_constant public static final audio.policy.V1_0.UsageEnumType AUDIO_USAGE_NOTIFICATION; + enum_constant public static final audio.policy.V1_0.UsageEnumType AUDIO_USAGE_NOTIFICATION_COMMUNICATION_DELAYED; + enum_constant public static final audio.policy.V1_0.UsageEnumType AUDIO_USAGE_NOTIFICATION_COMMUNICATION_INSTANT; + enum_constant public static final audio.policy.V1_0.UsageEnumType AUDIO_USAGE_NOTIFICATION_COMMUNICATION_REQUEST; + enum_constant public static final audio.policy.V1_0.UsageEnumType AUDIO_USAGE_NOTIFICATION_EVENT; enum_constant public static final audio.policy.V1_0.UsageEnumType AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE; enum_constant public static final audio.policy.V1_0.UsageEnumType AUDIO_USAGE_UNKNOWN; enum_constant public static final audio.policy.V1_0.UsageEnumType AUDIO_USAGE_VIRTUAL_SOURCE; diff --git a/audio/policy/1.0/xml/audio_policy_engine_configuration.xsd b/audio/policy/1.0/xml/audio_policy_engine_configuration.xsd index 3ce12e709b..b58a6c84fb 100644 --- a/audio/policy/1.0/xml/audio_policy_engine_configuration.xsd +++ b/audio/policy/1.0/xml/audio_policy_engine_configuration.xsd @@ -347,6 +347,11 @@ <xs:enumeration value="AUDIO_USAGE_ALARM"/> <xs:enumeration value="AUDIO_USAGE_NOTIFICATION"/> <xs:enumeration value="AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE"/> + <!-- Note: the following 3 values were deprecated in Android T (13) SDK --> + <xs:enumeration value="AUDIO_USAGE_NOTIFICATION_COMMUNICATION_REQUEST"/> + <xs:enumeration value="AUDIO_USAGE_NOTIFICATION_COMMUNICATION_INSTANT"/> + <xs:enumeration value="AUDIO_USAGE_NOTIFICATION_COMMUNICATION_DELAYED"/> + <xs:enumeration value="AUDIO_USAGE_NOTIFICATION_EVENT"/> <xs:enumeration value="AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY"/> <xs:enumeration value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE"/> <xs:enumeration value="AUDIO_USAGE_ASSISTANCE_SONIFICATION"/> diff --git a/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp b/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp index 623438f70e..9c8bfc4996 100644 --- a/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp +++ b/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp @@ -250,8 +250,7 @@ protected: // Stream configurations are found in metadata RawStreamConfig *ptr = reinterpret_cast<RawStreamConfig *>(streamCfgs.data.i32); for (unsigned offset = 0; offset < streamCfgs.count; offset += kStreamCfgSz) { - if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT && - ptr->format == HAL_PIXEL_FORMAT_RGBA_8888) { + if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT) { targetCfg.width = ptr->width; targetCfg.height = ptr->height; targetCfg.format = static_cast<PixelFormat>(ptr->format); @@ -631,29 +630,29 @@ TEST_P(EvsHidlTest, CameraToDisplayRoundTrip) { targetDisplayId = ids[0]; }); - // Request exclusive access to the first EVS display - sp<IEvsDisplay_1_1> pDisplay = pEnumerator->openDisplay_1_1(targetDisplayId); - ASSERT_NE(pDisplay, nullptr); - LOG(INFO) << "Display " << targetDisplayId << " is alreay in use."; - - // Get the display descriptor - pDisplay->getDisplayInfo_1_1([](const HwDisplayConfig& config, const HwDisplayState& state) { - ASSERT_GT(config.size(), 0); - ASSERT_GT(state.size(), 0); - - android::ui::DisplayMode* pConfig = (android::ui::DisplayMode*)config.data(); - const auto width = pConfig->resolution.getWidth(); - const auto height = pConfig->resolution.getHeight(); - LOG(INFO) << " Resolution: " << width << "x" << height; - ASSERT_GT(width, 0); - ASSERT_GT(height, 0); - - android::ui::DisplayState* pState = (android::ui::DisplayState*)state.data(); - ASSERT_NE(pState->layerStack, android::ui::INVALID_LAYER_STACK); - }); - // Test each reported camera for (auto&& cam: cameraInfo) { + // Request exclusive access to the first EVS display + sp<IEvsDisplay_1_1> pDisplay = pEnumerator->openDisplay_1_1(targetDisplayId); + ASSERT_NE(pDisplay, nullptr); + LOG(INFO) << "Display " << targetDisplayId << " is already in use."; + + // Get the display descriptor + pDisplay->getDisplayInfo_1_1([](const HwDisplayConfig& config, const HwDisplayState& state) { + ASSERT_GT(config.size(), 0); + ASSERT_GT(state.size(), 0); + + android::ui::DisplayMode* pConfig = (android::ui::DisplayMode*)config.data(); + const auto width = pConfig->resolution.getWidth(); + const auto height = pConfig->resolution.getHeight(); + LOG(INFO) << " Resolution: " << width << "x" << height; + ASSERT_GT(width, 0); + ASSERT_GT(height, 0); + + android::ui::DisplayState* pState = (android::ui::DisplayState*)state.data(); + ASSERT_NE(pState->layerStack, android::ui::INVALID_LAYER_STACK); + }); + bool isLogicalCam = false; getPhysicalCameraIds(cam.v1.cameraId, isLogicalCam); if (mIsHwModule && isLogicalCam) { @@ -708,10 +707,10 @@ TEST_P(EvsHidlTest, CameraToDisplayRoundTrip) { // Explicitly release the camera pEnumerator->closeCamera(pCam); activeCameras.clear(); - } - // Explicitly release the display - pEnumerator->closeDisplay(pDisplay); + // Explicitly release the display + pEnumerator->closeDisplay(pDisplay); + } } @@ -1632,12 +1631,12 @@ TEST_P(EvsHidlTest, HighPriorityCameraClient) { // Get the camera list loadCameraList(); - // Request exclusive access to the EVS display - sp<IEvsDisplay_1_0> pDisplay = pEnumerator->openDisplay(); - ASSERT_NE(pDisplay, nullptr); - // Test each reported camera for (auto&& cam: cameraInfo) { + // Request exclusive access to the EVS display + sp<IEvsDisplay_1_0> pDisplay = pEnumerator->openDisplay(); + ASSERT_NE(pDisplay, nullptr); + // Read a target resolution from the metadata Stream targetCfg = getFirstStreamConfiguration(reinterpret_cast<camera_metadata_t*>(cam.metadata.data())); @@ -1979,10 +1978,9 @@ TEST_P(EvsHidlTest, HighPriorityCameraClient) { pEnumerator->closeCamera(pCam1); activeCameras.clear(); + // Explicitly release the display + pEnumerator->closeDisplay(pDisplay); } - - // Explicitly release the display - pEnumerator->closeDisplay(pDisplay); } @@ -1998,12 +1996,12 @@ TEST_P(EvsHidlTest, CameraUseStreamConfigToDisplay) { // Get the camera list loadCameraList(); - // Request exclusive access to the EVS display - sp<IEvsDisplay_1_0> pDisplay = pEnumerator->openDisplay(); - ASSERT_NE(pDisplay, nullptr); - // Test each reported camera for (auto&& cam: cameraInfo) { + // Request exclusive access to the EVS display + sp<IEvsDisplay_1_0> pDisplay = pEnumerator->openDisplay(); + ASSERT_NE(pDisplay, nullptr); + // choose a configuration that has a frame rate faster than minReqFps. Stream targetCfg = {}; const int32_t minReqFps = 15; @@ -2017,13 +2015,12 @@ TEST_P(EvsHidlTest, CameraUseStreamConfigToDisplay) { // Stream configurations are found in metadata RawStreamConfig *ptr = reinterpret_cast<RawStreamConfig *>(streamCfgs.data.i32); for (unsigned offset = 0; offset < streamCfgs.count; offset += kStreamCfgSz) { - if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT && - ptr->format == HAL_PIXEL_FORMAT_RGBA_8888) { - + if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT) { if (ptr->width * ptr->height > maxArea && ptr->framerate >= minReqFps) { targetCfg.width = ptr->width; targetCfg.height = ptr->height; + targetCfg.format = static_cast<PixelFormat>(ptr->format); maxArea = ptr->width * ptr->height; foundCfg = true; @@ -2032,8 +2029,6 @@ TEST_P(EvsHidlTest, CameraUseStreamConfigToDisplay) { ++ptr; } } - targetCfg.format = - static_cast<PixelFormat>(HAL_PIXEL_FORMAT_RGBA_8888); if (!foundCfg) { // Current EVS camera does not provide stream configurations in the @@ -2082,10 +2077,10 @@ TEST_P(EvsHidlTest, CameraUseStreamConfigToDisplay) { // Explicitly release the camera pEnumerator->closeCamera(pCam); activeCameras.clear(); - } - // Explicitly release the display - pEnumerator->closeDisplay(pDisplay); + // Explicitly release the display + pEnumerator->closeDisplay(pDisplay); + } } @@ -2120,13 +2115,12 @@ TEST_P(EvsHidlTest, MultiCameraStreamUseConfig) { // Stream configurations are found in metadata RawStreamConfig *ptr = reinterpret_cast<RawStreamConfig *>(streamCfgs.data.i32); for (unsigned offset = 0; offset < streamCfgs.count; offset += kStreamCfgSz) { - if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT && - ptr->format == HAL_PIXEL_FORMAT_RGBA_8888) { - + if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT) { if (ptr->width * ptr->height > maxArea && ptr->framerate >= minReqFps) { targetCfg.width = ptr->width; targetCfg.height = ptr->height; + targetCfg.format = static_cast<PixelFormat>(ptr->format); maxArea = ptr->width * ptr->height; foundCfg = true; @@ -2135,8 +2129,6 @@ TEST_P(EvsHidlTest, MultiCameraStreamUseConfig) { ++ptr; } } - targetCfg.format = - static_cast<PixelFormat>(HAL_PIXEL_FORMAT_RGBA_8888); if (!foundCfg) { LOG(INFO) << "Device " << cam.v1.cameraId diff --git a/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp b/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp index 9c6c573174..3cab204aec 100644 --- a/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp +++ b/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp @@ -231,8 +231,7 @@ class EvsAidlTest : public ::testing::TestWithParam<std::string> { // Stream configurations are found in metadata RawStreamConfig* ptr = reinterpret_cast<RawStreamConfig*>(streamCfgs.data.i32); for (unsigned offset = 0; offset < streamCfgs.count; offset += kStreamCfgSz) { - if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT && - ptr->format == HAL_PIXEL_FORMAT_RGBA_8888) { + if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT) { targetCfg.width = ptr->width; targetCfg.height = ptr->height; targetCfg.format = static_cast<PixelFormat>(ptr->format); @@ -601,21 +600,21 @@ TEST_P(EvsAidlTest, CameraToDisplayRoundTrip) { EXPECT_GT(displayIds.size(), 0); targetDisplayId = displayIds[0]; - // Request exclusive access to the first EVS display - std::shared_ptr<IEvsDisplay> pDisplay; - ASSERT_TRUE(mEnumerator->openDisplay(targetDisplayId, &pDisplay).isOk()); - EXPECT_NE(pDisplay, nullptr); - LOG(INFO) << "Display " << static_cast<int>(targetDisplayId) << " is in use."; - - // Get the display descriptor - DisplayDesc displayDesc; - ASSERT_TRUE(pDisplay->getDisplayInfo(&displayDesc).isOk()); - LOG(INFO) << " Resolution: " << displayDesc.width << "x" << displayDesc.height; - ASSERT_GT(displayDesc.width, 0); - ASSERT_GT(displayDesc.height, 0); - // Test each reported camera for (auto&& cam : mCameraInfo) { + // Request exclusive access to the first EVS display + std::shared_ptr<IEvsDisplay> pDisplay; + ASSERT_TRUE(mEnumerator->openDisplay(targetDisplayId, &pDisplay).isOk()); + EXPECT_NE(pDisplay, nullptr); + LOG(INFO) << "Display " << static_cast<int>(targetDisplayId) << " is in use."; + + // Get the display descriptor + DisplayDesc displayDesc; + ASSERT_TRUE(pDisplay->getDisplayInfo(&displayDesc).isOk()); + LOG(INFO) << " Resolution: " << displayDesc.width << "x" << displayDesc.height; + ASSERT_GT(displayDesc.width, 0); + ASSERT_GT(displayDesc.height, 0); + bool isLogicalCam = false; getPhysicalCameraIds(cam.id, isLogicalCam); if (mIsHwModule && isLogicalCam) { @@ -669,10 +668,10 @@ TEST_P(EvsAidlTest, CameraToDisplayRoundTrip) { // Explicitly release the camera ASSERT_TRUE(mEnumerator->closeCamera(pCam).isOk()); mActiveCameras.clear(); - } - // Explicitly release the display - ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay).isOk()); + // Explicitly release the display + ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay).isOk()); + } } /* @@ -1396,20 +1395,20 @@ TEST_P(EvsAidlTest, HighPriorityCameraClient) { // Get the camera list loadCameraList(); - // Request available display IDs - uint8_t targetDisplayId = 0; - std::vector<uint8_t> displayIds; - ASSERT_TRUE(mEnumerator->getDisplayIdList(&displayIds).isOk()); - EXPECT_GT(displayIds.size(), 0); - targetDisplayId = displayIds[0]; - - // Request exclusive access to the EVS display - std::shared_ptr<IEvsDisplay> pDisplay; - ASSERT_TRUE(mEnumerator->openDisplay(targetDisplayId, &pDisplay).isOk()); - EXPECT_NE(pDisplay, nullptr); - // Test each reported camera for (auto&& cam : mCameraInfo) { + // Request available display IDs + uint8_t targetDisplayId = 0; + std::vector<uint8_t> displayIds; + ASSERT_TRUE(mEnumerator->getDisplayIdList(&displayIds).isOk()); + EXPECT_GT(displayIds.size(), 0); + targetDisplayId = displayIds[0]; + + // Request exclusive access to the EVS display + std::shared_ptr<IEvsDisplay> pDisplay; + ASSERT_TRUE(mEnumerator->openDisplay(targetDisplayId, &pDisplay).isOk()); + EXPECT_NE(pDisplay, nullptr); + // Read a target resolution from the metadata Stream targetCfg = getFirstStreamConfiguration( reinterpret_cast<camera_metadata_t*>(cam.metadata.data())); @@ -1688,10 +1687,10 @@ TEST_P(EvsAidlTest, HighPriorityCameraClient) { ASSERT_TRUE(mEnumerator->closeCamera(pCam0).isOk()); ASSERT_TRUE(mEnumerator->closeCamera(pCam1).isOk()); mActiveCameras.clear(); - } - // Explicitly release the display - ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay).isOk()); + // Explicitly release the display + ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay).isOk()); + } } /* @@ -1713,13 +1712,13 @@ TEST_P(EvsAidlTest, CameraUseStreamConfigToDisplay) { EXPECT_GT(displayIds.size(), 0); targetDisplayId = displayIds[0]; - // Request exclusive access to the EVS display - std::shared_ptr<IEvsDisplay> pDisplay; - ASSERT_TRUE(mEnumerator->openDisplay(targetDisplayId, &pDisplay).isOk()); - EXPECT_NE(pDisplay, nullptr); - // Test each reported camera for (auto&& cam : mCameraInfo) { + // Request exclusive access to the EVS display + std::shared_ptr<IEvsDisplay> pDisplay; + ASSERT_TRUE(mEnumerator->openDisplay(targetDisplayId, &pDisplay).isOk()); + EXPECT_NE(pDisplay, nullptr); + // choose a configuration that has a frame rate faster than minReqFps. Stream targetCfg = {}; const int32_t minReqFps = 15; @@ -1732,11 +1731,11 @@ TEST_P(EvsAidlTest, CameraUseStreamConfigToDisplay) { // Stream configurations are found in metadata RawStreamConfig* ptr = reinterpret_cast<RawStreamConfig*>(streamCfgs.data.i32); for (unsigned offset = 0; offset < streamCfgs.count; offset += kStreamCfgSz) { - if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT && - ptr->format == HAL_PIXEL_FORMAT_RGBA_8888) { + if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT) { if (ptr->width * ptr->height > maxArea && ptr->framerate >= minReqFps) { targetCfg.width = ptr->width; targetCfg.height = ptr->height; + targetCfg.format = static_cast<PixelFormat>(ptr->format); maxArea = ptr->width * ptr->height; foundCfg = true; @@ -1745,7 +1744,6 @@ TEST_P(EvsAidlTest, CameraUseStreamConfigToDisplay) { ++ptr; } } - targetCfg.format = static_cast<PixelFormat>(HAL_PIXEL_FORMAT_RGBA_8888); if (!foundCfg) { // Current EVS camera does not provide stream configurations in the @@ -1793,10 +1791,10 @@ TEST_P(EvsAidlTest, CameraUseStreamConfigToDisplay) { // Explicitly release the camera ASSERT_TRUE(mEnumerator->closeCamera(pCam).isOk()); mActiveCameras.clear(); - } - // Explicitly release the display - ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay).isOk()); + // Explicitly release the display + ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay).isOk()); + } } /* @@ -1829,11 +1827,11 @@ TEST_P(EvsAidlTest, MultiCameraStreamUseConfig) { // Stream configurations are found in metadata RawStreamConfig* ptr = reinterpret_cast<RawStreamConfig*>(streamCfgs.data.i32); for (unsigned offset = 0; offset < streamCfgs.count; offset += kStreamCfgSz) { - if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT && - ptr->format == HAL_PIXEL_FORMAT_RGBA_8888) { + if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT) { if (ptr->width * ptr->height > maxArea && ptr->framerate >= minReqFps) { targetCfg.width = ptr->width; targetCfg.height = ptr->height; + targetCfg.format = static_cast<PixelFormat>(ptr->format); maxArea = ptr->width * ptr->height; foundCfg = true; @@ -1842,7 +1840,6 @@ TEST_P(EvsAidlTest, MultiCameraStreamUseConfig) { ++ptr; } } - targetCfg.format = static_cast<PixelFormat>(HAL_PIXEL_FORMAT_RGBA_8888); if (!foundCfg) { LOG(INFO) << "Device " << cam.id diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index 622846a301..f023fd2063 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -167,7 +167,15 @@ const std::vector<ConfigDeclaration> kVehicleProperties = { .maxSampleRate = 10.0f, }, .initialValue = {.floatValues = {0.0f}}}, - + {.config = + { + .prop = toInt(VehicleProperty::PERF_VEHICLE_SPEED_DISPLAY), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .minSampleRate = 1.0f, + .maxSampleRate = 10.0f, + }, + .initialValue = {.floatValues = {0.0f}}}, {.config = { .prop = toInt(VehicleProperty::VEHICLE_SPEED_DISPLAY_UNITS), @@ -177,7 +185,7 @@ const std::vector<ConfigDeclaration> kVehicleProperties = { toInt(VehicleUnit::MILES_PER_HOUR), toInt(VehicleUnit::KILOMETERS_PER_HOUR)}, }, - .initialValue = {.int32Values = {toInt(VehicleUnit::KILOMETERS_PER_HOUR)}}}, + .initialValue = {.int32Values = {toInt(VehicleUnit::MILES_PER_HOUR)}}}, {.config = { @@ -1025,7 +1033,7 @@ const std::vector<ConfigDeclaration> kVehicleProperties = { .changeMode = VehiclePropertyChangeMode::ON_CHANGE, .configArray = {(int)VehicleUnit::LITER, (int)VehicleUnit::US_GALLON}, }, - .initialValue = {.int32Values = {(int)VehicleUnit::LITER}}}, + .initialValue = {.int32Values = {(int)VehicleUnit::US_GALLON}}}, {.config = { diff --git a/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.xml b/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.xml index ea7adc9159..6010c60e97 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 d64751a119..0234dc8a37 100644 --- a/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.xml +++ b/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.xml @@ -20,8 +20,13 @@ <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"> </target_preparer> - <target_preparer class="com.android.tradefed.targetprep.DeviceSetup"> - <option name="bluetooth" value="off" /> + <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="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> <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"> diff --git a/broadcastradio/2.0/vts/OWNERS b/broadcastradio/2.0/vts/OWNERS index 1ff740712c..eb030525f3 100644 --- a/broadcastradio/2.0/vts/OWNERS +++ b/broadcastradio/2.0/vts/OWNERS @@ -1,6 +1,6 @@ # Automotive team -egranata@google.com -twasilczyk@google.com +xuweilin@google.com +oscarazu@google.com # VTS team dshi@google.com diff --git a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp index 615fde0343..63e3b554dd 100644 --- a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp +++ b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp @@ -514,9 +514,48 @@ TEST_P(BroadcastRadioHalTest, DabTune) { ASSERT_TRUE(openSession()); + auto programList = getProgramList(); + + if (!programList) { + printSkipped("Empty Station-List, tune cannot be performed"); + return; + } + ProgramSelector sel = {}; - uint64_t freq = config[config.size() / 2].frequency; - sel.primaryId = make_identifier(IdentifierType::DAB_FREQUENCY,freq); + uint64_t freq = 0; + bool dabStnPresent = false; + + for (auto&& programInfo : *programList) { + if (utils::hasId(programInfo.selector, IdentifierType::DAB_FREQUENCY)) { + for (auto&& config_entry : config) { + if (config_entry.frequency == utils::getId(programInfo.selector, + IdentifierType::DAB_FREQUENCY, 0)) { + freq = config_entry.frequency; + break; + } + } + // Do not trigger a tune request if the programList entry does not contain + // a valid DAB frequency + if (freq == 0) { + continue; + } + uint64_t dabSidExt = utils::getId(programInfo.selector, IdentifierType::DAB_SID_EXT, 0); + uint64_t dabEns = utils::getId(programInfo.selector, IdentifierType::DAB_ENSEMBLE, 0); + sel.primaryId = make_identifier(IdentifierType::DAB_SID_EXT, dabSidExt); + hidl_vec<ProgramIdentifier> secondaryIds = { + make_identifier(IdentifierType::DAB_ENSEMBLE, dabEns), + make_identifier(IdentifierType::DAB_FREQUENCY, freq) + }; + sel.secondaryIds = secondaryIds; + dabStnPresent = true; + break; + } + } + + if (!dabStnPresent) { + printSkipped("No DAB stations in the list, tune cannot be performed"); + return; + } std::this_thread::sleep_for(gTuneWorkaround); diff --git a/camera/device/3.2/default/convert.cpp b/camera/device/3.2/default/convert.cpp index 628b7af912..cb64f396f2 100644 --- a/camera/device/3.2/default/convert.cpp +++ b/camera/device/3.2/default/convert.cpp @@ -16,6 +16,7 @@ #define LOG_TAG "android.hardware.camera.device@3.2-convert-impl" #include <log/log.h> +#include <system/camera_metadata.h> #include "include/convert.h" @@ -43,6 +44,13 @@ bool convertFromHidl(const CameraMetadata &src, const camera_metadata_t** dst) { ALOGE("%s: input CameraMetadata is corrupt!", __FUNCTION__); return false; } + + if (validate_camera_metadata_structure((camera_metadata_t*)data, /*expected_size=*/NULL) != + OK) { + ALOGE("%s: Failed to validate the metadata structure", __FUNCTION__); + return false; + } + *dst = (camera_metadata_t*) data; return true; } diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp index 6866776ba5..339a142251 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 @@ public: 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 @@ public: 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 @@ protected: // 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 @@ bool CameraHidlTest::DeviceCb::processCaptureResultLocked(const CaptureResult& r 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 @@ void CameraHidlTest::processCaptureRequestInternal(uint64_t bufferUsage, 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 @@ void CameraHidlTest::processCaptureRequestInternal(uint64_t bufferUsage, 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 @@ TEST_P(CameraHidlTest, processCaptureRequestBurstISO) { 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 @@ TEST_P(CameraHidlTest, switchToOffline) { 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 @@ TEST_P(CameraHidlTest, flushPreviewRequest) { 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: @@ -6318,8 +6294,6 @@ Status CameraHidlTest::getAvailableOutputStreams(const camera_metadata_t* static 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; } @@ -6345,8 +6319,12 @@ Status CameraHidlTest::getAvailableOutputStreams(const camera_metadata_t* static } 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; @@ -7425,47 +7403,6 @@ void CameraHidlTest::configurePreviewStream(const std::string &name, int32_t dev 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, @@ -7883,6 +7820,7 @@ void CameraHidlTest::verifyLogicalOrUltraHighResCameraMetadata( } } + camera_metadata_t* staticMetadata; camera_metadata_ro_entry physicalMultiResStreamConfigs; camera_metadata_ro_entry physicalStreamConfigs; camera_metadata_ro_entry physicalMaxResolutionStreamConfigs; @@ -7901,8 +7839,9 @@ void CameraHidlTest::verifyLogicalOrUltraHighResCameraMetadata( ret = subDevice->getCameraCharacteristics([&](auto status, const auto& chars) { ASSERT_EQ(Status::OK, status); - const camera_metadata_t* staticMetadata = - reinterpret_cast<const camera_metadata_t*>(chars.data()); + staticMetadata = clone_camera_metadata( + reinterpret_cast<const camera_metadata_t*>(chars.data())); + ASSERT_NE(nullptr, staticMetadata); rc = getSystemCameraKind(staticMetadata, &physSystemCameraKind); ASSERT_EQ(rc, Status::OK); // Make sure that the system camera kind of a non-hidden @@ -7936,7 +7875,9 @@ void CameraHidlTest::verifyLogicalOrUltraHighResCameraMetadata( verifyCameraCharacteristics(status, chars); verifyMonochromeCharacteristics(chars, deviceVersion); - auto staticMetadata = (const camera_metadata_t*)chars.data(); + staticMetadata = clone_camera_metadata( + reinterpret_cast<const camera_metadata_t*>(chars.data())); + ASSERT_NE(nullptr, staticMetadata); retcode = find_camera_metadata_ro_entry( staticMetadata, ANDROID_CONTROL_ZOOM_RATIO_RANGE, &entry); bool subCameraHasZoomRatioRange = (0 == retcode && entry.count == 2); @@ -8064,6 +8005,7 @@ void CameraHidlTest::verifyLogicalOrUltraHighResCameraMetadata( } } } + free_camera_metadata(staticMetadata); } // If a multi-resolution stream is supported, there must be at least one diff --git a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp index 70ab7a02b3..b764ad6299 100644 --- a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp +++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp @@ -1846,7 +1846,6 @@ TEST_P(CameraAidlTest, processUltraHighResolutionRequest) { // 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 @@ TEST_P(CameraAidlTest, process10BitDynamicRangeRequest) { // 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 @@ TEST_P(CameraAidlTest, process10BitDynamicRangeRequest) { 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 @@ TEST_P(CameraAidlTest, process10BitDynamicRangeRequest) { 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 @@ TEST_P(CameraAidlTest, process10BitDynamicRangeRequest) { { std::unique_lock<std::mutex> l(mLock); - mInflightMap[frameNumber] = inflightReq; + mInflightMap[bufferId] = inflightReq; } } @@ -1990,7 +1989,10 @@ TEST_P(CameraAidlTest, process10BitDynamicRangeRequest) { 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 && @@ -2000,6 +2002,8 @@ TEST_P(CameraAidlTest, process10BitDynamicRangeRequest) { 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 20f32bfe21..137c521c2b 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::TearDown() { } } +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; @@ -167,7 +187,7 @@ std::vector<std::string> CameraAidlTest::getCameraDeviceNames( 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; @@ -751,8 +771,6 @@ Status CameraAidlTest::getAvailableOutputStreams(const camera_metadata_t* static 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; } @@ -778,7 +796,11 @@ Status CameraAidlTest::getAvailableOutputStreams(const camera_metadata_t* static } 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); } @@ -1181,6 +1203,7 @@ void CameraAidlTest::verifyLogicalOrUltraHighResCameraMetadata( camera_metadata_ro_entry physicalMultiResStreamConfigs; camera_metadata_ro_entry physicalStreamConfigs; camera_metadata_ro_entry physicalMaxResolutionStreamConfigs; + CameraMetadata physChars; bool isUltraHighRes = false; std::unordered_set<int32_t> subCameraPrivacyTestPatterns; if (isPublicId) { @@ -1189,12 +1212,11 @@ void CameraAidlTest::verifyLogicalOrUltraHighResCameraMetadata( ASSERT_TRUE(ret.isOk()); ASSERT_NE(subDevice, nullptr); - CameraMetadata subDeviceChars; - ret = subDevice->getCameraCharacteristics(&subDeviceChars); + ret = subDevice->getCameraCharacteristics(&physChars); ASSERT_TRUE(ret.isOk()); const camera_metadata_t* staticMetadata = - reinterpret_cast<const camera_metadata_t*>(subDeviceChars.metadata.data()); + reinterpret_cast<const camera_metadata_t*>(physChars.metadata.data()); retStatus = getSystemCameraKind(staticMetadata, &physSystemCameraKind); ASSERT_EQ(retStatus, Status::OK); @@ -1215,7 +1237,6 @@ void CameraAidlTest::verifyLogicalOrUltraHighResCameraMetadata( getPrivacyTestPatternModes(staticMetadata, &subCameraPrivacyTestPatterns); } else { // Check camera characteristics for hidden camera id - CameraMetadata physChars; ndk::ScopedAStatus ret = device->getPhysicalCameraCharacteristics(physicalId, &physChars); ASSERT_TRUE(ret.isOk()); @@ -2333,6 +2354,7 @@ void CameraAidlTest::processPreviewStabilizationCaptureRequestInternal( 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) { @@ -2374,6 +2396,7 @@ void CameraAidlTest::processPreviewStabilizationCaptureRequestInternal( 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 d828cee4a8..9fa84d36d1 100644 --- a/camera/provider/aidl/vts/camera_aidl_test.h +++ b/camera/provider/aidl/vts/camera_aidl_test.h @@ -488,6 +488,9 @@ class CameraAidlTest : public ::testing::TestWithParam<std::string> { 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 4698b4ae89..ca2f904c0a 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,31 +418,19 @@ bool DeviceCb::processCaptureResultLocked( } 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; + 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), ::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. diff --git a/drm/aidl/vts/drm_hal_common.cpp b/drm/aidl/vts/drm_hal_common.cpp index 7de81670ab..f0445a503f 100644 --- a/drm/aidl/vts/drm_hal_common.cpp +++ b/drm/aidl/vts/drm_hal_common.cpp @@ -187,6 +187,12 @@ void DrmHalTest::SetUp() { 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 @@ void DrmHalTest::SetUp() { 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 @@ std::vector<uint8_t> DrmHalTest::getVendorUUID() { } 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 14b3acfc7f..847a4dc262 100644 --- a/drm/aidl/vts/drm_hal_test.cpp +++ b/drm/aidl/vts/drm_hal_test.cpp @@ -198,6 +198,18 @@ TEST_P(DrmHalTest, OfflineLicenseTest) { 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/android/hardware/gnss/IGnss.aidl b/gnss/aidl/android/hardware/gnss/IGnss.aidl index f0b583d164..aaafe7f583 100644 --- a/gnss/aidl/android/hardware/gnss/IGnss.aidl +++ b/gnss/aidl/android/hardware/gnss/IGnss.aidl @@ -104,7 +104,7 @@ interface IGnss { * * The framework calls this method to instruct the GPS engine to prepare for serving requests * from the framework. The GNSS HAL implementation must respond to all GNSS requests from the - * framework upon successful return from this method until cleanup() method is called to + * framework upon successful return from this method until close() method is called to * close this interface. * * @param callback Callback interface for IGnss. diff --git a/gnss/aidl/vts/gnss_hal_test.cpp b/gnss/aidl/vts/gnss_hal_test.cpp index 0e1218e40c..64e51c7d4a 100644 --- a/gnss/aidl/vts/gnss_hal_test.cpp +++ b/gnss/aidl/vts/gnss_hal_test.cpp @@ -107,6 +107,17 @@ void GnssHalTest::SetUpGnssCallback() { } } +void GnssHalTest::TearDown() { + GnssHalTestTemplate<IGnss_V2_1>::TearDown(); + if (aidl_gnss_hal_ != nullptr) { + aidl_gnss_hal_->close(); + aidl_gnss_hal_ = nullptr; + } + + // Set to nullptr to destruct the callback event queues and warn of any unprocessed events. + aidl_gnss_cb_ = nullptr; +} + void GnssHalTest::CheckLocation(const GnssLocation& location, bool check_speed) { Utils::checkLocation(location, check_speed, /* check_more_accuracies= */ true); } @@ -436,6 +447,7 @@ void GnssHalTest::collectMeasurementIntervals(const sp<GnssMeasurementCallbackAi 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.h b/gnss/aidl/vts/gnss_hal_test.h index 645fc824e0..c49c1b9204 100644 --- a/gnss/aidl/vts/gnss_hal_test.h +++ b/gnss/aidl/vts/gnss_hal_test.h @@ -64,6 +64,7 @@ class GnssHalTest : public android::hardware::gnss::common::GnssHalTestTemplate< virtual void SetUp() override; virtual void SetUpGnssCallback() override; + virtual void TearDown() override; void CheckLocation(const android::hardware::gnss::GnssLocation& location, const bool check_speed); diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp index 3696233d3b..c7fc32aaee 100644 --- a/gnss/aidl/vts/gnss_hal_test_cases.cpp +++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp @@ -526,6 +526,11 @@ TEST_P(GnssHalTest, TestGnssPowerIndication) { 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/gnss/common/utils/default/DeviceFileReader.cpp b/gnss/common/utils/default/DeviceFileReader.cpp index dfc086a8b8..91e75eb460 100644 --- a/gnss/common/utils/default/DeviceFileReader.cpp +++ b/gnss/common/utils/default/DeviceFileReader.cpp @@ -32,40 +32,52 @@ void DeviceFileReader::getDataFromDeviceFile(const std::string& command, int mMi return; } - int mGnssFd = open(deviceFilePath.c_str(), O_RDWR | O_NONBLOCK); - - if (mGnssFd == -1) { + int gnss_fd, epoll_fd; + if ((gnss_fd = open(deviceFilePath.c_str(), O_RDWR | O_NONBLOCK)) == -1) { + return; + } + if (write(gnss_fd, command.c_str(), command.size()) <= 0) { + close(gnss_fd); return; } - int bytes_write = write(mGnssFd, command.c_str(), command.size()); - if (bytes_write <= 0) { - close(mGnssFd); + // Create an epoll instance. + if ((epoll_fd = epoll_create1(EPOLL_CLOEXEC)) < 0) { + close(gnss_fd); return; } + // Add file descriptor to epoll instance. struct epoll_event ev, events[1]; - ev.data.fd = mGnssFd; + memset(&ev, 0, sizeof(ev)); + ev.data.fd = gnss_fd; ev.events = EPOLLIN; - int epoll_fd = epoll_create1(0); - epoll_ctl(epoll_fd, EPOLL_CTL_ADD, mGnssFd, &ev); - int bytes_read = -1; - std::string inputStr = ""; - int epoll_ret = epoll_wait(epoll_fd, events, 1, mMinIntervalMs); + if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, gnss_fd, &ev) == -1) { + close(gnss_fd); + close(epoll_fd); + return; + } - if (epoll_ret == -1) { - close(mGnssFd); + // Wait for device file event. + if (epoll_wait(epoll_fd, events, 1, mMinIntervalMs) == -1) { + close(gnss_fd); + close(epoll_fd); return; } + + // Handle event and write data to string buffer. + int bytes_read = -1; + std::string inputStr = ""; while (true) { memset(inputBuffer, 0, INPUT_BUFFER_SIZE); - bytes_read = read(mGnssFd, &inputBuffer, INPUT_BUFFER_SIZE); + bytes_read = read(gnss_fd, &inputBuffer, INPUT_BUFFER_SIZE); if (bytes_read <= 0) { break; } s_buffer_ += std::string(inputBuffer, bytes_read); } - close(mGnssFd); + close(gnss_fd); + close(epoll_fd); // Trim end of file mark(\n\n\n\n). auto pos = s_buffer_.find("\n\n\n\n"); diff --git a/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/ComposerCommandEngine.h b/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/ComposerCommandEngine.h index ab67eb10bc..9ae6173a91 100644 --- a/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/ComposerCommandEngine.h +++ b/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/ComposerCommandEngine.h @@ -207,7 +207,7 @@ class ComposerCommandEngine : protected CommandReaderBase { bool executeSetClientTarget(uint16_t length) { // 4 parameters followed by N rectangles - if ((length - 4) % 4 != 0) { + if (!length || (length - 4) % 4 != 0) { return false; } diff --git a/graphics/composer/aidl/vts/VtsComposerClient.cpp b/graphics/composer/aidl/vts/VtsComposerClient.cpp index 2b607038fe..dd4161e836 100644 --- a/graphics/composer/aidl/vts/VtsComposerClient.cpp +++ b/graphics/composer/aidl/vts/VtsComposerClient.cpp @@ -393,14 +393,31 @@ std::pair<ScopedAStatus, std::vector<VtsDisplay>> VtsComposerClient::getDisplays return {std::move(configs.first), vtsDisplays}; } for (int config : configs.second) { - auto status = updateDisplayProperties(&vtsDisplay, config); + auto status = addDisplayConfig(&vtsDisplay, config); if (!status.isOk()) { - ALOGE("Unable to get the displays for test, failed to update the properties " + ALOGE("Unable to get the displays for test, failed to add config " "for display %" PRId64, display); return {std::move(status), vtsDisplays}; } } + + auto config = getActiveConfig(display); + if (!config.first.isOk()) { + ALOGE("Unable to get the displays for test, failed to get active config " + "for display %" PRId64, display); + return {std::move(config.first), vtsDisplays}; + } + + auto status = updateDisplayProperties(&vtsDisplay, config.second); + if (!status.isOk()) { + ALOGE("Unable to get the displays for test, " + "failed to update the properties " + "for display %" PRId64, + display); + return {std::move(status), vtsDisplays}; + } + vtsDisplays.emplace_back(vtsDisplay); addDisplayToDisplayResources(display, /*isVirtual*/ false); } @@ -409,7 +426,7 @@ std::pair<ScopedAStatus, std::vector<VtsDisplay>> VtsComposerClient::getDisplays } } -ScopedAStatus VtsComposerClient::updateDisplayProperties(VtsDisplay* vtsDisplay, int32_t config) { +ScopedAStatus VtsComposerClient::addDisplayConfig(VtsDisplay* vtsDisplay, int32_t config) { const auto width = getDisplayAttribute(vtsDisplay->getDisplayId(), config, DisplayAttribute::WIDTH); const auto height = @@ -420,7 +437,6 @@ ScopedAStatus VtsComposerClient::updateDisplayProperties(VtsDisplay* vtsDisplay, getDisplayAttribute(vtsDisplay->getDisplayId(), config, DisplayAttribute::CONFIG_GROUP); if (width.first.isOk() && height.first.isOk() && vsyncPeriod.first.isOk() && configGroup.first.isOk()) { - vtsDisplay->setDimensions(width.second, height.second); vtsDisplay->addDisplayConfig(config, {vsyncPeriod.second, configGroup.second}); return ScopedAStatus::ok(); } @@ -431,6 +447,21 @@ ScopedAStatus VtsComposerClient::updateDisplayProperties(VtsDisplay* vtsDisplay, return ScopedAStatus::fromServiceSpecificError(IComposerClient::EX_BAD_CONFIG); } +ScopedAStatus VtsComposerClient::updateDisplayProperties(VtsDisplay* vtsDisplay, int32_t config) { + const auto width = + getDisplayAttribute(vtsDisplay->getDisplayId(), config, DisplayAttribute::WIDTH); + const auto height = + getDisplayAttribute(vtsDisplay->getDisplayId(), config, DisplayAttribute::HEIGHT); + if (width.first.isOk() && height.first.isOk()) { + vtsDisplay->setDimensions(width.second, height.second); + return ScopedAStatus::ok(); + } + + LOG(ERROR) << "Failed to update display property for width: " << width.first.isOk() + << ", height: " << height.first.isOk(); + return ScopedAStatus::fromServiceSpecificError(IComposerClient::EX_BAD_CONFIG); +} + ScopedAStatus VtsComposerClient::addDisplayToDisplayResources(int64_t display, bool isVirtual) { if (mDisplayResources.insert({display, DisplayResource(isVirtual)}).second) { return ScopedAStatus::ok(); @@ -488,10 +519,13 @@ bool VtsComposerClient::verifyComposerCallbackParams() { } bool VtsComposerClient::destroyAllLayers() { - for (const auto& it : mDisplayResources) { - const auto& [display, resource] = it; + std::unordered_map<int64_t, DisplayResource> physicalDisplays; + while (!mDisplayResources.empty()) { + const auto& it = mDisplayResources.begin(); + const auto& [display, resource] = *it; - for (auto layer : resource.layers) { + while (!resource.layers.empty()) { + auto layer = *resource.layers.begin(); const auto status = destroyLayer(display, layer); if (!status.isOk()) { ALOGE("Unable to destroy all the layers, failed at layer %" PRId64 " with error %s", @@ -507,8 +541,12 @@ bool VtsComposerClient::destroyAllLayers() { status.getDescription().c_str()); return false; } + } else { + auto extractIter = mDisplayResources.extract(it); + physicalDisplays.insert(std::move(extractIter)); } } + mDisplayResources.swap(physicalDisplays); mDisplayResources.clear(); return true; } diff --git a/graphics/composer/aidl/vts/VtsComposerClient.h b/graphics/composer/aidl/vts/VtsComposerClient.h index 3625c8ccfe..74c5da5dc6 100644 --- a/graphics/composer/aidl/vts/VtsComposerClient.h +++ b/graphics/composer/aidl/vts/VtsComposerClient.h @@ -173,6 +173,7 @@ class VtsComposerClient { std::pair<ScopedAStatus, std::vector<VtsDisplay>> getDisplays(); private: + ScopedAStatus addDisplayConfig(VtsDisplay* vtsDisplay, int32_t config); ScopedAStatus updateDisplayProperties(VtsDisplay* vtsDisplay, int32_t config); ScopedAStatus addDisplayToDisplayResources(int64_t display, bool isVirtual); diff --git a/graphics/mapper/3.0/utils/vts/MapperVts.cpp b/graphics/mapper/3.0/utils/vts/MapperVts.cpp index c470a4aca0..48e5736f8d 100644 --- a/graphics/mapper/3.0/utils/vts/MapperVts.cpp +++ b/graphics/mapper/3.0/utils/vts/MapperVts.cpp @@ -99,11 +99,7 @@ std::vector<const native_handle_t*> Gralloc::allocate(const BufferDescriptor& de 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 3b1bfab867..997af97807 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_P(GraphicsMapperHidlTest, LockUnlockBasic) { * 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 c6c9834eaf..d70c6ef0c9 100644 --- a/graphics/mapper/4.0/utils/vts/MapperVts.cpp +++ b/graphics/mapper/4.0/utils/vts/MapperVts.cpp @@ -111,11 +111,7 @@ std::vector<const native_handle_t*> Gralloc::allocate(const BufferDescriptor& de } 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 5a450e385a..2ec98d4cc5 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_RAW12) { } 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 f3d7c30548..4f5c121f95 100644 --- a/identity/aidl/vts/Util.cpp +++ b/identity/aidl/vts/Util.cpp @@ -523,8 +523,24 @@ void verifyAuthKeyCertificate(const vector<uint8_t>& authKeyCertChain) { 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 fb5048a2f3..728cc91f41 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 @@ TEST_P(VsrRequirementTest, Vsr13Test) { 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 index 00e9837710..d80e651bcf 100755..100644 --- 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 @@ TEST_P(StoreHidlTest, ListRoles) { } } -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 @@ TEST_P(StoreHidlTest, OmxCodecAllowedTest) { 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/neuralnetworks/1.0/vts/functional/ValidateModel.cpp b/neuralnetworks/1.0/vts/functional/ValidateModel.cpp index 5ffbd4328c..34bc962ab4 100644 --- a/neuralnetworks/1.0/vts/functional/ValidateModel.cpp +++ b/neuralnetworks/1.0/vts/functional/ValidateModel.cpp @@ -232,26 +232,24 @@ size_t sizeForBinder(const Model& model) { // currently 1Mb, which is shared by all transactions in progress // for the process." // -// Will our representation fit under this limit? There are two complications: +// Will our representation fit under this limit? There are three complications: // - Our representation size is just approximate (see sizeForBinder()). -// - This object may not be the only occupant of the Binder transaction buffer. +// - This object may not be the only occupant of the Binder transaction buffer +// (although our VTS test suite should not be putting multiple objects in the +// buffer at once). +// - IBinder.MAX_IPC_SIZE recommends limiting a transaction to 64 * 1024 bytes. // So we'll be very conservative: We want the representation size to be no -// larger than half the transaction buffer size. +// larger than half the recommended limit. // // If our representation grows large enough that it still fits within // the transaction buffer but combined with other transactions may // exceed the buffer size, then we may see intermittent HAL transport // errors. static bool exceedsBinderSizeLimit(size_t representationSize) { - // Instead of using this fixed buffer size, we might instead be able to use - // ProcessState::self()->getMmapSize(). However, this has a potential - // problem: The binder/mmap size of the current process does not necessarily - // indicate the binder/mmap size of the service (i.e., the other process). - // The only way it would be a good indication is if both the current process - // and the service use the default size. - static const size_t kHalfBufferSize = 1024 * 1024 / 2; - - return representationSize > kHalfBufferSize; + // There is no C++ API to retrieve the value of the Java variable IBinder.MAX_IPC_SIZE. + static const size_t kHalfMaxIPCSize = 64 * 1024 / 2; + + return representationSize > kHalfMaxIPCSize; } ///////////////////////// VALIDATE EXECUTION ORDER //////////////////////////// diff --git a/neuralnetworks/1.1/vts/functional/ValidateModel.cpp b/neuralnetworks/1.1/vts/functional/ValidateModel.cpp index 1f4e4eda49..dbabbaf0fc 100644 --- a/neuralnetworks/1.1/vts/functional/ValidateModel.cpp +++ b/neuralnetworks/1.1/vts/functional/ValidateModel.cpp @@ -252,26 +252,24 @@ size_t sizeForBinder(const Model& model) { // currently 1Mb, which is shared by all transactions in progress // for the process." // -// Will our representation fit under this limit? There are two complications: +// Will our representation fit under this limit? There are three complications: // - Our representation size is just approximate (see sizeForBinder()). -// - This object may not be the only occupant of the Binder transaction buffer. +// - This object may not be the only occupant of the Binder transaction buffer +// (although our VTS test suite should not be putting multiple objects in the +// buffer at once). +// - IBinder.MAX_IPC_SIZE recommends limiting a transaction to 64 * 1024 bytes. // So we'll be very conservative: We want the representation size to be no -// larger than half the transaction buffer size. +// larger than half the recommended limit. // // If our representation grows large enough that it still fits within // the transaction buffer but combined with other transactions may // exceed the buffer size, then we may see intermittent HAL transport // errors. static bool exceedsBinderSizeLimit(size_t representationSize) { - // Instead of using this fixed buffer size, we might instead be able to use - // ProcessState::self()->getMmapSize(). However, this has a potential - // problem: The binder/mmap size of the current process does not necessarily - // indicate the binder/mmap size of the service (i.e., the other process). - // The only way it would be a good indication is if both the current process - // and the service use the default size. - static const size_t kHalfBufferSize = 1024 * 1024 / 2; - - return representationSize > kHalfBufferSize; + // There is no C++ API to retrieve the value of the Java variable IBinder.MAX_IPC_SIZE. + static const size_t kHalfMaxIPCSize = 64 * 1024 / 2; + + return representationSize > kHalfMaxIPCSize; } ///////////////////////// VALIDATE EXECUTION ORDER //////////////////////////// diff --git a/neuralnetworks/1.2/vts/functional/ValidateModel.cpp b/neuralnetworks/1.2/vts/functional/ValidateModel.cpp index 3375602d27..d7cd6f5386 100644 --- a/neuralnetworks/1.2/vts/functional/ValidateModel.cpp +++ b/neuralnetworks/1.2/vts/functional/ValidateModel.cpp @@ -291,26 +291,24 @@ size_t sizeForBinder(const Model& model) { // currently 1Mb, which is shared by all transactions in progress // for the process." // -// Will our representation fit under this limit? There are two complications: +// Will our representation fit under this limit? There are three complications: // - Our representation size is just approximate (see sizeForBinder()). -// - This object may not be the only occupant of the Binder transaction buffer. +// - This object may not be the only occupant of the Binder transaction buffer +// (although our VTS test suite should not be putting multiple objects in the +// buffer at once). +// - IBinder.MAX_IPC_SIZE recommends limiting a transaction to 64 * 1024 bytes. // So we'll be very conservative: We want the representation size to be no -// larger than half the transaction buffer size. +// larger than half the recommended limit. // // If our representation grows large enough that it still fits within // the transaction buffer but combined with other transactions may // exceed the buffer size, then we may see intermittent HAL transport // errors. static bool exceedsBinderSizeLimit(size_t representationSize) { - // Instead of using this fixed buffer size, we might instead be able to use - // ProcessState::self()->getMmapSize(). However, this has a potential - // problem: The binder/mmap size of the current process does not necessarily - // indicate the binder/mmap size of the service (i.e., the other process). - // The only way it would be a good indication is if both the current process - // and the service use the default size. - static const size_t kHalfBufferSize = 1024 * 1024 / 2; - - return representationSize > kHalfBufferSize; + // There is no C++ API to retrieve the value of the Java variable IBinder.MAX_IPC_SIZE. + static const size_t kHalfMaxIPCSize = 64 * 1024 / 2; + + return representationSize > kHalfMaxIPCSize; } ///////////////////////// VALIDATE EXECUTION ORDER //////////////////////////// diff --git a/neuralnetworks/1.3/vts/functional/Android.bp b/neuralnetworks/1.3/vts/functional/Android.bp index 9fa0f0a174..07071cc47b 100644 --- a/neuralnetworks/1.3/vts/functional/Android.bp +++ b/neuralnetworks/1.3/vts/functional/Android.bp @@ -92,7 +92,6 @@ cc_test { "libneuralnetworks_headers", ], test_suites: [ - "general-tests", "vts", ], } diff --git a/neuralnetworks/1.3/vts/functional/ValidateModel.cpp b/neuralnetworks/1.3/vts/functional/ValidateModel.cpp index 849ef7bf50..d8c7cd19f8 100644 --- a/neuralnetworks/1.3/vts/functional/ValidateModel.cpp +++ b/neuralnetworks/1.3/vts/functional/ValidateModel.cpp @@ -308,26 +308,24 @@ size_t sizeForBinder(const Model& model) { // currently 1Mb, which is shared by all transactions in progress // for the process." // -// Will our representation fit under this limit? There are two complications: +// Will our representation fit under this limit? There are three complications: // - Our representation size is just approximate (see sizeForBinder()). -// - This object may not be the only occupant of the Binder transaction buffer. +// - This object may not be the only occupant of the Binder transaction buffer +// (although our VTS test suite should not be putting multiple objects in the +// buffer at once). +// - IBinder.MAX_IPC_SIZE recommends limiting a transaction to 64 * 1024 bytes. // So we'll be very conservative: We want the representation size to be no -// larger than half the transaction buffer size. +// larger than half the recommended limit. // // If our representation grows large enough that it still fits within // the transaction buffer but combined with other transactions may // exceed the buffer size, then we may see intermittent HAL transport // errors. static bool exceedsBinderSizeLimit(size_t representationSize) { - // Instead of using this fixed buffer size, we might instead be able to use - // ProcessState::self()->getMmapSize(). However, this has a potential - // problem: The binder/mmap size of the current process does not necessarily - // indicate the binder/mmap size of the service (i.e., the other process). - // The only way it would be a good indication is if both the current process - // and the service use the default size. - static const size_t kHalfBufferSize = 1024 * 1024 / 2; - - return representationSize > kHalfBufferSize; + // There is no C++ API to retrieve the value of the Java variable IBinder.MAX_IPC_SIZE. + static const size_t kHalfMaxIPCSize = 64 * 1024 / 2; + + return representationSize > kHalfMaxIPCSize; } ///////////////////////// VALIDATE EXECUTION ORDER //////////////////////////// diff --git a/neuralnetworks/aidl/vts/functional/ValidateModel.cpp b/neuralnetworks/aidl/vts/functional/ValidateModel.cpp index 060434ed08..d7baf199a5 100644 --- a/neuralnetworks/aidl/vts/functional/ValidateModel.cpp +++ b/neuralnetworks/aidl/vts/functional/ValidateModel.cpp @@ -344,26 +344,24 @@ size_t sizeForBinder(const Model& model) { // currently 1Mb, which is shared by all transactions in progress // for the process." // -// Will our representation fit under this limit? There are two complications: +// Will our representation fit under this limit? There are three complications: // - Our representation size is just approximate (see sizeForBinder()). -// - This object may not be the only occupant of the Binder transaction buffer. +// - This object may not be the only occupant of the Binder transaction buffer +// (although our VTS test suite should not be putting multiple objects in the +// buffer at once). +// - IBinder.MAX_IPC_SIZE recommends limiting a transaction to 64 * 1024 bytes. // So we'll be very conservative: We want the representation size to be no -// larger than half the transaction buffer size. +// larger than half the recommended limit. // // If our representation grows large enough that it still fits within // the transaction buffer but combined with other transactions may // exceed the buffer size, then we may see intermittent HAL transport // errors. static bool exceedsBinderSizeLimit(size_t representationSize) { - // Instead of using this fixed buffer size, we might instead be able to use - // ProcessState::self()->getMmapSize(). However, this has a potential - // problem: The binder/mmap size of the current process does not necessarily - // indicate the binder/mmap size of the service (i.e., the other process). - // The only way it would be a good indication is if both the current process - // and the service use the default size. - static const size_t kHalfBufferSize = 1024 * 1024 / 2; - - return representationSize > kHalfBufferSize; + // There is no C++ API to retrieve the value of the Java variable IBinder.MAX_IPC_SIZE. + static const size_t kHalfMaxIPCSize = 64 * 1024 / 2; + + return representationSize > kHalfMaxIPCSize; } ///////////////////////// VALIDATE EXECUTION ORDER //////////////////////////// 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 b0b984cf16..8f357a0f5c 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 @@ TEST_P(RadioHidlTest_v1_4, setPreferredNetworkTypeBitmap) { 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 152858f6a8..316c308115 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, setSystemSelectionChannels_1_5) { 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 @@ TEST_P(RadioHidlTest_v1_5, startNetworkScan) { 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_aidl_hal_utils.cpp b/radio/aidl/vts/radio_aidl_hal_utils.cpp index efc4f26dad..6ed8e7d762 100644 --- a/radio/aidl/vts/radio_aidl_hal_utils.cpp +++ b/radio/aidl/vts/radio_aidl_hal_utils.cpp @@ -92,6 +92,10 @@ bool isDsDsEnabled() { return testing::checkSubstringInCommandOutput("getprop persist.radio.multisim.config", "dsds"); } +bool isDsDaEnabled() { + return testing::checkSubstringInCommandOutput("getprop persist.radio.multisim.config", "dsda"); +} + bool isTsTsEnabled() { return testing::checkSubstringInCommandOutput("getprop persist.radio.multisim.config", "tsts"); } diff --git a/radio/aidl/vts/radio_aidl_hal_utils.h b/radio/aidl/vts/radio_aidl_hal_utils.h index 47976b9099..8170a0114b 100644 --- a/radio/aidl/vts/radio_aidl_hal_utils.h +++ b/radio/aidl/vts/radio_aidl_hal_utils.h @@ -104,6 +104,11 @@ bool isSsSsEnabled(); bool isDsDsEnabled(); /* + * Check if device is in DSDA (Dual SIM Dual Active). + */ +bool isDsDaEnabled(); + +/* * Check if device is in TSTS (Triple SIM Triple Standby). */ bool isTsTsEnabled(); diff --git a/radio/aidl/vts/radio_config_test.cpp b/radio/aidl/vts/radio_config_test.cpp index 258b172918..c979d28781 100644 --- a/radio/aidl/vts/radio_config_test.cpp +++ b/radio/aidl/vts/radio_config_test.cpp @@ -176,7 +176,7 @@ TEST_P(RadioConfigTest, setSimSlotsMapping) { slotPortMapping.physicalSlotId = -1; slotPortMapping.portId = -1; std::vector<SlotPortMapping> slotPortMappingList = {slotPortMapping}; - if (isDsDsEnabled()) { + if (isDsDsEnabled() || isDsDaEnabled()) { slotPortMappingList.push_back(slotPortMapping); } else if (isTsTsEnabled()) { slotPortMappingList.push_back(slotPortMapping); @@ -252,7 +252,7 @@ TEST_P(RadioConfigTest, checkPortInfoExistsAndPortActive) { } if (isSsSsEnabled()) { EXPECT_EQ(1, simCount); - } else if (isDsDsEnabled()) { + } else if (isDsDsEnabled() || isDsDaEnabled()) { EXPECT_EQ(2, simCount); } else if (isTsTsEnabled()) { EXPECT_EQ(3, simCount); diff --git a/radio/aidl/vts/radio_data_test.cpp b/radio/aidl/vts/radio_data_test.cpp index f38a958896..5986ff1f25 100644 --- a/radio/aidl/vts/radio_data_test.cpp +++ b/radio/aidl/vts/radio_data_test.cpp @@ -143,9 +143,21 @@ TEST_P(RadioDataTest, setupDataCall_osAppId) { 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 c83571ee0a..61b34d7db5 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -829,20 +829,20 @@ TEST_P(RadioNetworkTest, setSystemSelectionChannels) { 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 @@ TEST_P(RadioNetworkTest, startNetworkScan) { 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 ef5b0bda73..f30e29cd4c 100644 --- a/security/keymint/aidl/vts/functional/Android.bp +++ b/security/keymint/aidl/vts/functional/Android.bp @@ -31,8 +31,10 @@ cc_defaults { "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 ca517ac61c..b9968f8afc 100644 --- a/security/keymint/aidl/vts/functional/AttestKeyTest.cpp +++ b/security/keymint/aidl/vts/functional/AttestKeyTest.cpp @@ -35,7 +35,17 @@ bool IsSelfSigned(const vector<Certificate>& chain) { } // 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 @@ class AttestKeyTest : public KeyMintAidlTestBase { } 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 46db4f0c78..20c0bf580f 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 @@ void p256_pub_key(const vector<uint8_t>& coseKeyData, EVP_PKEY_Ptr* signingKey) *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 8f9df24522..7d3bc30b7b 100644 --- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h +++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h @@ -386,6 +386,7 @@ vector<uint8_t> make_name_from_str(const string& name); 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/2.1/multihal/android.hardware.sensors@2.1-service-multihal.rc b/sensors/2.1/multihal/android.hardware.sensors@2.1-service-multihal.rc index f47e060f88..0b59841730 100644 --- a/sensors/2.1/multihal/android.hardware.sensors@2.1-service-multihal.rc +++ b/sensors/2.1/multihal/android.hardware.sensors@2.1-service-multihal.rc @@ -1,7 +1,7 @@ service vendor.sensors-hal-2-1-multihal /vendor/bin/hw/android.hardware.sensors@2.1-service.multihal class hal user system - group system wakelock context_hub + group system wakelock context_hub uhid task_profiles ServiceCapacityLow capabilities BLOCK_SUSPEND rlimit rtprio 10 10 diff --git a/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp b/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp index d536e290b2..35220a2d31 100644 --- a/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp +++ b/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp @@ -98,6 +98,7 @@ static void assertTypeMatchStringType(SensorType type, const std::string& string 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 7e22b1902f..aa6e8814a2 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, CallInitializeTwice) { } 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 83f98584fb..cab5867840 100644 --- a/tv/tuner/1.0/vts/functional/DvrTests.cpp +++ b/tv/tuner/1.0/vts/functional/DvrTests.cpp @@ -203,7 +203,6 @@ bool DvrCallback::readRecordFMQ() { 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 d049b07232..fb76de7af4 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::LnbTone; 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 @@ struct TunerTestingConfigReader1_0 { break; case FrontendTypeEnum::ATSC: type = FrontendType::ATSC; + frontendMap[id].settings.atsc(readAtscFrontendSettings(feConfig)); break; case FrontendTypeEnum::ATSC3: type = FrontendType::ATSC3; @@ -627,6 +629,13 @@ struct TunerTestingConfigReader1_0 { 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.0/vts/functional/wifi_hidl_test_utils.cpp b/wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp index e6e61cf8b7..02f8209e5b 100644 --- a/wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp +++ b/wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp @@ -66,7 +66,7 @@ bool findAnyModeSupportingIfaceType( bool configureChipToSupportIfaceTypeInternal(const sp<IWifiChip>& wifi_chip, IfaceType type, ChipModeId* configured_mode_id) { - if (!configured_mode_id) { + if (!configured_mode_id || !wifi_chip.get()) { return false; } const auto& status_and_modes = HIDL_INVOKE(wifi_chip, getAvailableModes); diff --git a/wifi/1.4/vts/functional/wifi_hidl_test_utils_1_4.h b/wifi/1.4/vts/functional/wifi_hidl_test_utils_1_4.h index a2c58154a1..ca7b57a47c 100644 --- a/wifi/1.4/vts/functional/wifi_hidl_test_utils_1_4.h +++ b/wifi/1.4/vts/functional/wifi_hidl_test_utils_1_4.h @@ -28,6 +28,6 @@ // These helper functions should be modified to return vectors if we support // multiple instances. android::sp<android::hardware::wifi::V1_4::IWifiChip> getWifiChip_1_4( - const std::string& instance_name); + const std::string& instance_name); android::sp<android::hardware::wifi::V1_4::IWifiApIface> getWifiApIface_1_4( - const std::string& instance_name); + const std::string& instance_name); 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 7bcc6d3a06..37c55e75df 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 @@ class WifiNanIfaceHidlTest : public ::testing::TestWithParam<std::string> { 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 @@ class WifiNanIfaceHidlTest : public ::testing::TestWithParam<std::string> { 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 @@ class WifiNanIfaceHidlTest : public ::testing::TestWithParam<std::string> { 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 @@ class WifiNanIfaceHidlTest : public ::testing::TestWithParam<std::string> { 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 @@ class WifiNanIfaceHidlTest : public ::testing::TestWithParam<std::string> { // 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 @@ class WifiNanIfaceHidlTest : public ::testing::TestWithParam<std::string> { // 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, Create) { */ 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 @@ TEST_P(WifiNanIfaceHidlTest, enableRequest_1_6InvalidArgs) { // 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, enableRequest_1_6ShimInvalidArgs) { */ 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 @@ TEST_P(WifiNanIfaceHidlTest, configRequest_1_6InvalidArgs) { // 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, configRequest_1_6ShimInvalidArgs) { */ 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 @@ TEST_P(WifiNanIfaceHidlTest, startPublishRequest_1_6) { 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 @@ TEST_P(WifiNanIfaceHidlTest, startPublishRequest_1_6) { // 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 @@ TEST_P(WifiNanIfaceHidlTest, startPublishRequest_1_6) { // 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, startPublishRequest_1_6) { */ 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, respondToDataPathIndicationRequest_1_6ShimInvalidAr */ 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, diff --git a/wifi/hostapd/1.2/vts/functional/hostapd_hidl_test.cpp b/wifi/hostapd/1.2/vts/functional/hostapd_hidl_test.cpp index 2fade4dc6b..5c59819e82 100644 --- a/wifi/hostapd/1.2/vts/functional/hostapd_hidl_test.cpp +++ b/wifi/hostapd/1.2/vts/functional/hostapd_hidl_test.cpp @@ -122,7 +122,8 @@ class HostapdHidlTest IHostapd::IfaceParams getIfaceParamsWithAcs(std::string iface_name) { // First get the settings for WithoutAcs and then make changes - IHostapd::IfaceParams iface_params_1_2 = getIfaceParamsWithoutAcs(iface_name); + IHostapd::IfaceParams iface_params_1_2 = + getIfaceParamsWithoutAcs(iface_name); iface_params_1_2.V1_1.V1_0.channelParams.enableAcs = true; iface_params_1_2.V1_1.V1_0.channelParams.acsShouldExcludeDfs = true; iface_params_1_2.V1_1.V1_0.channelParams.channel = 0; @@ -132,8 +133,10 @@ class HostapdHidlTest return iface_params_1_2; } - IHostapd::IfaceParams getIfaceParamsWithAcsAndFreqRange(std::string iface_name) { - IHostapd::IfaceParams iface_params_1_2 = getIfaceParamsWithAcs(iface_name); + IHostapd::IfaceParams getIfaceParamsWithAcsAndFreqRange( + std::string iface_name) { + IHostapd::IfaceParams iface_params_1_2 = + getIfaceParamsWithAcs(iface_name); ::android::hardware::wifi::hostapd::V1_2::IHostapd::AcsFrequencyRange acsFrequencyRange; acsFrequencyRange.start = 2412; @@ -147,8 +150,10 @@ class HostapdHidlTest return iface_params_1_2; } - IHostapd::IfaceParams getIfaceParamsWithAcsAndInvalidFreqRange(std::string iface_name) { - IHostapd::IfaceParams iface_params_1_2 = getIfaceParamsWithAcsAndFreqRange(iface_name); + IHostapd::IfaceParams getIfaceParamsWithAcsAndInvalidFreqRange( + std::string iface_name) { + IHostapd::IfaceParams iface_params_1_2 = + getIfaceParamsWithAcsAndFreqRange(iface_name); iface_params_1_2.channelParams.acsChannelFreqRangesMhz[0].start = 222; iface_params_1_2.channelParams.acsChannelFreqRangesMhz[0].end = 999; return iface_params_1_2; @@ -210,8 +215,10 @@ class HostapdHidlTest return nw_params_1_2; } - IHostapd::IfaceParams getIfaceParamsWithInvalidChannel(std::string iface_name) { - IHostapd::IfaceParams iface_params_1_2 = getIfaceParamsWithoutAcs(iface_name); + IHostapd::IfaceParams getIfaceParamsWithInvalidChannel( + std::string iface_name) { + IHostapd::IfaceParams iface_params_1_2 = + getIfaceParamsWithoutAcs(iface_name); iface_params_1_2.V1_1.V1_0.channelParams.channel = kIfaceInvalidChannel; return iface_params_1_2; } @@ -237,8 +244,8 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithAcs(ifname), - getPskNwParams()); + auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, + getIfaceParamsWithAcs(ifname), getPskNwParams()); EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code); } @@ -252,7 +259,8 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndFreqRange) { GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, - getIfaceParamsWithAcsAndFreqRange(ifname), getPskNwParams()); + getIfaceParamsWithAcsAndFreqRange(ifname), + getPskNwParams()); EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code); } @@ -266,7 +274,8 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndInvalidFreqRange) { GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, - getIfaceParamsWithAcsAndInvalidFreqRange(ifname), getPskNwParams()); + getIfaceParamsWithAcsAndInvalidFreqRange(ifname), + getPskNwParams()); EXPECT_NE(HostapdStatusCode::SUCCESS, status.code); } @@ -279,8 +288,8 @@ TEST_P(HostapdHidlTest, AddOpenAccessPointWithAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithAcs(ifname), - getOpenNwParams()); + auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, + getIfaceParamsWithAcs(ifname), getOpenNwParams()); EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code); } @@ -292,8 +301,9 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithoutAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), - getPskNwParams()); + auto status = + HIDL_INVOKE(hostapd_, addAccessPoint_1_2, + getIfaceParamsWithoutAcs(ifname), getPskNwParams()); EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code); } @@ -305,8 +315,9 @@ TEST_P(HostapdHidlTest, AddOpenAccessPointWithoutAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), - getOpenNwParams()); + auto status = + HIDL_INVOKE(hostapd_, addAccessPoint_1_2, + getIfaceParamsWithoutAcs(ifname), getOpenNwParams()); EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code); } @@ -319,7 +330,8 @@ TEST_P(HostapdHidlTest, AddSaeTransitionAccessPointWithoutAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), + auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, + getIfaceParamsWithoutAcs(ifname), getSaeTransitionNwParams()); EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code); } @@ -333,8 +345,9 @@ TEST_P(HostapdHidlTest, AddSAEAccessPointWithoutAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), - getSaeNwParams()); + auto status = + HIDL_INVOKE(hostapd_, addAccessPoint_1_2, + getIfaceParamsWithoutAcs(ifname), getSaeNwParams()); EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code); } @@ -347,8 +360,9 @@ TEST_P(HostapdHidlTest, RemoveAccessPointWithAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status_1_2 = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithAcs(ifname), - getPskNwParams()); + auto status_1_2 = + HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithAcs(ifname), + getPskNwParams()); EXPECT_EQ(HostapdStatusCode::SUCCESS, status_1_2.code); auto status = HIDL_INVOKE(hostapd_, removeAccessPoint, ifname); EXPECT_EQ( @@ -364,8 +378,9 @@ TEST_P(HostapdHidlTest, RemoveAccessPointWithoutAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status_1_2 = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), - getPskNwParams()); + auto status_1_2 = + HIDL_INVOKE(hostapd_, addAccessPoint_1_2, + getIfaceParamsWithoutAcs(ifname), getPskNwParams()); EXPECT_EQ(HostapdStatusCode::SUCCESS, status_1_2.code); auto status = HIDL_INVOKE(hostapd_, removeAccessPoint, ifname); EXPECT_EQ( @@ -381,8 +396,9 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithInvalidChannel) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, - getIfaceParamsWithInvalidChannel(ifname), getPskNwParams()); + auto status = + HIDL_INVOKE(hostapd_, addAccessPoint_1_2, + getIfaceParamsWithInvalidChannel(ifname), getPskNwParams()); EXPECT_NE(HostapdStatusCode::SUCCESS, status.code); } @@ -394,8 +410,9 @@ TEST_P(HostapdHidlTest, AddInvalidPskAccessPointWithoutAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), - getInvalidPskNwParams()); + auto status = + HIDL_INVOKE(hostapd_, addAccessPoint_1_2, + getIfaceParamsWithoutAcs(ifname), getInvalidPskNwParams()); EXPECT_NE(HostapdStatusCode::SUCCESS, status.code); } @@ -408,7 +425,8 @@ TEST_P(HostapdHidlTest, AddInvalidSaeTransitionAccessPointWithoutAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), + auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, + getIfaceParamsWithoutAcs(ifname), getInvalidSaeTransitionNwParams()); EXPECT_NE(HostapdStatusCode::SUCCESS, status.code); } @@ -422,8 +440,9 @@ TEST_P(HostapdHidlTest, AddInvalidSaeAccessPointWithoutAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), - getInvalidSaeNwParams()); + auto status = + HIDL_INVOKE(hostapd_, addAccessPoint_1_2, + getIfaceParamsWithoutAcs(ifname), getInvalidSaeNwParams()); EXPECT_NE(HostapdStatusCode::SUCCESS, status.code); } @@ -433,8 +452,8 @@ TEST_P(HostapdHidlTest, AddInvalidSaeAccessPointWithoutAcs) { */ TEST_P(HostapdHidlTest, DisconnectClientWhenIfaceNotAvailable) { std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status = HIDL_INVOKE(hostapd_, forceClientDisconnect, ifname, kTestZeroMacAddr, - kTestDisconnectReasonCode); + auto status = HIDL_INVOKE(hostapd_, forceClientDisconnect, ifname, + kTestZeroMacAddr, kTestDisconnectReasonCode); EXPECT_EQ(HostapdStatusCode::FAILURE_IFACE_UNKNOWN, status.code); } @@ -446,12 +465,13 @@ TEST_P(HostapdHidlTest, DisconnectClientWhenIfacAvailable) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status_1_2 = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), - getOpenNwParams()); + auto status_1_2 = + HIDL_INVOKE(hostapd_, addAccessPoint_1_2, + getIfaceParamsWithoutAcs(ifname), getOpenNwParams()); EXPECT_EQ(HostapdStatusCode::SUCCESS, status_1_2.code); - status_1_2 = HIDL_INVOKE(hostapd_, forceClientDisconnect, ifname, kTestZeroMacAddr, - kTestDisconnectReasonCode); + status_1_2 = HIDL_INVOKE(hostapd_, forceClientDisconnect, ifname, + kTestZeroMacAddr, kTestDisconnectReasonCode); EXPECT_EQ(HostapdStatusCode::FAILURE_CLIENT_UNKNOWN, status_1_2.code); } |