Commit graph

840 commits

Author SHA1 Message Date
Eric Laurent
9866a1b22d Merge "Audio HAL: Add API to attach an effect to a device" 2019-12-14 00:31:42 +00:00
Automerger Merge Worker
9ce348e0fc Merge "audio: Ignore ENOSYS from optional legacy HAL methods" am: a659ab610b am: 8cd2f70c58 am: 4dab7f1e9c
Change-Id: I911fc7096b9ead0504c67319bd339442a16ceb6c
2019-12-13 17:56:41 +00:00
Treehugger Robot
a659ab610b Merge "audio: Ignore ENOSYS from optional legacy HAL methods" 2019-12-13 17:23:44 +00:00
Eric Laurent
6c29bf2096 Audio HAL: Add API to attach an effect to a device
Add a method to IDevice interface allowing the attachement of an
audio effect to an audio device.
This is used when an audio effect is implemented below the HAL (e.g by an audio DSP)
and is attached/enabled when a particular sink(e.g speaker) or source(e.g mic) device
is selected.

Bug: 136294538
Test: make
Change-Id: I73d78c4f234fd80443a1cb3772c2d65457968652
2019-12-12 14:16:38 -08:00
Nicholas Ambur
ad84668d29 Merge "add SoundTrigger HAL V2.3" 2019-12-12 21:37:00 +00:00
Eric Laurent
00a501a992 Merge "audio: add call assistant usage" 2019-12-12 18:10:42 +00:00
Nicholas Ambur
1e90019220 add SoundTrigger HAL V2.3
add support for model parameter control APIs with THRESHOLD_FACTOR
as the first supported parameter

Bug: 141929369
Test: Tested manually with test app, GTS test
gts-tradefed run gts-dev -m GtsAssistIntentTestCases
and VTS test
vts-tradefed run vts-hal -m VtsHalSoundtriggerV2_3Target
Change-Id: I79d2b6365cc63fbdfe06fa94f1d0878903cbf554
2019-12-11 19:42:51 -08:00
TreeHugger Robot
dca3a5763b Merge "audio: Add check for MMap buffer size to the default implementation" 2019-12-12 00:41:27 +00:00
Automerger Merge Worker
8a5ee4e1a1 Merge "audio VTS: Fix call to IDevice::close in V6 tests" am: e82bfc646f am: b479a2793b am: b092fd6270
Change-Id: Ia7809f75b5138a774b0543d21b983c07a417c9b1
2019-12-12 00:16:27 +00:00
Mikhail Naganov
4135fa4e59 audio: Ignore ENOSYS from optional legacy HAL methods
Some methods of legacy HALs are optional. The legacy HAL
can avoid implementing them either by setting the function
entry in the interface table to NULL or by setting it
to a stub function returning -ENOSYS. In the latter case
the default implementation was spamming syslog with
warnings. Specify that ENOSYS returned from optional legacy
HAL methods must be ignored.

Bug: 141989952
Test: check logcat
Change-Id: Idbdff8d88e3303a0181cb5629ab82485148e6d8e
2019-12-11 15:57:53 -08:00
Mikhail Naganov
b2178b9248 audio: Add check for MMap buffer size to the default implementation
Add documentation and check that 'minSizeFrames' parameter
is a positive value. Previously a similar check was added
to Pixel HAL.

Bug: 141989952
Test: atest VtsHalAudioV6_0TargetTest
Change-Id: I526431fc214f7f5bc424f0c9e4c890cf918ca2b2
2019-12-11 15:07:47 -08:00
Mikhail Naganov
777a4d473c audio VTS: Fix call to IDevice::close in V6 tests
The result of RPC calls of HAL methods must be checked.
Added a check of result of calling IDevice::close added
for V6.

Bug: 114451103
Test: atest VtsHalAudioV6_0TargetTest
Change-Id: Ib6276382f15f122b43f314cf64cac2c3242bb76c
2019-12-11 14:39:01 -08:00
Eric Laurent
3c181a6fd6 audio: add call assistant usage
Add audio usage for call assistant use cases.
Used by apps playing over call uplink path for call
screening or other in call assitant features.

Bug: 135213843
Test: make
Change-Id: I7eeea676fe188946ff86f1e11e8e00a624a4ec5c
2019-12-11 13:51:13 -08:00
TreeHugger Robot
0f2ba63003 Merge "Add AUDIO_INPUT_FLAG_DIRECT to Audio HAL constants" 2019-12-11 21:36:51 +00:00
Mikhail Naganov
d334593715 Add AUDIO_INPUT_FLAG_DIRECT to Audio HAL constants
This flag used to be framework only. To simplify constants
management it's better to have it defined at all layers.
Currently it is only used for MSD module but potentially
can be used for HDMI inputs.

