Merge "DynamicsProcessing: Update the Limiter post gain test" into main
diff --git a/audio/aidl/default/alsa/StreamAlsa.cpp b/audio/aidl/default/alsa/StreamAlsa.cpp
index 114c4c0..210c26b 100644
--- a/audio/aidl/default/alsa/StreamAlsa.cpp
+++ b/audio/aidl/default/alsa/StreamAlsa.cpp
@@ -280,13 +280,22 @@
const size_t bufferSize = mBufferSizeFrames * mFrameSizeBytes;
std::vector<char> buffer(bufferSize);
while (mIoThreadIsRunning) {
- ssize_t framesRead = mSources[idx]->read(&buffer[0], mBufferSizeFrames);
- if (framesRead > 0) {
+ ssize_t framesReadOrError = mSources[idx]->read(&buffer[0], mBufferSizeFrames);
+ if (framesReadOrError > 0) {
int ret = proxy_write_with_retries(mAlsaDeviceProxies[idx].get(), &buffer[0],
- framesRead * mFrameSizeBytes, mReadWriteRetries);
+ framesReadOrError * mFrameSizeBytes,
+ mReadWriteRetries);
// Errors when the stream is being stopped are expected.
LOG_IF(WARNING, ret != 0 && mIoThreadIsRunning)
<< __func__ << "[" << idx << "]: Error writing into ALSA: " << ret;
+ } else if (framesReadOrError == 0) {
+ // MonoPipeReader does not have a blocking read, while use of std::condition_variable
+ // requires use of a mutex. For now, just do a 1ms sleep. Consider using a different
+ // pipe / ring buffer mechanism.
+ if (mIoThreadIsRunning) usleep(1000);
+ } else {
+ LOG(WARNING) << __func__ << "[" << idx
+ << "]: Error while reading from the pipe: " << framesReadOrError;
}
}
}
diff --git a/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp b/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp
index cef0ea6..f8ead16 100644
--- a/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp
+++ b/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp
@@ -283,6 +283,15 @@
}
return ::android::OK;
}
+ // get and hold the sink because 'MonoPipeReader' does not hold a strong pointer to it.
+ sp<MonoPipe> sink = mCurrentRoute->getSink();
+ if (sink == nullptr) {
+ if (++mReadErrorCount < kMaxErrorLogs) {
+ LOG(ERROR) << __func__
+ << ": the sink has been released! (not all errors will be logged)";
+ }
+ return ::android::OK;
+ }
mReadErrorCount = 0;
LOG(VERBOSE) << __func__ << ": " << mDeviceAddress.toString() << ", " << frameCount
diff --git a/audio/aidl/vts/TestUtils.h b/audio/aidl/vts/TestUtils.h
index 3a6c137..9ebdc6e 100644
--- a/audio/aidl/vts/TestUtils.h
+++ b/audio/aidl/vts/TestUtils.h
@@ -124,3 +124,30 @@
EXPECT_PRED_FORMAT2( \
::android::hardware::audio::common::testing::detail::assertResultOrUnknownTransaction, \
expected, ret)
+
+namespace android::hardware::audio::common::testing::detail {
+
+template <typename>
+struct mf_traits {};
+template <class T, class U>
+struct mf_traits<U T::*> {
+ using member_type = U;
+};
+
+} // namespace android::hardware::audio::common::testing::detail
+
+namespace aidl::android::media::audio::common {
+
+template <typename P>
+std::enable_if_t<std::is_function_v<typename ::android::hardware::audio::common::testing::detail::
+ mf_traits<decltype(&P::toString)>::member_type>,
+ std::ostream&>
+operator<<(std::ostream& os, const P& p) {
+ return os << p.toString();
+}
+template <typename E>
+std::enable_if_t<std::is_enum_v<E>, std::ostream&> operator<<(std::ostream& os, const E& e) {
+ return os << toString(e);
+}
+
+} // namespace aidl::android::media::audio::common
diff --git a/audio/aidl/vts/VtsHalAudioCoreConfigTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreConfigTargetTest.cpp
index eaec88b..7b15e5e 100644
--- a/audio/aidl/vts/VtsHalAudioCoreConfigTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioCoreConfigTargetTest.cpp
@@ -341,7 +341,7 @@
auto values = criterionV2.values;
auto valueIt = find_if(values.begin(), values.end(),
[&](const auto& typedValue) { return typedValue == value; });
- EXPECT_NE(valueIt, values.end());
+ EXPECT_NE(valueIt, values.end()) << "Not found: \"" << value << "\"";
}
/**
diff --git a/audio/policy/1.0/vts/functional/Android.bp b/audio/policy/1.0/vts/functional/Android.bp
index c2335e4..ccdd771 100644
--- a/audio/policy/1.0/vts/functional/Android.bp
+++ b/audio/policy/1.0/vts/functional/Android.bp
@@ -10,6 +10,11 @@
cc_test {
name: "VtsHalAudioPolicyV1_0TargetTest",
+ defaults: [
+ "latest_android_hardware_audio_common_ndk_static",
+ "latest_android_hardware_audio_core_ndk_static",
+ "latest_android_media_audio_common_types_ndk_static",
+ ],
srcs: [
"ValidateEngineConfiguration.cpp",
],
@@ -17,6 +22,7 @@
"libxml2",
"liblog",
"libmedia_helper",
+ "libaidlvintf_gtest_helper",
"libaudiopolicycapengine_config",
"libaudiopolicycomponents",
"libaudiopolicyengine_config",
@@ -33,6 +39,8 @@
],
shared_libs: [
"libaudiofoundation",
+ "libbinder_ndk",
+ "libvintf",
],
// Use test_config for vts suite.
// TODO(b/146104851): Add auto-gen rules and remove it.
diff --git a/audio/policy/1.0/vts/functional/ValidateEngineConfiguration.cpp b/audio/policy/1.0/vts/functional/ValidateEngineConfiguration.cpp
index 5741fa9..0472174 100644
--- a/audio/policy/1.0/vts/functional/ValidateEngineConfiguration.cpp
+++ b/audio/policy/1.0/vts/functional/ValidateEngineConfiguration.cpp
@@ -16,6 +16,9 @@
#include <EngineConfig.h>
#include <ParameterManagerWrapper.h>
+#include <aidl/Vintf.h>
+#include <aidl/android/hardware/audio/core/IConfig.h>
+#include <android/binder_manager.h>
#include <gtest/gtest.h>
@@ -34,12 +37,30 @@
static const std::string configurableConfig =
"parameter-framework/ParameterFrameworkConfigurationPolicy.xml";
+static bool deviceUsesAidlHal() {
+ using aidl::android::hardware::audio::core::IConfig;
+
+ const auto configName = android::getAidlHalInstanceNames(IConfig::descriptor);
+ if (!configName.empty()) {
+ ndk::SpAIBinder binder =
+ ndk::SpAIBinder(AServiceManager_waitForService(configName[0].c_str()));
+ if (binder != nullptr) {
+ std::shared_ptr<IConfig> configItf = IConfig::fromBinder(binder);
+ return configItf != nullptr;
+ }
+ }
+ return false;
+}
+
/**
* @brief TEST to ensure the audio policy engine configuration file is validating schemas.
* Note: this configuration file is not mandatory, an hardcoded fallback is provided, so
* it does not fail if not found.
*/
TEST(ValidateConfiguration, audioPolicyEngineConfiguration) {
+ if (deviceUsesAidlHal()) {
+ GTEST_SKIP() << "Device uses AIDL HAL, n-op.";
+ }
RecordProperty("description",
"Verify that the audio policy engine configuration file "
"is valid according to the schemas");
@@ -48,11 +69,12 @@
}
/**
- * @brief deviceUsesConfigurableEngine checks if the configuration file for
- * the engine presents on the device AND
- * for the configurable engine (aka Parameter-Framework top configuration file) presents.
+ * @brief deviceUsesHidlConfigurableEngine checks if there is no AIDL HAL,
+ * AND the configuration file for the engine presents on the device
+ * AND for the configurable engine (aka Parameter-Framework top configuration file) presents.
*/
-static bool deviceUsesConfigurableEngine() {
+static bool deviceUsesHidlConfigurableEngine() {
+ if (deviceUsesAidlHal()) return false;
return android::hardware::audio::common::test::utility::validateXmlMultipleLocations<true>(
"", "", "", config.c_str(), android::audio_get_configuration_paths(),
schema.c_str()) &&
@@ -62,8 +84,8 @@
}
TEST(ValidateConfiguration, audioPolicyEngineConfigurable) {
- if (!deviceUsesConfigurableEngine()) {
- GTEST_SKIP() << "Device using legacy engine without parameter-framework, n-op.";
+ if (!deviceUsesHidlConfigurableEngine()) {
+ GTEST_SKIP() << "Device uses AIDL HAL or legacy engine without parameter-framework, n-op.";
}
RecordProperty("description",
"Verify that the audio policy engine PFW configuration files "
@@ -78,7 +100,8 @@
ASSERT_EQ(result.nbSkippedElement, 0) << "skipped %zu elements " << result.nbSkippedElement;
std::unique_ptr<android::audio_policy::ParameterManagerWrapper> policyParameterMgr(
- new android::audio_policy::ParameterManagerWrapper(validateSchema, schemasUri));
+ new android::audio_policy::ParameterManagerWrapper(
+ true /*useLegacyConfigurationFile*/, validateSchema, schemasUri));
ASSERT_NE(nullptr, policyParameterMgr) << "failed to create Audio Policy Engine PFW";
// Load the criterion types and criteria
diff --git a/biometrics/fingerprint/aidl/default/main.cpp b/biometrics/fingerprint/aidl/default/main.cpp
index 8ca44d6..bf3f38e 100644
--- a/biometrics/fingerprint/aidl/default/main.cpp
+++ b/biometrics/fingerprint/aidl/default/main.cpp
@@ -39,8 +39,6 @@
if (strcmp(argv[1], "default") == 0) {
const std::string instance = std::string(Fingerprint::descriptor) + "/default";
auto binder = hal->asBinder();
- auto binder_ext = hal_vhal->asBinder();
- CHECK(STATUS_OK == AIBinder_setExtension(binder.get(), binder_ext.get()));
binder_status_t status =
AServiceManager_registerLazyService(binder.get(), instance.c_str());
CHECK_EQ(status, STATUS_OK);
diff --git a/bluetooth/aidl/default/net_bluetooth_mgmt.cpp b/bluetooth/aidl/default/net_bluetooth_mgmt.cpp
index 24693ef..6b0cd63 100644
--- a/bluetooth/aidl/default/net_bluetooth_mgmt.cpp
+++ b/bluetooth/aidl/default/net_bluetooth_mgmt.cpp
@@ -259,8 +259,8 @@
int NetBluetoothMgmt::openHci(int hci_interface) {
ALOGI("opening hci interface %d", hci_interface);
- // Block Bluetooth.
- rfkill(1);
+ // Unblock Bluetooth.
+ rfkill(0);
// Wait for the HCI interface to complete initialization or to come online.
int hci = waitHciDev(hci_interface);
@@ -300,8 +300,8 @@
bt_fd_ = -1;
}
- // Unblock Bluetooth.
- rfkill(0);
+ // Block Bluetooth.
+ rfkill(1);
}
} // namespace aidl::android::hardware::bluetooth::impl
diff --git a/bluetooth/ranging/aidl/default/BluetoothChannelSounding.cpp b/bluetooth/ranging/aidl/default/BluetoothChannelSounding.cpp
index e2a8693..4aba874 100644
--- a/bluetooth/ranging/aidl/default/BluetoothChannelSounding.cpp
+++ b/bluetooth/ranging/aidl/default/BluetoothChannelSounding.cpp
@@ -58,7 +58,8 @@
ndk::ScopedAStatus BluetoothChannelSounding::getSupportedCsSecurityLevels(
std::vector<CsSecurityLevel>* _aidl_return) {
- std::vector<CsSecurityLevel> supported_security_levels = {};
+ std::vector<CsSecurityLevel> supported_security_levels = {
+ CsSecurityLevel::NOT_SUPPORTED};
*_aidl_return = supported_security_levels;
return ::ndk::ScopedAStatus::ok();
}
diff --git a/nfc/aidl/vts/functional/VtsNfcBehaviorChangesTest.cpp b/nfc/aidl/vts/functional/VtsNfcBehaviorChangesTest.cpp
index a0c9436..6db7e14 100644
--- a/nfc/aidl/vts/functional/VtsNfcBehaviorChangesTest.cpp
+++ b/nfc/aidl/vts/functional/VtsNfcBehaviorChangesTest.cpp
@@ -46,6 +46,7 @@
static SyncEvent sNfaEnableDisablePollingEvent;
static SyncEvent sNfaPowerChangeEvent;
static std::vector<uint8_t> sCaps(0);
+static uint8_t sObserveModeState;
static bool sIsNfaEnabled;
static tNFA_STATUS sVSCmdStatus;
@@ -145,6 +146,13 @@
case NCI_MSG_PROP_ANDROID: {
uint8_t android_sub_opcode = p_param[3];
switch (android_sub_opcode) {
+ case NCI_QUERY_ANDROID_PASSIVE_OBSERVE: {
+ sObserveModeState = p_param[5];
+ LOG(INFO) << StringPrintf("Query observe mode state response is %x",
+ sObserveModeState);
+ SyncEventGuard guard(sNfaVsCommand);
+ sNfaVsCommand.notifyOne();
+ } break;
case NCI_ANDROID_SET_PASSIVE_OBSERVER_TECH:
case NCI_ANDROID_PASSIVE_OBSERVE: {
if (param_len == 5) {
@@ -212,6 +220,26 @@
}
/*
+ * Get observe mode state.
+ */
+tNFA_STATUS static nfaQueryObserveModeState() {
+ tNFA_STATUS status = NFA_STATUS_FAILED;
+
+ uint8_t cmd[] = {NCI_QUERY_ANDROID_PASSIVE_OBSERVE};
+
+ status = NFA_SendVsCommand(NCI_MSG_PROP_ANDROID, sizeof(cmd), cmd, nfaVSCallback);
+
+ if (status == NFA_STATUS_OK) {
+ if (!sNfaVsCommand.wait(1000)) {
+ LOG(WARNING) << "Timeout waiting for query observe mode response";
+ return NFA_STATUS_TIMEOUT;
+ }
+ }
+
+ return status;
+}
+
+/*
* Enable per-technology observe mode.
*/
tNFA_STATUS static nfaSetPassiveObserverTech(uint8_t tech_mask) {
@@ -223,7 +251,7 @@
if (status == NFA_STATUS_OK) {
if (!sNfaVsCommand.wait(SET_PASSIVE_OBSERVER_TECH_TIMEOUT_MS)) {
- LOG(WARNING) << "Timeout waiting for set observer tech command response";
+ LOG(WARNING) << "Timeout waiting for set observer tech response";
return NFA_STATUS_TIMEOUT;
}
}
@@ -235,7 +263,6 @@
* Get chipset capabilities.
*/
tNFA_STATUS static nfaGetCaps() {
- LOG(ERROR) << "getting caps";
tNFA_STATUS status = NFA_STATUS_FAILED;
uint8_t cmd[] = {NCI_ANDROID_GET_CAPS};
@@ -309,8 +336,16 @@
tNFA_STATUS status = nfaObserveModeEnable(true);
ASSERT_EQ(status, NFA_STATUS_OK);
+ status = nfaQueryObserveModeState();
+ ASSERT_EQ(status, NFA_STATUS_OK);
+ ASSERT_NE(sObserveModeState, 0);
+
status = nfaObserveModeEnable(false);
ASSERT_EQ(status, NFA_STATUS_OK);
+
+ status = nfaQueryObserveModeState();
+ ASSERT_EQ(status, NFA_STATUS_OK);
+ ASSERT_EQ(sObserveModeState, 0);
}
/*
@@ -331,15 +366,27 @@
status = nfaSetPassiveObserverTech(NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_A);
ASSERT_EQ(status, NFA_STATUS_OK);
+ status = nfaQueryObserveModeState();
+ ASSERT_EQ(status, NFA_STATUS_OK);
+ ASSERT_EQ(sObserveModeState, NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_A);
status = nfaSetPassiveObserverTech(NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_B);
ASSERT_EQ(status, NFA_STATUS_OK);
+ status = nfaQueryObserveModeState();
+ ASSERT_EQ(status, NFA_STATUS_OK);
+ ASSERT_EQ(sObserveModeState, NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_B);
status = nfaSetPassiveObserverTech(NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_V);
ASSERT_EQ(status, NFA_STATUS_OK);
+ status = nfaQueryObserveModeState();
+ ASSERT_EQ(status, NFA_STATUS_OK);
+ ASSERT_EQ(sObserveModeState, NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_V);
status = nfaSetPassiveObserverTech(NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_F);
ASSERT_EQ(status, NFA_STATUS_OK);
+ status = nfaQueryObserveModeState();
+ ASSERT_EQ(status, NFA_STATUS_OK);
+ ASSERT_EQ(sObserveModeState, NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_F);
}
/*
@@ -357,6 +404,11 @@
NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_B |
NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_V);
ASSERT_EQ(status, NFA_STATUS_OK);
+ status = nfaQueryObserveModeState();
+ ASSERT_EQ(status, NFA_STATUS_OK);
+ ASSERT_EQ(sObserveModeState, NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_A |
+ NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_B |
+ NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_V);
}
/*
@@ -366,16 +418,41 @@
* @VsrTest = GMS-VSR-3.2.8-002
*/
TEST_P(NfcBehaviorChanges, SetPassiveObserverTech_allOnAndOff) {
- LOG(ERROR) << "starting new test";
if (get_vsr_api_level() < 202504) {
GTEST_SKIP() << "Skipping test for board API level < 202504";
}
tNFC_STATUS status = nfaSetPassiveObserverTech(0x0F);
ASSERT_EQ(status, NFA_STATUS_OK);
+ status = nfaQueryObserveModeState();
+ ASSERT_EQ(status, NFA_STATUS_OK);
+ ASSERT_EQ(sObserveModeState, 0x0F);
status = nfaSetPassiveObserverTech(0x00);
ASSERT_EQ(status, NFA_STATUS_OK);
+ status = nfaQueryObserveModeState();
+ ASSERT_EQ(status, NFA_STATUS_OK);
+ ASSERT_EQ(sObserveModeState, 0x00);
+}
+
+/*
+ * SetPassiveObserverTech_testThroughput:
+ * Verifies observe mode can be enabled and disabled repeatedly without timing out or erroring.
+ *
+ * @VsrTest = GMS-VSR-3.2.8-002
+ */
+TEST_P(NfcBehaviorChanges, SetPassiveObserverTech_testThroughput) {
+ if (get_vsr_api_level() < 202504) {
+ GTEST_SKIP() << "Skipping test for board API level < 202504";
+ }
+
+ for (int i = 0; i < 100; ++i) {
+ tNFC_STATUS status = nfaSetPassiveObserverTech(0x0F);
+ ASSERT_EQ(status, NFA_STATUS_OK);
+
+ status = nfaSetPassiveObserverTech(0x00);
+ ASSERT_EQ(status, NFA_STATUS_OK);
+ }
}
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(NfcBehaviorChanges);