diff options
author | android-build-team Robot | 2018-04-25 02:27:23 -0500 |
---|---|---|
committer | android-build-team Robot | 2018-04-25 02:27:23 -0500 |
commit | a53319310ebb8c6506606d64fb710fdc4232f5bb (patch) | |
tree | 0f5d055dd561fba27fd774e6594d862d78bd6e6e | |
parent | bc904e30664ebfe6f1f21fdf7a372be2bf0a2d40 (diff) | |
parent | adf9e18c01c3bf25858aacc380c16aa465b0ef34 (diff) | |
download | platform-hardware-interfaces-a53319310ebb8c6506606d64fb710fdc4232f5bb.tar.gz platform-hardware-interfaces-a53319310ebb8c6506606d64fb710fdc4232f5bb.tar.xz platform-hardware-interfaces-a53319310ebb8c6506606d64fb710fdc4232f5bb.zip |
Snap for 4742838 from adf9e18c01c3bf25858aacc380c16aa465b0ef34 to pi-release
Change-Id: Ia992d2460c4c6bfed9cf2fb2d54994001a6d3ec5
7 files changed, 112 insertions, 49 deletions
diff --git a/audio/4.0/config/audio_policy_configuration.xsd b/audio/4.0/config/audio_policy_configuration.xsd index 14e4fd61..ee17fc98 100644 --- a/audio/4.0/config/audio_policy_configuration.xsd +++ b/audio/4.0/config/audio_policy_configuration.xsd | |||
@@ -525,6 +525,7 @@ | |||
525 | <xs:enumeration value="DEVICE_CATEGORY_SPEAKER"/> | 525 | <xs:enumeration value="DEVICE_CATEGORY_SPEAKER"/> |
526 | <xs:enumeration value="DEVICE_CATEGORY_EARPIECE"/> | 526 | <xs:enumeration value="DEVICE_CATEGORY_EARPIECE"/> |
527 | <xs:enumeration value="DEVICE_CATEGORY_EXT_MEDIA"/> | 527 | <xs:enumeration value="DEVICE_CATEGORY_EXT_MEDIA"/> |
528 | <xs:enumeration value="DEVICE_CATEGORY_HEARING_AID"/> | ||
528 | </xs:restriction> | 529 | </xs:restriction> |
529 | </xs:simpleType> | 530 | </xs:simpleType> |
530 | <xs:complexType name="volume"> | 531 | <xs:complexType name="volume"> |
diff --git a/audio/common/all-versions/test/utility/include/utility/PrettyPrintAudioTypes.h b/audio/common/all-versions/test/utility/include/utility/PrettyPrintAudioTypes.h index 88a67e07..05239acc 100644 --- a/audio/common/all-versions/test/utility/include/utility/PrettyPrintAudioTypes.h +++ b/audio/common/all-versions/test/utility/include/utility/PrettyPrintAudioTypes.h | |||
@@ -47,7 +47,9 @@ DEFINE_GTEST_PRINT_TO(Result) | |||
47 | namespace common { | 47 | namespace common { |
48 | namespace AUDIO_HAL_VERSION { | 48 | namespace AUDIO_HAL_VERSION { |
49 | DEFINE_GTEST_PRINT_TO(AudioConfig) | 49 | DEFINE_GTEST_PRINT_TO(AudioConfig) |
50 | DEFINE_GTEST_PRINT_TO(AudioMode) | ||
50 | DEFINE_GTEST_PRINT_TO(AudioDevice) | 51 | DEFINE_GTEST_PRINT_TO(AudioDevice) |
52 | DEFINE_GTEST_PRINT_TO(AudioFormat) | ||
51 | DEFINE_GTEST_PRINT_TO(AudioChannelMask) | 53 | DEFINE_GTEST_PRINT_TO(AudioChannelMask) |
52 | } // namespace AUDIO_HAL_VERSION | 54 | } // namespace AUDIO_HAL_VERSION |
53 | } // namespace common | 55 | } // namespace common |
diff --git a/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp b/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp index 9484ddd4..de0df400 100644 --- a/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp +++ b/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp | |||
@@ -55,6 +55,7 @@ using std::vector; | |||
55 | using ::android::sp; | 55 | using ::android::sp; |
56 | using ::android::hardware::Return; | 56 | using ::android::hardware::Return; |
57 | using ::android::hardware::hidl_bitfield; | 57 | using ::android::hardware::hidl_bitfield; |
58 | using ::android::hardware::hidl_enum_iterator; | ||
58 | using ::android::hardware::hidl_handle; | 59 | using ::android::hardware::hidl_handle; |
59 | using ::android::hardware::hidl_string; | 60 | using ::android::hardware::hidl_string; |
60 | using ::android::hardware::hidl_vec; | 61 | using ::android::hardware::hidl_vec; |
@@ -81,6 +82,7 @@ using ::android::hardware::audio::V4_0::SourceMetadata; | |||
81 | using ::android::hardware::audio::V4_0::SinkMetadata; | 82 | using ::android::hardware::audio::V4_0::SinkMetadata; |
82 | using ::android::hardware::audio::common::V4_0::AudioChannelMask; | 83 | using ::android::hardware::audio::common::V4_0::AudioChannelMask; |
83 | using ::android::hardware::audio::common::V4_0::AudioConfig; | 84 | using ::android::hardware::audio::common::V4_0::AudioConfig; |
85 | using ::android::hardware::audio::common::V4_0::AudioContentType; | ||
84 | using ::android::hardware::audio::common::V4_0::AudioDevice; | 86 | using ::android::hardware::audio::common::V4_0::AudioDevice; |
85 | using ::android::hardware::audio::common::V4_0::AudioFormat; | 87 | using ::android::hardware::audio::common::V4_0::AudioFormat; |
86 | using ::android::hardware::audio::common::V4_0::AudioHandleConsts; | 88 | using ::android::hardware::audio::common::V4_0::AudioHandleConsts; |
@@ -91,6 +93,7 @@ using ::android::hardware::audio::common::V4_0::AudioMode; | |||
91 | using ::android::hardware::audio::common::V4_0::AudioOffloadInfo; | 93 | using ::android::hardware::audio::common::V4_0::AudioOffloadInfo; |
92 | using ::android::hardware::audio::common::V4_0::AudioOutputFlag; | 94 | using ::android::hardware::audio::common::V4_0::AudioOutputFlag; |
93 | using ::android::hardware::audio::common::V4_0::AudioSource; | 95 | using ::android::hardware::audio::common::V4_0::AudioSource; |
96 | using ::android::hardware::audio::common::V4_0::AudioUsage; | ||
94 | using ::android::hardware::audio::common::V4_0::ThreadInfo; | 97 | using ::android::hardware::audio::common::V4_0::ThreadInfo; |
95 | using ::android::hardware::audio::common::utils::mkBitfield; | 98 | using ::android::hardware::audio::common::utils::mkBitfield; |
96 | 99 | ||
@@ -140,11 +143,11 @@ class AudioHidlTest : public HidlTest { | |||
140 | sp<IDevicesFactory> AudioHidlTest::devicesFactory; | 143 | sp<IDevicesFactory> AudioHidlTest::devicesFactory; |
141 | 144 | ||
142 | TEST_F(AudioHidlTest, GetAudioDevicesFactoryService) { | 145 | TEST_F(AudioHidlTest, GetAudioDevicesFactoryService) { |
143 | doc::test("test the getService (called in SetUp)"); | 146 | doc::test("Test the getService (called in SetUp)"); |
144 | } | 147 | } |
145 | 148 | ||
146 | TEST_F(AudioHidlTest, OpenDeviceInvalidParameter) { | 149 | TEST_F(AudioHidlTest, OpenDeviceInvalidParameter) { |
147 | doc::test("test passing an invalid parameter to openDevice"); | 150 | doc::test("Test passing an invalid parameter to openDevice"); |
148 | Result result; | 151 | Result result; |
149 | sp<IDevice> device; | 152 | sp<IDevice> device; |
150 | ASSERT_OK(devicesFactory->openDevice("Non existing device", returnIn(result, device))); | 153 | ASSERT_OK(devicesFactory->openDevice("Non existing device", returnIn(result, device))); |
@@ -152,6 +155,19 @@ TEST_F(AudioHidlTest, OpenDeviceInvalidParameter) { | |||
152 | ASSERT_TRUE(device == nullptr); | 155 | ASSERT_TRUE(device == nullptr); |
153 | } | 156 | } |
154 | 157 | ||
158 | TEST_F(AudioHidlTest, OpenPrimaryDeviceUsingGetDevice) { | ||
159 | doc::test("Calling openDevice(\"primary\") should return the primary device."); | ||
160 | Result result; | ||
161 | sp<IDevice> baseDevice; | ||
162 | ASSERT_OK(devicesFactory->openDevice("primary", returnIn(result, baseDevice))); | ||
163 | ASSERT_OK(result); | ||
164 | ASSERT_TRUE(baseDevice != nullptr); | ||
165 | |||
166 | Return<sp<IPrimaryDevice>> primaryDevice = IPrimaryDevice::castFrom(baseDevice); | ||
167 | ASSERT_TRUE(primaryDevice.isOk()); | ||
168 | ASSERT_TRUE(sp<IPrimaryDevice>(primaryDevice) != nullptr); | ||
169 | } | ||
170 | |||
155 | ////////////////////////////////////////////////////////////////////////////// | 171 | ////////////////////////////////////////////////////////////////////////////// |
156 | /////////////////////////////// openDevice primary /////////////////////////// | 172 | /////////////////////////////// openDevice primary /////////////////////////// |
157 | ////////////////////////////////////////////////////////////////////////////// | 173 | ////////////////////////////////////////////////////////////////////////////// |
@@ -165,14 +181,11 @@ class AudioPrimaryHidlTest : public AudioHidlTest { | |||
165 | 181 | ||
166 | if (device == nullptr) { | 182 | if (device == nullptr) { |
167 | Result result; | 183 | Result result; |
168 | sp<IDevice> baseDevice; | 184 | ASSERT_OK(devicesFactory->openPrimaryDevice(returnIn(result, device))); |
169 | ASSERT_OK(devicesFactory->openDevice("primary", returnIn(result, baseDevice))); | ||
170 | ASSERT_OK(result); | 185 | ASSERT_OK(result); |
171 | ASSERT_TRUE(baseDevice != nullptr); | 186 | ASSERT_TRUE(device != nullptr); |
172 | 187 | ||
173 | environment->registerTearDown([] { device.clear(); }); | 188 | environment->registerTearDown([] { device.clear(); }); |
174 | device = IPrimaryDevice::castFrom(baseDevice); | ||
175 | ASSERT_TRUE(device != nullptr); | ||
176 | } | 189 | } |
177 | } | 190 | } |
178 | 191 | ||
@@ -600,13 +613,17 @@ class OutputStreamTest : public OpenStreamTest<IStreamOut> { | |||
600 | const AudioConfig& config = GetParam(); | 613 | const AudioConfig& config = GetParam(); |
601 | // TODO: test all flag combination | 614 | // TODO: test all flag combination |
602 | auto flags = hidl_bitfield<AudioOutputFlag>(AudioOutputFlag::NONE); | 615 | auto flags = hidl_bitfield<AudioOutputFlag>(AudioOutputFlag::NONE); |
603 | SourceMetadata metadata = {{{}}}; // create on track metadata | ||
604 | testOpen( | 616 | testOpen( |
605 | [&](AudioIoHandle handle, AudioConfig config, auto cb) { | 617 | [&](AudioIoHandle handle, AudioConfig config, auto cb) { |
606 | return device->openOutputStream(handle, address, config, flags, metadata, cb); | 618 | return device->openOutputStream(handle, address, config, flags, initialMetadata, |
619 | cb); | ||
607 | }, | 620 | }, |
608 | config); | 621 | config); |
609 | } | 622 | } |
623 | |||
624 | protected: | ||
625 | const SourceMetadata initialMetadata = { | ||
626 | {{AudioUsage::MEDIA, AudioContentType::MUSIC, 1 /* gain */}}}; | ||
610 | }; | 627 | }; |
611 | TEST_P(OutputStreamTest, OpenOutputStreamTest) { | 628 | TEST_P(OutputStreamTest, OpenOutputStreamTest) { |
612 | doc::test( | 629 | doc::test( |
@@ -637,13 +654,15 @@ class InputStreamTest : public OpenStreamTest<IStreamIn> { | |||
637 | const AudioConfig& config = GetParam(); | 654 | const AudioConfig& config = GetParam(); |
638 | // TODO: test all supported flags and source | 655 | // TODO: test all supported flags and source |
639 | auto flags = hidl_bitfield<AudioInputFlag>(AudioInputFlag::NONE); | 656 | auto flags = hidl_bitfield<AudioInputFlag>(AudioInputFlag::NONE); |
640 | SinkMetadata metadata = {{{AudioSource::DEFAULT, 1}}}; | ||
641 | testOpen( | 657 | testOpen( |
642 | [&](AudioIoHandle handle, AudioConfig config, auto cb) { | 658 | [&](AudioIoHandle handle, AudioConfig config, auto cb) { |
643 | return device->openInputStream(handle, address, config, flags, metadata, cb); | 659 | return device->openInputStream(handle, address, config, flags, initialMetadata, cb); |
644 | }, | 660 | }, |
645 | config); | 661 | config); |
646 | } | 662 | } |
663 | |||
664 | protected: | ||
665 | const SinkMetadata initialMetadata = {{{AudioSource::DEFAULT, 1 /* gain */}}}; | ||
647 | }; | 666 | }; |
648 | 667 | ||
649 | TEST_P(InputStreamTest, OpenInputStreamTest) { | 668 | TEST_P(InputStreamTest, OpenInputStreamTest) { |
@@ -727,11 +746,12 @@ static void testCapabilityGetter(const string& name, IStream* stream, | |||
727 | ASSERT_OK(ret); | 746 | ASSERT_OK(ret); |
728 | 747 | ||
729 | if (currentMustBeSupported) { | 748 | if (currentMustBeSupported) { |
749 | ASSERT_NE(0U, capabilities.size()) << name << " must not return an empty list"; | ||
730 | Property currentValue = extract((stream->*getter)()); | 750 | Property currentValue = extract((stream->*getter)()); |
731 | EXPECT_NE(std::find(capabilities.begin(), capabilities.end(), currentValue), | 751 | EXPECT_TRUE(std::find(capabilities.begin(), capabilities.end(), currentValue) != |
732 | capabilities.end()) | 752 | capabilities.end()) |
733 | << "current " << name << " is not in the list of the supported ones " | 753 | << "value returned by " << name << "() = " << testing::PrintToString(currentValue) |
734 | << toString(capabilities); | 754 | << " is not in the list of the supported ones " << toString(capabilities); |
735 | } | 755 | } |
736 | 756 | ||
737 | // Check that all declared supported values are indeed supported | 757 | // Check that all declared supported values are indeed supported |
@@ -757,7 +777,7 @@ Result getSupportedChannelMasks(IStream* stream, | |||
757 | hidl_vec<hidl_bitfield<AudioChannelMask>>& channels) { | 777 | hidl_vec<hidl_bitfield<AudioChannelMask>>& channels) { |
758 | Result res; | 778 | Result res; |
759 | EXPECT_OK( | 779 | EXPECT_OK( |
760 | stream->getSupportedSampleRates(extract(stream->getFormat()), returnIn(res, channels))); | 780 | stream->getSupportedChannelMasks(extract(stream->getFormat()), returnIn(res, channels))); |
761 | return res; | 781 | return res; |
762 | } | 782 | } |
763 | 783 | ||
@@ -1039,8 +1059,30 @@ TEST_P(InputStreamTest, getCapturePosition) { | |||
1039 | ASSERT_RESULT(invalidStateOrNotSupported, res); | 1059 | ASSERT_RESULT(invalidStateOrNotSupported, res); |
1040 | } | 1060 | } |
1041 | 1061 | ||
1062 | TEST_P(InputStreamTest, updateSinkMetadata) { | ||
1063 | doc::test("The HAL should not crash on metadata change"); | ||
1064 | |||
1065 | hidl_enum_iterator<AudioSource> range; | ||
1066 | // Test all possible track configuration | ||
1067 | for (AudioSource source : range) { | ||
1068 | for (float volume : {0.0, 0.5, 1.0}) { | ||
1069 | const SinkMetadata metadata = {{{source, volume}}}; | ||
1070 | ASSERT_OK(stream->updateSinkMetadata(metadata)) | ||
1071 | << "source=" << toString(source) << ", volume=" << volume; | ||
1072 | } | ||
1073 | } | ||
1074 | |||
1075 | // Do not test concurrent capture as this is not officially supported | ||
1076 | |||
1077 | // Set no metadata as if all stream track had stopped | ||
1078 | ASSERT_OK(stream->updateSinkMetadata({})); | ||
1079 | |||
1080 | // Restore initial | ||
1081 | ASSERT_OK(stream->updateSinkMetadata(initialMetadata)); | ||
1082 | } | ||
1083 | |||
1042 | ////////////////////////////////////////////////////////////////////////////// | 1084 | ////////////////////////////////////////////////////////////////////////////// |
1043 | ///////////////////////////////// StreamIn /////////////////////////////////// | 1085 | ///////////////////////////////// StreamOut ////////////////////////////////// |
1044 | ////////////////////////////////////////////////////////////////////////////// | 1086 | ////////////////////////////////////////////////////////////////////////////// |
1045 | 1087 | ||
1046 | TEST_P(OutputStreamTest, getLatency) { | 1088 | TEST_P(OutputStreamTest, getLatency) { |
@@ -1195,7 +1237,7 @@ TEST_P(OutputStreamTest, Pause) { | |||
1195 | doc::partialTest("The output stream does not support pause"); | 1237 | doc::partialTest("The output stream does not support pause"); |
1196 | return; | 1238 | return; |
1197 | } | 1239 | } |
1198 | ASSERT_RESULT(Result::INVALID_STATE, stream->resume()); | 1240 | ASSERT_RESULT(Result::INVALID_STATE, stream->pause()); |
1199 | } | 1241 | } |
1200 | 1242 | ||
1201 | static void testDrain(IStreamOut* stream, AudioDrain type) { | 1243 | static void testDrain(IStreamOut* stream, AudioDrain type) { |
@@ -1261,6 +1303,37 @@ TEST_P(OutputStreamTest, SelectPresentation) { | |||
1261 | ASSERT_RESULT(okOrNotSupported, stream->selectPresentation(0, 0)); | 1303 | ASSERT_RESULT(okOrNotSupported, stream->selectPresentation(0, 0)); |
1262 | } | 1304 | } |
1263 | 1305 | ||
1306 | TEST_P(OutputStreamTest, updateSourceMetadata) { | ||
1307 | doc::test("The HAL should not crash on metadata change"); | ||
1308 | |||
1309 | hidl_enum_iterator<AudioUsage> usageRange; | ||
1310 | hidl_enum_iterator<AudioContentType> contentRange; | ||
1311 | // Test all possible track configuration | ||
1312 | for (auto usage : usageRange) { | ||
1313 | for (auto content : contentRange) { | ||
1314 | for (float volume : {0.0, 0.5, 1.0}) { | ||
1315 | const SourceMetadata metadata = {{{usage, content, volume}}}; | ||
1316 | ASSERT_OK(stream->updateSourceMetadata(metadata)) | ||
1317 | << "usage=" << toString(usage) << ", content=" << toString(content) | ||
1318 | << ", volume=" << volume; | ||
1319 | } | ||
1320 | } | ||
1321 | } | ||
1322 | |||
1323 | // Set many track of different configuration | ||
1324 | ASSERT_OK(stream->updateSourceMetadata( | ||
1325 | {{{AudioUsage::MEDIA, AudioContentType::MUSIC, 0.1}, | ||
1326 | {AudioUsage::VOICE_COMMUNICATION, AudioContentType::SPEECH, 1.0}, | ||
1327 | {AudioUsage::ALARM, AudioContentType::SONIFICATION, 0.0}, | ||
1328 | {AudioUsage::ASSISTANT, AudioContentType::UNKNOWN, 0.3}}})); | ||
1329 | |||
1330 | // Set no metadata as if all stream track had stopped | ||
1331 | ASSERT_OK(stream->updateSourceMetadata({})); | ||
1332 | |||
1333 | // Restore initial | ||
1334 | ASSERT_OK(stream->updateSourceMetadata(initialMetadata)); | ||
1335 | } | ||
1336 | |||
1264 | ////////////////////////////////////////////////////////////////////////////// | 1337 | ////////////////////////////////////////////////////////////////////////////// |
1265 | /////////////////////////////// PrimaryDevice //////////////////////////////// | 1338 | /////////////////////////////// PrimaryDevice //////////////////////////////// |
1266 | ////////////////////////////////////////////////////////////////////////////// | 1339 | ////////////////////////////////////////////////////////////////////////////// |
@@ -1271,19 +1344,16 @@ TEST_F(AudioPrimaryHidlTest, setVoiceVolume) { | |||
1271 | } | 1344 | } |
1272 | 1345 | ||
1273 | TEST_F(AudioPrimaryHidlTest, setMode) { | 1346 | TEST_F(AudioPrimaryHidlTest, setMode) { |
1274 | doc::test( | 1347 | doc::test("Make sure setMode always succeeds if mode is valid and fails otherwise"); |
1275 | "Make sure setMode always succeeds if mode is valid " | ||
1276 | "and fails otherwise"); | ||
1277 | // Test Invalid values | 1348 | // Test Invalid values |
1278 | for (int mode : {-1, 0, int(AudioMode::IN_COMMUNICATION) + 1}) { | 1349 | for (int mode : {-2, -1, int(AudioMode::IN_COMMUNICATION) + 1}) { |
1279 | SCOPED_TRACE("mode=" + to_string(mode)); | 1350 | ASSERT_RESULT(Result::INVALID_ARGUMENTS, device->setMode(AudioMode(mode))) |
1280 | ASSERT_RESULT(Result::INVALID_ARGUMENTS, device->setMode(AudioMode(mode))); | 1351 | << "mode=" << mode; |
1281 | } | 1352 | } |
1282 | // Test valid values | 1353 | // Test valid values |
1283 | for (AudioMode mode : {AudioMode::IN_CALL, AudioMode::IN_COMMUNICATION, AudioMode::RINGTONE, | 1354 | for (AudioMode mode : {AudioMode::IN_CALL, AudioMode::IN_COMMUNICATION, AudioMode::RINGTONE, |
1284 | AudioMode::NORMAL /* Make sure to leave the test in normal mode */}) { | 1355 | AudioMode::NORMAL /* Make sure to leave the test in normal mode */}) { |
1285 | SCOPED_TRACE("mode=" + toString(mode)); | 1356 | ASSERT_OK(device->setMode(mode)) << "mode=" << toString(mode); |
1286 | ASSERT_OK(device->setMode(mode)); | ||
1287 | } | 1357 | } |
1288 | } | 1358 | } |
1289 | 1359 | ||
diff --git a/audio/core/all-versions/default/include/core/all-versions/default/Device.impl.h b/audio/core/all-versions/default/include/core/all-versions/default/Device.impl.h index 37b7124a..230b8de2 100644 --- a/audio/core/all-versions/default/include/core/all-versions/default/Device.impl.h +++ b/audio/core/all-versions/default/include/core/all-versions/default/Device.impl.h | |||
@@ -41,23 +41,7 @@ Device::~Device() { | |||
41 | } | 41 | } |
42 | 42 | ||
43 | Result Device::analyzeStatus(const char* funcName, int status) { | 43 | Result Device::analyzeStatus(const char* funcName, int status) { |
44 | if (status != 0) { | 44 | return util::analyzeStatus("Device", funcName, status); |
45 | ALOGW("Device %p %s: %s", mDevice, funcName, strerror(-status)); | ||
46 | } | ||
47 | switch (status) { | ||
48 | case 0: | ||
49 | return Result::OK; | ||
50 | case -EINVAL: | ||
51 | return Result::INVALID_ARGUMENTS; | ||
52 | case -ENODATA: | ||
53 | return Result::INVALID_STATE; | ||
54 | case -ENODEV: | ||
55 | return Result::NOT_INITIALIZED; | ||
56 | case -ENOSYS: | ||
57 | return Result::NOT_SUPPORTED; | ||
58 | default: | ||
59 | return Result::INVALID_STATE; | ||
60 | } | ||
61 | } | 45 | } |
62 | 46 | ||
63 | void Device::closeInputStream(audio_stream_in_t* stream) { | 47 | void Device::closeInputStream(audio_stream_in_t* stream) { |
diff --git a/audio/core/all-versions/default/include/core/all-versions/default/Stream.impl.h b/audio/core/all-versions/default/include/core/all-versions/default/Stream.impl.h index 74151125..72d7a376 100644 --- a/audio/core/all-versions/default/include/core/all-versions/default/Stream.impl.h +++ b/audio/core/all-versions/default/include/core/all-versions/default/Stream.impl.h | |||
@@ -101,11 +101,15 @@ Return<void> Stream::getSupportedSampleRates(AudioFormat format, | |||
101 | halSampleRates = | 101 | halSampleRates = |
102 | samplingRatesFromString(halListValue.string(), AudioParameter::valueListSeparator); | 102 | samplingRatesFromString(halListValue.string(), AudioParameter::valueListSeparator); |
103 | sampleRates.setToExternal(halSampleRates.editArray(), halSampleRates.size()); | 103 | sampleRates.setToExternal(halSampleRates.editArray(), halSampleRates.size()); |
104 | // Legacy get_parameter does not return a status_t, thus can not advertise of failure. | ||
105 | // Note that this method must succeed (non empty list) if the format is supported. | ||
106 | if (sampleRates.size() == 0) { | ||
107 | result = Result::NOT_SUPPORTED; | ||
108 | } | ||
104 | } | 109 | } |
105 | #ifdef AUDIO_HAL_VERSION_2_0 | 110 | #ifdef AUDIO_HAL_VERSION_2_0 |
106 | _hidl_cb(sampleRates); | 111 | _hidl_cb(sampleRates); |
107 | #endif | 112 | #elif AUDIO_HAL_VERSION_4_0 |
108 | #ifdef AUDIO_HAL_VERSION_4_0 | ||
109 | _hidl_cb(result, sampleRates); | 113 | _hidl_cb(result, sampleRates); |
110 | #endif | 114 | #endif |
111 | return Void(); | 115 | return Void(); |
@@ -126,6 +130,11 @@ Return<void> Stream::getSupportedChannelMasks(AudioFormat format, | |||
126 | for (size_t i = 0; i < halChannelMasks.size(); ++i) { | 130 | for (size_t i = 0; i < halChannelMasks.size(); ++i) { |
127 | channelMasks[i] = AudioChannelBitfield(halChannelMasks[i]); | 131 | channelMasks[i] = AudioChannelBitfield(halChannelMasks[i]); |
128 | } | 132 | } |
133 | // Legacy get_parameter does not return a status_t, thus can not advertise of failure. | ||
134 | // Note that this method must succeed (non empty list) if the format is supported. | ||
135 | if (channelMasks.size() == 0) { | ||
136 | result = Result::NOT_SUPPORTED; | ||
137 | } | ||
129 | } | 138 | } |
130 | #ifdef AUDIO_HAL_VERSION_2_0 | 139 | #ifdef AUDIO_HAL_VERSION_2_0 |
131 | _hidl_cb(channelMasks); | 140 | _hidl_cb(channelMasks); |
diff --git a/wifi/1.2/default/wifi_legacy_hal.cpp b/wifi/1.2/default/wifi_legacy_hal.cpp index c314e645..375204c7 100644 --- a/wifi/1.2/default/wifi_legacy_hal.cpp +++ b/wifi/1.2/default/wifi_legacy_hal.cpp | |||
@@ -494,10 +494,6 @@ wifi_error WifiLegacyHal::setPacketFilter(const std::string& iface_name, | |||
494 | 494 | ||
495 | std::pair<wifi_error, std::vector<uint8_t>> | 495 | std::pair<wifi_error, std::vector<uint8_t>> |
496 | WifiLegacyHal::readApfPacketFilterData(const std::string& iface_name) { | 496 | WifiLegacyHal::readApfPacketFilterData(const std::string& iface_name) { |
497 | if (global_func_table_.wifi_read_packet_filter == nullptr) { | ||
498 | return {WIFI_ERROR_NOT_SUPPORTED, {}}; | ||
499 | } | ||
500 | |||
501 | PacketFilterCapabilities caps; | 497 | PacketFilterCapabilities caps; |
502 | wifi_error status = global_func_table_.wifi_get_packet_filter_capabilities( | 498 | wifi_error status = global_func_table_.wifi_get_packet_filter_capabilities( |
503 | getIfaceHandle(iface_name), &caps.version, &caps.max_len); | 499 | getIfaceHandle(iface_name), &caps.version, &caps.max_len); |
diff --git a/wifi/1.2/default/wifi_legacy_hal_stubs.cpp b/wifi/1.2/default/wifi_legacy_hal_stubs.cpp index 24aaf154..fc28bb55 100644 --- a/wifi/1.2/default/wifi_legacy_hal_stubs.cpp +++ b/wifi/1.2/default/wifi_legacy_hal_stubs.cpp | |||
@@ -130,6 +130,7 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { | |||
130 | populateStubFor(&hal_fn->wifi_nan_data_end); | 130 | populateStubFor(&hal_fn->wifi_nan_data_end); |
131 | populateStubFor(&hal_fn->wifi_get_packet_filter_capabilities); | 131 | populateStubFor(&hal_fn->wifi_get_packet_filter_capabilities); |
132 | populateStubFor(&hal_fn->wifi_set_packet_filter); | 132 | populateStubFor(&hal_fn->wifi_set_packet_filter); |
133 | populateStubFor(&hal_fn->wifi_read_packet_filter); | ||
133 | populateStubFor(&hal_fn->wifi_get_roaming_capabilities); | 134 | populateStubFor(&hal_fn->wifi_get_roaming_capabilities); |
134 | populateStubFor(&hal_fn->wifi_enable_firmware_roaming); | 135 | populateStubFor(&hal_fn->wifi_enable_firmware_roaming); |
135 | populateStubFor(&hal_fn->wifi_configure_roaming); | 136 | populateStubFor(&hal_fn->wifi_configure_roaming); |