Bug: 141273649
Test: use AOSP MSD on Pixel
      atest VtsHalAudioV6_0TargetTest

Change-Id: I3b853d5d0a05cc4d4bacd0a9ae432099bb47fad9
2019-12-10 16:47:00 -08:00
Eric Laurent
ceaeee1d73 Audio effect HAL: Add device ID to createEffect API
Add the possibility to specify a target audio device when
creating an audio effect by passing its audio port handle
to createEffect API.

To attach an effect to a device, the framework will use
session ID AudioSessionConsts.DEVICE and provide a valid
AudioPortHandle as device ID.

Bug: 136294538
Test: make
Change-Id: Ic697eeafbd5df6800ad4c7fd9e0698e3d8e3beae
2019-12-09 09:46:37 -08:00
Eric Laurent
6d48565360 audio: add audio session for device effects
Add specific audio session ID for effects applied to a
particular audio device.

Bug: 136294538
Test: make
Change-Id: Iea3e3a07f404e1075844422c740d2dc4d5163598
2019-12-06 12:26:26 -08:00
Treehugger Robot
d3a2bdfc63 Merge "Refactor for audio device type in conversion." 2019-12-05 20:17:59 +00:00
jiabin
f17047d892 Refactor for audio device type in conversion.
As audio device type can not be used as bit mask any more, refactoring
audio device type usages in conversion from/to HAL. Use a set of audio
device types instead of bit mask.

Bug: 135621476
Test: atest VtsHalAudioV5_0TargetTest
Change-Id: I1a0f574744f855bb1684cd28613571399781abbc
Merged-In: I1a0f574744f855bb1684cd28613571399781abbc
2019-12-04 17:51:05 -08:00
Mikhail Naganov
2cee5c316e Audio HAL: Fix UAF if the effect is removed after close am: 532240f4eb am: 78836599d2
am: 21dfccb823

Change-Id: I0c607d42aa174c7e50ee53b838a811ae00c33970
2019-12-04 17:41:20 -08:00
Mikhail Naganov
532240f4eb Audio HAL: Fix UAF if the effect is removed after close
Effect::close in V6 releases the underlying HAL effect.
It was not removing the effect entry from the effects
map, thus a call to Stream::removeEffect was retrieving
a stale handle.

Bug: 145656878
Test: start and stop recording for VOICE_COMMUNICATION
Change-Id: I47f486d3b6b4b0dc29acd1e3a2093e421b28d90b
2019-12-04 16:21:28 -08:00
Automerger Merge Worker
dcd93513e6 Merge "audio VTS: Fix parametrization for compressed formats" am: bff764d944 am: 630fc31844
Change-Id: Ie590fa7df4cb59c0266831f4d76874c1864a3996
2019-12-04 17:11:11 +00:00
Treehugger Robot
bff764d944 Merge "audio VTS: Fix parametrization for compressed formats" 2019-12-03 23:59:15 +00:00
Mikhail Naganov
26d535b58e audio VTS: Fix parametrization for compressed formats
Compressed formats should not be opened with DIRECT flag
only, as this will result in playing out compressed data.

Bug: 141989952
Test: atest VtsHalAudioV6_0TargetTest
Change-Id: I873f9a25d5109fb9f5d56f5f748d1348dc12d416
2019-12-03 10:45:23 -08:00
Steven Moreland
c2a2995047 Merge "./update-makefiles.sh, for union changes/memory" am: 00daede4d5 am: 0942e33017
am: 87fe284668

Change-Id: I3a331b5e1c5418426a084f1c7bfe436214a1b68f
2019-11-26 15:00:11 -08:00
Treehugger Robot
00daede4d5 Merge "./update-makefiles.sh, for union changes/memory" 2019-11-26 22:47:34 +00:00
jiabin
5da42a3e3a Use audio containers from libaudiofoundation.
It is suggested to do so according to Vector.h and SortedVector.h.
At framework side, there are audio containers such as FormatVector,
ChannelMaskSet, SampleRateSet to replace the usage of Vector
SortedVector for audio stuff. In default hal implementation, we can
use these audio containers to replace Vector and SortedVector.

Bug: 135621476
Test: play/record audio
Change-Id: I4d985327fb76cd06afe241860d8b592abcbfe4f2
Merged-In: I4d985327fb76cd06afe241860d8b592abcbfe4f2
2019-11-26 11:41:24 -08:00
jiabin
797b5b45fc Add libaudiofoundation.
Some classes, e.g. AudioGain, in libaudiofoundation, which are used by
libaudiopolicycomponent, will require libaudiofoundation as a shared
library to avoid link error when building.

