Merge "Fixing code style for changes added to expand Tuner HAL VTS Dyanmic Configuration"
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 dfc2386..44d3cbd 100644
--- a/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp
+++ b/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp
@@ -14,6 +14,9 @@
* limitations under the License.
*/
+#include <fstream>
+#include <numeric>
+
#include <android-base/chrono_utils.h>
#include "Generators.h"
@@ -517,20 +520,10 @@
}
bool canQueryPresentationPosition() const {
- auto maybeSinkAddress =
- getCachedPolicyConfig().getSinkDeviceForMixPort(getDeviceName(), getMixPortName());
- // Returning 'true' when no sink is found so the test can fail later with a more clear
- // problem description.
- return !maybeSinkAddress.has_value() ||
- !xsd::isTelephonyDevice(maybeSinkAddress.value().deviceType);
+ return !xsd::isTelephonyDevice(address.deviceType);
}
void createPatchIfNeeded() {
- auto maybeSinkAddress =
- getCachedPolicyConfig().getSinkDeviceForMixPort(getDeviceName(), getMixPortName());
- ASSERT_TRUE(maybeSinkAddress.has_value())
- << "No sink device found for mix port " << getMixPortName() << " (module "
- << getDeviceName() << ")";
if (areAudioPatchesSupported()) {
AudioPortConfig source;
source.base.format.value(getConfig().base.format);
@@ -540,13 +533,13 @@
source.ext.mix().ioHandle = helper.getIoHandle();
source.ext.mix().useCase.stream({});
AudioPortConfig sink;
- sink.ext.device(maybeSinkAddress.value());
+ sink.ext.device(address);
EXPECT_OK(getDevice()->createAudioPatch(hidl_vec<AudioPortConfig>{source},
hidl_vec<AudioPortConfig>{sink},
returnIn(res, mPatchHandle)));
mHasPatch = res == Result::OK;
} else {
- EXPECT_OK(stream->setDevices({maybeSinkAddress.value()}));
+ EXPECT_OK(stream->setDevices({address}));
}
}
@@ -556,10 +549,6 @@
EXPECT_OK(getDevice()->releaseAudioPatch(mPatchHandle));
mHasPatch = false;
}
- } else {
- if (stream) {
- EXPECT_OK(stream->setDevices({address}));
- }
}
}
@@ -575,16 +564,22 @@
// Sometimes HAL doesn't have enough information until the audio data actually gets
// consumed by the hardware.
bool timedOut = false;
- res = Result::INVALID_STATE;
- for (android::base::Timer elapsed;
- res != Result::OK && !writer.hasError() &&
- !(timedOut = (elapsed.duration() >= kPositionChangeTimeout));) {
- usleep(kWriteDurationUs);
- ASSERT_OK(stream->getPresentationPosition(returnIn(res, framesInitial, ts)));
- ASSERT_RESULT(okOrInvalidState, res);
+ if (!firstPosition || *firstPosition == std::numeric_limits<uint64_t>::max()) {
+ res = Result::INVALID_STATE;
+ for (android::base::Timer elapsed;
+ res != Result::OK && !writer.hasError() &&
+ !(timedOut = (elapsed.duration() >= kPositionChangeTimeout));) {
+ usleep(kWriteDurationUs);
+ ASSERT_OK(stream->getPresentationPosition(returnIn(res, framesInitial, ts)));
+ ASSERT_RESULT(okOrInvalidState, res);
+ }
+ ASSERT_FALSE(writer.hasError());
+ ASSERT_FALSE(timedOut);
+ } else {
+ // Use `firstPosition` instead of querying it from the HAL. This is used when
+ // `waitForPresentationPositionAdvance` is called in a loop.
+ framesInitial = *firstPosition;
}
- ASSERT_FALSE(writer.hasError());
- ASSERT_FALSE(timedOut);
uint64_t frames = framesInitial;
for (android::base::Timer elapsed;
@@ -646,7 +641,7 @@
ASSERT_OK(stream->standby());
writer.resume();
- uint64_t frames;
+ uint64_t frames = std::numeric_limits<uint64_t>::max();
ASSERT_NO_FATAL_FAILURE(waitForPresentationPositionAdvance(writer, &frames));
EXPECT_GT(frames, framesInitial);
@@ -691,24 +686,12 @@
InputStreamTest::TearDown();
}
- bool canQueryCapturePosition() const {
- auto maybeSourceAddress = getCachedPolicyConfig().getSourceDeviceForMixPort(
- getDeviceName(), getMixPortName());
- // Returning 'true' when no source is found so the test can fail later with a more clear
- // problem description.
- return !maybeSourceAddress.has_value() ||
- !xsd::isTelephonyDevice(maybeSourceAddress.value().deviceType);
- }
+ bool canQueryCapturePosition() const { return !xsd::isTelephonyDevice(address.deviceType); }
void createPatchIfNeeded() {
- auto maybeSourceAddress = getCachedPolicyConfig().getSourceDeviceForMixPort(
- getDeviceName(), getMixPortName());
- ASSERT_TRUE(maybeSourceAddress.has_value())
- << "No source device found for mix port " << getMixPortName() << " (module "
- << getDeviceName() << ")";
if (areAudioPatchesSupported()) {
AudioPortConfig source;
- source.ext.device(maybeSourceAddress.value());
+ source.ext.device(address);
AudioPortConfig sink;
sink.base.format.value(getConfig().base.format);
sink.base.sampleRateHz.value(getConfig().base.sampleRateHz);
@@ -721,20 +704,14 @@
returnIn(res, mPatchHandle)));
mHasPatch = res == Result::OK;
} else {
- EXPECT_OK(stream->setDevices({maybeSourceAddress.value()}));
+ EXPECT_OK(stream->setDevices({address}));
}
}
void releasePatchIfNeeded() {
- if (getDevice()) {
- if (areAudioPatchesSupported() && mHasPatch) {
- EXPECT_OK(getDevice()->releaseAudioPatch(mPatchHandle));
- mHasPatch = false;
- }
- } else {
- if (stream) {
- EXPECT_OK(stream->setDevices({address}));
- }
+ if (getDevice() && areAudioPatchesSupported() && mHasPatch) {
+ EXPECT_OK(getDevice()->releaseAudioPatch(mPatchHandle));
+ mHasPatch = false;
}
}
@@ -864,14 +841,8 @@
}
ASSERT_OK(res);
- auto maybeSourceAddress =
- getCachedPolicyConfig().getSourceDeviceForMixPort(getDeviceName(), getMixPortName());
- ASSERT_TRUE(maybeSourceAddress.has_value())
- << "No source device found for mix port " << getMixPortName() << " (module "
- << getDeviceName() << ")";
-
for (auto microphone : microphones) {
- if (microphone.deviceAddress == maybeSourceAddress.value()) {
+ if (microphone.deviceAddress == address) {
StreamReader reader(stream.get(), stream->getBufferSize());
ASSERT_TRUE(reader.start());
reader.pause(); // This ensures that at least one read has happened.
@@ -889,3 +860,100 @@
::testing::ValuesIn(getBuiltinMicConfigParameters()),
&DeviceConfigParameterToString);
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(MicrophoneInfoInputStreamTest);
+
+static const std::vector<DeviceConfigParameter>& getOutputDeviceCompressedConfigParameters(
+ const AudioConfigBase& configToMatch) {
+ static const std::vector<DeviceConfigParameter> parameters = [&] {
+ auto allParams = getOutputDeviceConfigParameters();
+ std::vector<DeviceConfigParameter> compressedParams;
+ std::copy_if(allParams.begin(), allParams.end(), std::back_inserter(compressedParams),
+ [&](auto cfg) {
+ if (std::get<PARAM_CONFIG>(cfg).base != configToMatch) return false;
+ const auto& flags = std::get<PARAM_FLAGS>(cfg);
+ return std::find_if(flags.begin(), flags.end(), [](const auto& flag) {
+ return flag ==
+ toString(xsd::AudioInOutFlag::
+ AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD);
+ }) != flags.end();
+ });
+ return compressedParams;
+ }();
+ return parameters;
+}
+
+class CompressedOffloadOutputStreamTest : public PcmOnlyConfigOutputStreamTest {
+ public:
+ void loadData(const std::string& fileName, std::vector<uint8_t>* data) {
+ std::ifstream is(fileName, std::ios::in | std::ios::binary);
+ ASSERT_TRUE(is.good()) << "Failed to open file " << fileName;
+ is.seekg(0, is.end);
+ data->reserve(data->size() + is.tellg());
+ is.seekg(0, is.beg);
+ data->insert(data->end(), std::istreambuf_iterator<char>(is),
+ std::istreambuf_iterator<char>());
+ ASSERT_TRUE(!is.fail()) << "Failed to read from file " << fileName;
+ }
+};
+
+TEST_P(CompressedOffloadOutputStreamTest, Mp3FormatGaplessOffload) {
+ doc::test("Check that compressed offload mix ports for MP3 implement gapless offload");
+ const auto& flags = getOutputFlags();
+ if (std::find_if(flags.begin(), flags.end(), [](const auto& flag) {
+ return flag == toString(xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_GAPLESS_OFFLOAD);
+ }) == flags.end()) {
+ GTEST_SKIP() << "Compressed offload mix port does not support gapless offload";
+ }
+ // FIXME: The presentation position is not updated if there is no zero padding in data.
+ std::vector<uint8_t> offloadData(stream->getBufferSize());
+ ASSERT_NO_FATAL_FAILURE(loadData("/data/local/tmp/sine882hz3s.mp3", &offloadData));
+ ASSERT_FALSE(offloadData.empty());
+ ASSERT_NO_FATAL_FAILURE(createPatchIfNeeded());
+ const int presentationeEndPrecisionMs = 1000;
+ const int sampleRate = 44100;
+ const int significantSampleNumber = (presentationeEndPrecisionMs * sampleRate) / 1000;
+ const int delay = 576 + 1000;
+ const int padding = 756 + 1000;
+ const int durationMs = 3000 - 44;
+ // StreamWriter plays 'offloadData' in a loop, possibly using multiple calls to 'write',
+ // this depends on the relative sizes of 'offloadData' and the HAL buffer. Writer calls
+ // 'onDataWrap' callback each time it wraps around the buffer.
+ StreamWriter writer(
+ stream.get(), stream->getBufferSize(), std::move(offloadData), [&]() /* onDataWrap */ {
+ Parameters::set(stream,
+ {{AUDIO_OFFLOAD_CODEC_DELAY_SAMPLES, std::to_string(delay)},
+ {AUDIO_OFFLOAD_CODEC_PADDING_SAMPLES, std::to_string(padding)}});
+ stream->drain(AudioDrain::EARLY_NOTIFY);
+ });
+ ASSERT_TRUE(writer.start());
+ ASSERT_TRUE(writer.waitForAtLeastOneCycle());
+ // Decrease the volume since the test plays a loud sine wave.
+ ASSERT_OK(stream->setVolume(0.1, 0.1));
+ // How many times to loop the track so that the sum of gapless delay and padding from
+ // the first presentation end to the last is at least 'presentationeEndPrecisionMs'.
+ const int playbackNumber = (int)(significantSampleNumber / ((float)delay + padding) + 1);
+ std::vector<float> presentationEndTimes;
+ uint64_t previousPosition = std::numeric_limits<uint64_t>::max();
+ for (int i = 0; i < playbackNumber; ++i) {
+ const auto start = std::chrono::steady_clock::now();
+ ASSERT_NO_FATAL_FAILURE(
+ waitForPresentationPositionAdvance(writer, &previousPosition, &previousPosition));
+ presentationEndTimes.push_back(std::chrono::duration_cast<std::chrono::milliseconds>(
+ std::chrono::steady_clock::now() - start)
+ .count());
+ }
+ const float avgDuration =
+ std::accumulate(presentationEndTimes.begin(), presentationEndTimes.end(), 0.0) /
+ presentationEndTimes.size();
+ EXPECT_NEAR(durationMs, avgDuration, presentationeEndPrecisionMs * 0.1);
+ writer.stop();
+ releasePatchIfNeeded();
+}
+
+INSTANTIATE_TEST_CASE_P(
+ CompressedOffloadOutputStream, CompressedOffloadOutputStreamTest,
+ ::testing::ValuesIn(getOutputDeviceCompressedConfigParameters(AudioConfigBase{
+ .format = xsd::toString(xsd::AudioFormat::AUDIO_FORMAT_MP3),
+ .sampleRateHz = 44100,
+ .channelMask = xsd::toString(xsd::AudioChannelMask::AUDIO_CHANNEL_OUT_STEREO)})),
+ &DeviceConfigParameterToString);
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(CompressedOffloadOutputStreamTest);
diff --git a/audio/core/all-versions/vts/functional/7.0/Generators.cpp b/audio/core/all-versions/vts/functional/7.0/Generators.cpp
index f936d0a..8b955b6 100644
--- a/audio/core/all-versions/vts/functional/7.0/Generators.cpp
+++ b/audio/core/all-versions/vts/functional/7.0/Generators.cpp
@@ -57,9 +57,6 @@
static std::tuple<std::vector<AudioInOutFlag>, bool> generateOutFlags(
const xsd::MixPorts::MixPort& mixPort) {
- static const std::vector<AudioInOutFlag> offloadFlags = {
- toString(xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD),
- toString(xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_DIRECT)};
std::vector<AudioInOutFlag> flags;
bool isOffload = false;
if (mixPort.hasFlags()) {
@@ -67,14 +64,10 @@
isOffload = std::find(xsdFlags.begin(), xsdFlags.end(),
xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) !=
xsdFlags.end();
- if (!isOffload) {
- for (auto flag : xsdFlags) {
- if (flag != xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_PRIMARY) {
- flags.push_back(toString(flag));
- }
+ for (auto flag : xsdFlags) {
+ if (flag != xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_PRIMARY) {
+ flags.push_back(toString(flag));
}
- } else {
- flags = offloadFlags;
}
}
return {flags, isOffload};
@@ -85,10 +78,10 @@
.base = base,
.streamType = toString(xsd::AudioStreamType::AUDIO_STREAM_MUSIC),
.usage = toString(xsd::AudioUsage::AUDIO_USAGE_MEDIA),
- .bitRatePerSecond = 320,
+ .bitRatePerSecond = 192, // as in sine882hz3s.mp3
.durationMicroseconds = -1,
.bitWidth = 16,
- .bufferSize = 256 // arbitrary value
+ .bufferSize = 72000 // 3 seconds at 192 kbps, as in sine882hz3s.mp3
};
}
@@ -100,11 +93,10 @@
if (!module || !module->getFirstMixPorts()) break;
for (const auto& mixPort : module->getFirstMixPorts()->getMixPort()) {
if (mixPort.getRole() != xsd::Role::source) continue; // not an output profile
- if (getCachedPolicyConfig()
- .getAttachedSinkDeviceForMixPort(moduleName, mixPort.getName())
- .empty()) {
- continue; // no attached device
- }
+ const auto attachedDeviceAddress =
+ getCachedPolicyConfig().getDeviceAddressOfSinkDeviceAttachedToMixPort(
+ moduleName, mixPort.getName());
+ if (!attachedDeviceAddress.has_value()) continue;
auto [flags, isOffload] = generateOutFlags(mixPort);
for (const auto& profile : mixPort.getProfile()) {
if (!profile.hasFormat() || !profile.hasSamplingRates() ||
@@ -118,7 +110,8 @@
if (isOffload) {
config.offloadInfo.info(generateOffloadInfo(config.base));
}
- result.emplace_back(device, mixPort.getName(), config, flags);
+ result.emplace_back(device, mixPort.getName(), attachedDeviceAddress.value(),
+ config, flags);
if (oneProfilePerDevice) break;
}
if (oneProfilePerDevice) break;
@@ -162,13 +155,16 @@
profile.getFormat(),
static_cast<uint32_t>(profile.getSamplingRates()[0]),
toString(profile.getChannelMasks()[0])};
+ DeviceAddress defaultDevice = {
+ toString(xsd::AudioDevice::AUDIO_DEVICE_OUT_DEFAULT), {}};
{
AudioConfig config{.base = validBase};
config.base.channelMask = "random_string";
if (isOffload) {
config.offloadInfo.info(generateOffloadInfo(validBase));
}
- result.emplace_back(device, mixPort.getName(), config, validFlags);
+ result.emplace_back(device, mixPort.getName(), defaultDevice, config,
+ validFlags);
}
{
AudioConfig config{.base = validBase};
@@ -176,7 +172,8 @@
if (isOffload) {
config.offloadInfo.info(generateOffloadInfo(validBase));
}
- result.emplace_back(device, mixPort.getName(), config, validFlags);
+ result.emplace_back(device, mixPort.getName(), defaultDevice, config,
+ validFlags);
}
if (generateInvalidFlags) {
AudioConfig config{.base = validBase};
@@ -184,32 +181,37 @@
config.offloadInfo.info(generateOffloadInfo(validBase));
}
std::vector<AudioInOutFlag> flags = {"random_string", ""};
- result.emplace_back(device, mixPort.getName(), config, flags);
+ result.emplace_back(device, mixPort.getName(), defaultDevice, config,
+ flags);
}
if (isOffload) {
{
AudioConfig config{.base = validBase};
config.offloadInfo.info(generateOffloadInfo(validBase));
config.offloadInfo.info().base.channelMask = "random_string";
- result.emplace_back(device, mixPort.getName(), config, validFlags);
+ result.emplace_back(device, mixPort.getName(), defaultDevice, config,
+ validFlags);
}
{
AudioConfig config{.base = validBase};
config.offloadInfo.info(generateOffloadInfo(validBase));
config.offloadInfo.info().base.format = "random_string";
- result.emplace_back(device, mixPort.getName(), config, validFlags);
+ result.emplace_back(device, mixPort.getName(), defaultDevice, config,
+ validFlags);
}
{
AudioConfig config{.base = validBase};
config.offloadInfo.info(generateOffloadInfo(validBase));
config.offloadInfo.info().streamType = "random_string";
- result.emplace_back(device, mixPort.getName(), config, validFlags);
+ result.emplace_back(device, mixPort.getName(), defaultDevice, config,
+ validFlags);
}
{
AudioConfig config{.base = validBase};
config.offloadInfo.info(generateOffloadInfo(validBase));
config.offloadInfo.info().usage = "random_string";
- result.emplace_back(device, mixPort.getName(), config, validFlags);
+ result.emplace_back(device, mixPort.getName(), defaultDevice, config,
+ validFlags);
}
hasOffloadConfig = true;
} else {
@@ -233,11 +235,10 @@
if (!module || !module->getFirstMixPorts()) break;
for (const auto& mixPort : module->getFirstMixPorts()->getMixPort()) {
if (mixPort.getRole() != xsd::Role::sink) continue; // not an input profile
- if (getCachedPolicyConfig()
- .getAttachedSourceDeviceForMixPort(moduleName, mixPort.getName())
- .empty()) {
- continue; // no attached device
- }
+ const auto attachedDeviceAddress =
+ getCachedPolicyConfig().getDeviceAddressOfSourceDeviceAttachedToMixPort(
+ moduleName, mixPort.getName());
+ if (!attachedDeviceAddress.has_value()) continue;
std::vector<AudioInOutFlag> flags;
if (mixPort.hasFlags()) {
std::transform(mixPort.getFlags().begin(), mixPort.getFlags().end(),
@@ -250,7 +251,8 @@
auto configs = combineAudioConfig(profile.getChannelMasks(),
profile.getSamplingRates(), profile.getFormat());
for (const auto& config : configs) {
- result.emplace_back(device, mixPort.getName(), config, flags);
+ result.emplace_back(device, mixPort.getName(), attachedDeviceAddress.value(),
+ config, flags);
if (oneProfilePerDevice) break;
}
if (oneProfilePerDevice) break;
@@ -298,20 +300,25 @@
profile.getFormat(),
static_cast<uint32_t>(profile.getSamplingRates()[0]),
toString(profile.getChannelMasks()[0])};
+ DeviceAddress defaultDevice = {
+ toString(xsd::AudioDevice::AUDIO_DEVICE_IN_DEFAULT), {}};
{
AudioConfig config{.base = validBase};
config.base.channelMask = "random_string";
- result.emplace_back(device, mixPort.getName(), config, validFlags);
+ result.emplace_back(device, mixPort.getName(), defaultDevice, config,
+ validFlags);
}
{
AudioConfig config{.base = validBase};
config.base.format = "random_string";
- result.emplace_back(device, mixPort.getName(), config, validFlags);
+ result.emplace_back(device, mixPort.getName(), defaultDevice, config,
+ validFlags);
}
if (generateInvalidFlags) {
AudioConfig config{.base = validBase};
std::vector<AudioInOutFlag> flags = {"random_string", ""};
- result.emplace_back(device, mixPort.getName(), config, flags);
+ result.emplace_back(device, mixPort.getName(), defaultDevice, config,
+ flags);
}
hasConfig = true;
break;
diff --git a/audio/core/all-versions/vts/functional/7.0/PolicyConfig.h b/audio/core/all-versions/vts/functional/7.0/PolicyConfig.h
index 4aea503..c1d5669 100644
--- a/audio/core/all-versions/vts/functional/7.0/PolicyConfig.h
+++ b/audio/core/all-versions/vts/functional/7.0/PolicyConfig.h
@@ -61,6 +61,18 @@
const std::set<std::string>& getModulesWithDevicesNames() const {
return mModulesWithDevicesNames;
}
+ std::optional<DeviceAddress> getDeviceAddressOfSinkDeviceAttachedToMixPort(
+ const std::string& moduleName, const std::string& mixPortName) const {
+ const auto attachedDevicePort = getAttachedSinkDeviceForMixPort(moduleName, mixPortName);
+ if (attachedDevicePort.empty()) return {};
+ return getDeviceAddressOfDevicePort(moduleName, attachedDevicePort);
+ }
+ std::optional<DeviceAddress> getDeviceAddressOfSourceDeviceAttachedToMixPort(
+ const std::string& moduleName, const std::string& mixPortName) const {
+ const auto attachedDevicePort = getAttachedSourceDeviceForMixPort(moduleName, mixPortName);
+ if (attachedDevicePort.empty()) return {};
+ return getDeviceAddressOfDevicePort(moduleName, attachedDevicePort);
+ }
std::string getAttachedSinkDeviceForMixPort(const std::string& moduleName,
const std::string& mixPortName) const {
return findAttachedDevice(getAttachedDevices(moduleName),
@@ -84,8 +96,6 @@
const std::vector<std::string>& getAttachedDevices(const std::string& moduleName) const;
std::optional<DeviceAddress> getDeviceAddressOfDevicePort(
const std::string& moduleName, const std::string& devicePortName) const;
- std::string getDevicePortTagNameFromType(const std::string& moduleName,
- const AudioDevice& deviceType) const;
std::set<std::string> getSinkDevicesForMixPort(const std::string& moduleName,
const std::string& mixPortName) const;
std::set<std::string> getSourceDevicesForMixPort(const std::string& moduleName,
diff --git a/audio/core/all-versions/vts/functional/Android.bp b/audio/core/all-versions/vts/functional/Android.bp
index c757032..5b0a7f2 100644
--- a/audio/core/all-versions/vts/functional/Android.bp
+++ b/audio/core/all-versions/vts/functional/Android.bp
@@ -190,6 +190,7 @@
],
data: [
":audio_policy_configuration_V7_0",
+ "data/sine882hz3s.mp3",
],
// Use test_config for vts suite.
// TODO(b/146104851): Add auto-gen rules and remove it.
@@ -223,6 +224,7 @@
],
data: [
":audio_policy_configuration_V7_1",
+ "data/sine882hz3s.mp3",
],
// Use test_config for vts suite.
// TODO(b/146104851): Add auto-gen rules and remove it.
diff --git a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
index 38e9e5f..6c5584d 100644
--- a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
+++ b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
@@ -617,7 +617,8 @@
std::get<PARAM_FLAGS>(info.param)));
#elif MAJOR_VERSION >= 7
const auto configPart =
- std::to_string(config.base.sampleRateHz) + "_" +
+ ::testing::PrintToString(std::get<PARAM_ATTACHED_DEV_ADDR>(info.param).deviceType) +
+ "_" + std::to_string(config.base.sampleRateHz) + "_" +
// The channel masks and flags are vectors of strings, just need to sanitize them.
SanitizeStringForGTestName(::testing::PrintToString(config.base.channelMask)) + "_" +
SanitizeStringForGTestName(::testing::PrintToString(std::get<PARAM_FLAGS>(info.param)));
@@ -658,6 +659,9 @@
std::get<INDEX_OUTPUT>(std::get<PARAM_FLAGS>(GetParam())));
}
#elif MAJOR_VERSION >= 7
+ DeviceAddress getAttachedDeviceAddress() const {
+ return std::get<PARAM_ATTACHED_DEV_ADDR>(GetParam());
+ }
hidl_vec<AudioInOutFlag> getInputFlags() const { return std::get<PARAM_FLAGS>(GetParam()); }
hidl_vec<AudioInOutFlag> getOutputFlags() const { return std::get<PARAM_FLAGS>(GetParam()); }
#endif
@@ -933,6 +937,14 @@
StreamWriter(IStreamOut* stream, size_t bufferSize)
: mStream(stream), mBufferSize(bufferSize), mData(mBufferSize) {}
+ StreamWriter(IStreamOut* stream, size_t bufferSize, std::vector<uint8_t>&& data,
+ std::function<void()> onDataWrap)
+ : mStream(stream),
+ mBufferSize(bufferSize),
+ mData(std::move(data)),
+ mOnDataWrap(onDataWrap) {
+ ALOGW("StreamWriter data size: %d", (int)mData.size());
+ }
~StreamWriter() {
stop();
if (mEfGroup) {
@@ -998,9 +1010,11 @@
ALOGE("command message queue write failed");
return false;
}
- const size_t dataSize = std::min(mData.size(), mDataMQ->availableToWrite());
- bool success = mDataMQ->write(mData.data(), dataSize);
+ const size_t dataSize = std::min(mData.size() - mDataPosition, mDataMQ->availableToWrite());
+ bool success = mDataMQ->write(mData.data() + mDataPosition, dataSize);
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;
@@ -1026,6 +1040,7 @@
ALOGE("bad wait status: %d", ret);
success = false;
}
+ if (success && mDataPosition == 0) mOnDataWrap();
return success;
}
@@ -1033,6 +1048,8 @@
IStreamOut* const mStream;
const size_t mBufferSize;
std::vector<uint8_t> mData;
+ std::function<void()> mOnDataWrap = []() {};
+ size_t mDataPosition = 0;
std::unique_ptr<CommandMQ> mCommandMQ;
std::unique_ptr<DataMQ> mDataMQ;
std::unique_ptr<StatusMQ> mStatusMQ;
@@ -1047,7 +1064,7 @@
#if MAJOR_VERSION <= 6
address.device = AudioDevice::OUT_DEFAULT;
#elif MAJOR_VERSION >= 7
- address.deviceType = toString(xsd::AudioDevice::AUDIO_DEVICE_OUT_DEFAULT);
+ address = getAttachedDeviceAddress();
#endif
const AudioConfig& config = getConfig();
auto flags = getOutputFlags();
@@ -1243,16 +1260,11 @@
#if MAJOR_VERSION <= 6
address.device = AudioDevice::IN_DEFAULT;
#elif MAJOR_VERSION >= 7
- auto maybeSourceAddress = getCachedPolicyConfig().getSourceDeviceForMixPort(
- getDeviceName(), getMixPortName());
+ address = getAttachedDeviceAddress();
auto& metadata = initMetadata.tracks[0];
- if (maybeSourceAddress.has_value() &&
- !xsd::isTelephonyDevice(maybeSourceAddress.value().deviceType)) {
- address = maybeSourceAddress.value();
+ 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(),
diff --git a/audio/core/all-versions/vts/functional/AudioTestDefinitions.h b/audio/core/all-versions/vts/functional/AudioTestDefinitions.h
index 802b87b..3de06c3 100644
--- a/audio/core/all-versions/vts/functional/AudioTestDefinitions.h
+++ b/audio/core/all-versions/vts/functional/AudioTestDefinitions.h
@@ -39,9 +39,10 @@
std::variant<android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::AudioInputFlag,
android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::AudioOutputFlag>>;
#elif MAJOR_VERSION >= 7
-enum { PARAM_DEVICE, PARAM_PORT_NAME, PARAM_CONFIG, PARAM_FLAGS };
+enum { PARAM_DEVICE, PARAM_PORT_NAME, PARAM_ATTACHED_DEV_ADDR, PARAM_CONFIG, PARAM_FLAGS };
using DeviceConfigParameter =
std::tuple<DeviceParameter, std::string,
+ android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::DeviceAddress,
android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::AudioConfig,
std::vector<android::hardware::audio::CORE_TYPES_CPP_VERSION::AudioInOutFlag>>;
#endif
diff --git a/audio/core/all-versions/vts/functional/VtsHalAudioV7_0TargetTest.xml b/audio/core/all-versions/vts/functional/VtsHalAudioV7_0TargetTest.xml
index f0e2695..8da5744 100644
--- a/audio/core/all-versions/vts/functional/VtsHalAudioV7_0TargetTest.xml
+++ b/audio/core/all-versions/vts/functional/VtsHalAudioV7_0TargetTest.xml
@@ -29,6 +29,7 @@
<option name="cleanup" value="true" />
<option name="push" value="VtsHalAudioV7_0TargetTest->/data/local/tmp/VtsHalAudioV7_0TargetTest" />
<option name="push" value="audio_policy_configuration_V7_0.xsd->/data/local/tmp/audio_policy_configuration_V7_0.xsd" />
+ <option name="push" value="sine882hz3s.mp3->/data/local/tmp/sine882hz3s.mp3" />
</target_preparer>
<test class="com.android.tradefed.testtype.GTest" >
diff --git a/audio/core/all-versions/vts/functional/VtsHalAudioV7_1TargetTest.xml b/audio/core/all-versions/vts/functional/VtsHalAudioV7_1TargetTest.xml
index 7ce1477..227df18 100644
--- a/audio/core/all-versions/vts/functional/VtsHalAudioV7_1TargetTest.xml
+++ b/audio/core/all-versions/vts/functional/VtsHalAudioV7_1TargetTest.xml
@@ -29,6 +29,8 @@
<option name="cleanup" value="true" />
<option name="push" value="VtsHalAudioV7_1TargetTest->/data/local/tmp/VtsHalAudioV7_1TargetTest" />
<option name="push" value="audio_policy_configuration_V7_1.xsd->/data/local/tmp/audio_policy_configuration_V7_1.xsd" />
+ <option name="push" value="sine882hz3s.mp3->/data/local/tmp/sine882hz3s.mp3" />
+
</target_preparer>
<test class="com.android.tradefed.testtype.GTest" >
diff --git a/audio/core/all-versions/vts/functional/data/sine882hz3s.mp3 b/audio/core/all-versions/vts/functional/data/sine882hz3s.mp3
new file mode 100644
index 0000000..0604f9b
--- /dev/null
+++ b/audio/core/all-versions/vts/functional/data/sine882hz3s.mp3
Binary files differ
diff --git a/biometrics/face/aidl/default/Android.bp b/biometrics/face/aidl/default/Android.bp
index 48c929b..63a3645 100644
--- a/biometrics/face/aidl/default/Android.bp
+++ b/biometrics/face/aidl/default/Android.bp
@@ -27,7 +27,7 @@
"FakeFaceEngine.cpp",
"Session.cpp",
],
- static_libs: ["android.hardware.biometrics.face.VirtualProps"],
+ static_libs: ["libandroid.hardware.biometrics.face.VirtualProps"],
}
sysprop_library {
@@ -48,7 +48,7 @@
"libbinder_ndk",
],
static_libs: [
- "android.hardware.biometrics.face.VirtualProps",
+ "libandroid.hardware.biometrics.face.VirtualProps",
"android.hardware.biometrics.face-V2-ndk",
"android.hardware.biometrics.common-V2-ndk",
"android.hardware.keymaster-V3-ndk",
diff --git a/biometrics/fingerprint/aidl/default/Android.bp b/biometrics/fingerprint/aidl/default/Android.bp
index 31fd96b..2aa7bbd 100644
--- a/biometrics/fingerprint/aidl/default/Android.bp
+++ b/biometrics/fingerprint/aidl/default/Android.bp
@@ -28,7 +28,7 @@
"android.hardware.biometrics.common.thread",
"android.hardware.biometrics.common.util",
],
- static_libs: ["android.hardware.biometrics.fingerprint.VirtualProps"],
+ static_libs: ["libandroid.hardware.biometrics.fingerprint.VirtualProps"],
}
cc_test {
@@ -43,7 +43,7 @@
"libbinder_ndk",
],
static_libs: [
- "android.hardware.biometrics.fingerprint.VirtualProps",
+ "libandroid.hardware.biometrics.fingerprint.VirtualProps",
"android.hardware.biometrics.fingerprint-V2-ndk",
"android.hardware.biometrics.common-V2-ndk",
"android.hardware.keymaster-V3-ndk",
diff --git a/boot/aidl/client/BootControlClient.cpp b/boot/aidl/client/BootControlClient.cpp
index 28070eb..89258d2 100644
--- a/boot/aidl/client/BootControlClient.cpp
+++ b/boot/aidl/client/BootControlClient.cpp
@@ -327,9 +327,14 @@
const auto instance_name =
std::string(::aidl::android::hardware::boot::IBootControl::descriptor) + "/default";
- if (auto module = ::aidl::android::hardware::boot::IBootControl::fromBinder(
+ if (AServiceManager_isDeclared(instance_name.c_str())) {
+ auto module = ::aidl::android::hardware::boot::IBootControl::fromBinder(
ndk::SpAIBinder(AServiceManager_waitForService(instance_name.c_str())));
- module != nullptr) {
+ if (module == nullptr) {
+ LOG(ERROR) << "AIDL " << instance_name
+ << " is declared but waitForService returned nullptr.";
+ return nullptr;
+ }
LOG(INFO) << "Using AIDL version of IBootControl";
return std::make_unique<BootControlClientAidl>(module);
}
diff --git a/broadcastradio/1.0/default/OWNERS b/broadcastradio/1.0/default/OWNERS
index 57e6592..302fdd7 100644
--- a/broadcastradio/1.0/default/OWNERS
+++ b/broadcastradio/1.0/default/OWNERS
@@ -1,3 +1,4 @@
-elaurent@google.com
-mnaganov@google.com
-twasilczyk@google.com
+xuweilin@google.com
+oscarazu@google.com
+ericjeong@google.com
+keunyoung@google.com
diff --git a/broadcastradio/1.0/vts/functional/OWNERS b/broadcastradio/1.0/vts/functional/OWNERS
index 778c4a2..aa19d6a 100644
--- a/broadcastradio/1.0/vts/functional/OWNERS
+++ b/broadcastradio/1.0/vts/functional/OWNERS
@@ -1,2 +1,5 @@
# Bug component: 533946
+xuweilin@google.com
oscarazu@google.com
+ericjeong@google.com
+keunyoung@google.com
diff --git a/broadcastradio/1.1/default/OWNERS b/broadcastradio/1.1/default/OWNERS
index 136b607..259b91e 100644
--- a/broadcastradio/1.1/default/OWNERS
+++ b/broadcastradio/1.1/default/OWNERS
@@ -1,3 +1,5 @@
# Automotive team
-egranata@google.com
-twasilczyk@google.com
+xuweilin@google.com
+oscarazu@google.com
+ericjeong@google.com
+keunyoung@google.com
diff --git a/broadcastradio/1.1/vts/OWNERS b/broadcastradio/1.1/vts/OWNERS
index 2c21c25..aa19d6a 100644
--- a/broadcastradio/1.1/vts/OWNERS
+++ b/broadcastradio/1.1/vts/OWNERS
@@ -1,3 +1,5 @@
# Bug component: 533946
+xuweilin@google.com
oscarazu@google.com
+ericjeong@google.com
keunyoung@google.com
diff --git a/broadcastradio/2.0/default/OWNERS b/broadcastradio/2.0/default/OWNERS
index 136b607..259b91e 100644
--- a/broadcastradio/2.0/default/OWNERS
+++ b/broadcastradio/2.0/default/OWNERS
@@ -1,3 +1,5 @@
# Automotive team
-egranata@google.com
-twasilczyk@google.com
+xuweilin@google.com
+oscarazu@google.com
+ericjeong@google.com
+keunyoung@google.com
diff --git a/broadcastradio/2.0/vts/OWNERS b/broadcastradio/2.0/vts/OWNERS
index 1ff7407..09690ef 100644
--- a/broadcastradio/2.0/vts/OWNERS
+++ b/broadcastradio/2.0/vts/OWNERS
@@ -1,6 +1,8 @@
# Automotive team
-egranata@google.com
-twasilczyk@google.com
+xuweilin@google.com
+oscarazu@google.com
+ericjeong@google.com
+keunyoung@google.com
# VTS team
dshi@google.com
diff --git a/broadcastradio/2.0/vts/functional/OWNERS b/broadcastradio/2.0/vts/functional/OWNERS
index 2c21c25..aa19d6a 100644
--- a/broadcastradio/2.0/vts/functional/OWNERS
+++ b/broadcastradio/2.0/vts/functional/OWNERS
@@ -1,3 +1,5 @@
# Bug component: 533946
+xuweilin@google.com
oscarazu@google.com
+ericjeong@google.com
keunyoung@google.com
diff --git a/broadcastradio/common/OWNERS b/broadcastradio/common/OWNERS
index 136b607..259b91e 100644
--- a/broadcastradio/common/OWNERS
+++ b/broadcastradio/common/OWNERS
@@ -1,3 +1,5 @@
# Automotive team
-egranata@google.com
-twasilczyk@google.com
+xuweilin@google.com
+oscarazu@google.com
+ericjeong@google.com
+keunyoung@google.com
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 2ae9c2b..00e9837 100755
--- a/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp
+++ b/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp
@@ -400,9 +400,18 @@
<< " Component: " << info.mName.c_str() << " Role: " << role.c_str()
<< " not allowed for devices launching with Android T and above";
} else {
- ASSERT_LT(getFirstApiLevel(), __ANDROID_API_S__)
+ std::string codecName = info.mName;
+ bool isAndroidCodec = (codecName.rfind("OMX.google", 0) != std::string::npos);
+ if (isAndroidCodec && (getFirstApiLevel() <= __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";
+ }
}
}
if (role.find("audio_decoder") != std::string::npos ||
diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
index 002e11a..cd08671 100644
--- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
+++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
@@ -46,4 +46,5 @@
SUPPORTED_AOA_RESULT_REQ_ANTENNA_INTERLEAVING = 227,
SUPPORTED_MIN_RANGING_INTERVAL_MS = 228,
SUPPORTED_RANGE_DATA_NTF_CONFIG = 229,
+ SUPPORTED_RSSI_REPORTING = 230,
}
diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
index e15edcb..556bd13 100644
--- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
+++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
@@ -163,4 +163,12 @@
* RANGE_DATA_NTF_CONFIG in SET_APP_CFG_CMD
*/
SUPPORTED_RANGE_DATA_NTF_CONFIG = 0xE5,
+
+ /**
+ * 1 byte bitmask to indicate the supported RSSI_REPORTING values
+ * Values:
+ * 1 - Feature supported.
+ * 0 - Feature not supported.
+ */
+ SUPPORTED_RSSI_REPORTING = 0xE6,
}