Merge "Add the 'UNSUPPORTED' security level for the default ranging aidl service." 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/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);