Bug: 135621476
Test: make
Change-Id: I8732bdab37d8afd866fe03a74db3dc564fea1ad2
Merged-In: I8732bdab37d8afd866fe03a74db3dc564fea1ad2
2019-11-26 11:29:34 -08:00
Steven Moreland
7696aa885f ./update-makefiles.sh, for union changes/memory
Many more types can be used in Java.

Bug: 143566068
Test: N/A
Change-Id: Ie18e1e0f9c22f2ea15b755df3b048c9d651c4945
2019-11-26 09:24:31 -08:00
TreeHugger Robot
1b863c2f9d Merge "Refactor for audio device type in conversion." 2019-11-25 20:04:44 +00:00
Mikhail Naganov
e74d8746cf Merge changes from topic "upstream-close-fixes" am: 7663233f5c am: b6d82825e0
am: 88e9203701

Change-Id: If85dd058799aede5b0770e52b0185d3405f44269
2019-11-25 07:40:37 -08:00
Mikhail Naganov
c48c24bbc9 audio: Factor out IStream operations into a helper class am: 422afc131a am: b0b24baabf
am: b15071a05e

Change-Id: I983c466c2abe0c69fd67105f4dbdfe59e1112757
2019-11-25 07:40:33 -08:00
Mikhail Naganov
7e241b350b audio: Cleanup VTS tests am: 13b99b4cf4 am: 740cb65b21
am: 598db7088c

Change-Id: I0ec9112a79bd66c506228c8b7bc56931c0847536
2019-11-25 07:40:29 -08:00
jiabin
98fd544712 Refactor for audio device type in conversion.
As audio device type can not be used as bit mask any more, refactoring
audio device type usages in conversion from/to HAL. Use a set of audio
device types instead of bit mask.

Bug: 135621476
Test: atest VtsHalAudioV5_0TargetTest
Change-Id: I1a0f574744f855bb1684cd28613571399781abbc
2019-11-22 16:44:34 -08:00
TreeHugger Robot
947a2172e0 Merge "audio effect: Avoid using stack-allocated arrays" 2019-11-22 02:18:26 +00:00
Mikhail Naganov
2a652cec4b audio effect: Avoid using stack-allocated arrays
This is to prevent OOB write in case when a sufficiently
large HIDL vector is provided via a HwBinder call.

Bug: 143787559
Test: atest VtsHalAudioEffectV5_0TargetTest
Change-Id: I6ea78804a5a3ed7a245929d3de47580b12c0da9a
2019-11-21 14:05:45 -08:00
Mikhail Naganov
ed261bbfb1 audio: Add check to IDevice.close for currently opened streams
IDevice.close must not proceed if there are streams
that are currently opened on this device.

Bug: 114451103
Test: atest VtsHalAudioV6_0TargetTest
Change-Id: I61d81bc0333098c341d5d551bf59331e49fcf682
2019-11-21 12:32:09 -08:00
Mikhail Naganov
422afc131a audio: Factor out IStream operations into a helper class
Bug: 114451103
Test: atest VtsHalAudioV5_0TargetTest
      atest VtsHalAudioV6_0TargetTest

Change-Id: I7c1b16df2b52fd5279ff1f431bfc7269fb9cd8f6
2019-11-21 11:01:28 -08:00
Mikhail Naganov
13b99b4cf4 audio: Cleanup VTS tests
Remove getSupported*AudioConfig methods as they were always
returning empty vector, and for V6 test parameter generation
has been changed.

Test: atest VtsHalAudioV5_0TargetTest
Change-Id: Ib6f53c52b3ee2769cb02730d02decd97390fe091
2019-11-21 11:01:18 -08:00
Mikhail Naganov
a4b693f5da Audio VTS: Fix MMAP tests
Ensure stream test runs for output MMAP profiles.

Enhance checks for MMAP buffer size.

Bug: 144575694
Test: atest VtsHalAudioV6_0TargetTest
Change-Id: I93e66b12c93c466d661e65c4dbbb5deb32772848
Merged-In: I93e66b12c93c466d661e65c4dbbb5deb32772848
2019-11-21 10:57:19 -08:00
Mikhail Naganov
d041930df9 Audio V6 wrapper: IDevice|IStream|IEffect.close releases HAL resource
Fixed behavior of IStream|IEffect.close to release the underlying
HAL resource synchronously. This is to avoid adding artificial
delays in VTS that become totally unpractical in V6.

Added clarification about expected client behavior for
IStream|IEffect.close w.r.t. audio data transfer.

Added IDevice.close method which releases HAL device resource.

Updated VTS tests to remove delays in V6.

Bug: 114451103
Bug: 141989952
Test: atest VtsHalAudioV6_0TargetTest
Change-Id: I439f0f923c091af2ab234d15ca847cfade341f25
Merged-In: I439f0f923c091af2ab234d15ca847cfade341f25
2019-11-21 10:56:25 -08:00
Lloyd Pique
43286a882b Merge "audio: Remove redundant PrintTo definitions" am: 7582ba18ee am: c93cb2e4b4
am: b72d057e24

Change-Id: I759f0e3a808780eb8b686d2553efeb96e46c3b7f
2019-11-20 15:02:12 -08:00
Lloyd Pique
97bc3fba7b audio: Remove redundant PrintTo definitions
hidl-gen now generates them for use by all Google Tests, calling
toString().

The local audio PrintTo definitions in PrettyPrintAudioTypes.h are now
redundant with the generated versions, and the entire header can be
removed.

Test: Verified the generated PrintTo functions work in a different GTest
Change-Id: I80d100907e3c6c638608b0b8b34232b02decac19
2019-11-19 14:45:32 -08:00
TreeHugger Robot
dda33b5d7a Merge "Audio V6 wrapper: IDevice|IStream|IEffect.close releases HAL resource" 2019-11-19 21:00:41 +00:00
TreeHugger Robot
594090a5b1 Merge "Audio VTS: Fix MMAP tests" 2019-11-19 19:56:46 +00:00
Mikhail Naganov
a70e4317e6 Audio VTS: Fix MMAP tests
Ensure stream test runs for output MMAP profiles.

Enhance checks for MMAP buffer size.

Bug: 144575694
Test: atest VtsHalAudioV6_0TargetTest
Change-Id: I93e66b12c93c466d661e65c4dbbb5deb32772848
2019-11-18 11:53:39 -08:00
Mikhail Naganov
7623ed9258 Audio V6 wrapper: IDevice|IStream|IEffect.close releases HAL resource
Fixed behavior of IStream|IEffect.close to release the underlying
HAL resource synchronously. This is to avoid adding artificial
delays in VTS that become totally unpractical in V6.

Added clarification about expected client behavior for
IStream|IEffect.close w.r.t. audio data transfer.

Added IDevice.close method which releases HAL device resource.

Updated VTS tests to remove delays in V6.

Bug: 114451103
Bug: 141989952
Test: atest VtsHalAudioV6_0TargetTest
Change-Id: I439f0f923c091af2ab234d15ca847cfade341f25
2019-11-18 11:39:26 -08:00
chenhg
b49da5d3c9 Merge "audio: add 'useForVolume' field to 'gain'." am: d0470d9440 am: ce4b75195f
am: 2a2216af6e

Change-Id: Ib50bd6aa1f95cd391c3bcf4484fc78b5f4e50974
2019-11-18 08:53:20 -08:00
chenhg
a53c280301 audio: add 'useForVolume' field to 'gain'.
BUG: 144081761
Test: xmllint --noout --xinclude --schema \
      hardware/interfaces/audio/5.0/config/audio_policy_configuration.xsd \
      frameworks/av/services/audiopolicy/config/audio_policy_configuration*.xml
      xmllint --noout --schema \
      hardware/interfaces/audio/5.0/config/audio_policy_configuration.xsd \
      --xinclude out/target/product/*/vendor/etc/audio_policy_configuration.xml

Change-Id: I0ee9114f750186b479a2ebee5dfcd946d9ef3196
2019-11-15 10:39:58 -08:00
Mikhail Naganov
60bd3ecc5d audio: Run VTS tests for streams of non-primary modules for HAL V6
Implement parsing of AudioPolicyManager config for finding
out supported format configurations of streams. This only applies
when running tests for HAL V6. Previously format configurations
mandated by CDD were used for testing, this does not work well
for non-primary modules.

Fix the following issues found while running the tests
for "r_submix" and "msd" modules:

- IStream::getSupportedFormats must return a status
  to indicate that this capability is not supported by HAL;

- it is allowed for IStream::setDevices to return
  NOT_SUPPORTED status.

Other changes:

- Factor out helper functions for generating format
  configurations;

- Fix generation of the channel mask component in the names
  of tests that use AudioConfig, add sampling rate to test
  names.

Squashed with the following commit to avoid breaking compilation:

audio vts: Remove explicit dependency on the new types

Avoid using the new ChannelMaskSet and SampleRateSet types
directly to simplify upstreaming.

Bug: 141989952
Bug: 141847510
Test: atest VtsHalAudioV5_0TargetTest
      atest VtsHalAudioV6_0TargetTest
            also, run modified V5_0 test using generators for V6_0

Change-Id: If0d330881901908e546baab89f63d3333003e355
Merged-In: If0d330881901908e546baab89f63d3333003e355
2019-11-11 10:29:06 -08:00