Commit graph

156 commits

Author SHA1 Message Date
Mikhail Naganov
b0c4bd081e Revert "audio: Align lists of enum values between framework and HAL"
Revert submission 12851233-hal-enum-strings

Reason for revert: breaks slider device
Reverted Changes:
I4f64a8b61:Use system/audio to/from string converters in Type...
Iddaa92bf2:Move enums shared with HAL to audio-hal-enums.h
Ie5896775b:audio: Align lists of enum values between framewor...

Bug: 171262726
Change-Id: I35c1acf6ed07b533292d1264b6237766458fd711
2020-10-20 01:29:53 +00:00
Mikhail Naganov
8d8dfcd8ed audio: Align lists of enum values between framework and HAL
Enum values defined in the XSD now correspond to the
"no system definitions" lists of enums in
system/media/audio/audio-hal-enums.h.

Added channel masks that used to be in s/m/a/audio-base-utils.h.
Removed use of "vectors of vectors" for channel masks
since individual channels are not allowed to be used
in the APM config and at the HAL transport level.

Fixed definition of the gain mode of audio ports:

1. Since it's a bit mask in the framework, it must be a list in
   the audio policy configuration XML file. Note that the old
   definition is compatible with the new one as one element is a
   valid list.
2. As gain mode is defined in the XSD file, it shouldn't be
   defined again in types.hal.

Added 'AUDIO_SOURCE_HOTWORD'.

Bug: 122858783
Bug: 142480271
Test: audio smoke tests
Change-Id: Ie5896775b6bc7dfd3ab158c4a7b497dbda827e9d
2020-10-16 23:01:13 +00:00
Mikhail Naganov
9da19c7cfa Convert mask types from uint32_t to enum type
This applies to the following types:

- audio_gain_mode_t;
- audio_flags_mask_t;
- audio_channel_representation_t;
- audio_channel_mask_t;
- audio_devices_t.

Enum types are distinct thus proper overloading on the type
is possible in C++. Also, assignments to enum types are
less prone to errors.

Bug: 169889714
Test: basic audio functionality
Change-Id: I07e96ae99724f38fe0b40194f4feab7ff68418e7
2020-10-08 17:25:09 +00:00
Mikhail Naganov
343450a074 audio: Implement VTS tests for V7.0
The major change in V7.0 is use of enum values defined
in the Audio Policy Configuration XSD schema. This allows
decoupling types used at the HIDL layer from system/audio.h.
Added a header audio_policy_configuration_V7_0-enums.h
with utility functions analogous to ones from system/audio.h
but defined for the types generated from XSD schema.

Since the code of VTS tests is shared between versions,
ensured that the VTS tests for the previous HAL versions
didn't regress.

Bug: 142480271
Test: atest VtsHalAudioV6_0TargetTest
      atest VtsHalAudioEffectV6_0TargetTest
      atest VtsHalAudioV7_0TargetTest
      atest VtsHalAudioEffectV7_0TargetTest
Change-Id: Ia7c2d49a02783725080c8fed6a25853e91bba487
2020-09-29 17:45:13 +00:00
Mikhail Naganov
648ec5b750 audio: HAL V7 tweaks
- rename AudioBasicConfig -> AudioConfigBase to better
  match a similar structure in audio.h;

- define AudioProfile structure for defining an I/O profile;

- use AudioProfile to replace IStream.getSupported* methods
  with a single IStream.getSupportedProfiles method;

- define AudioDevice type for convenience and clarity;

- move enums definition for AudioInputFlags and AudioOutputFlags
  into XSD. This allows parsing APM config w/o depending on
  the framework code.

Bug: 142480271
Test: m
Change-Id: I1951b2de383751fe53b96954dfd02cdd1ab6cc8f
2020-09-28 18:55:50 +00:00
Dan Shi
6b0fd062bb Suppress gtest error for tests without any instance
Bug: 162052785
Test: m -j vts
Change-Id: I627d6790aa08aa9c6e3c5b8bdc533213ee08de21
2020-09-08 10:42:38 -07:00
Mikhail Naganov
6cd03bfdb9 Audio: Build file updates
Add target for the library with code generated by xsdc.

Temporarily disable default implementation and VTS targets.

Bug: 142480271
Test: m
Change-Id: I6c891893398617a36f4748f185e189064ba4d4ee
2020-08-14 18:13:31 +00:00
Mikhail Naganov
159260c586 Audio: Copy HAL V6 into V7
This is an automated copy performed using copyHAL.sh script.

Bug: 142480271
Test: m
Change-Id: Ifd91cc0bb59608cd92d1d8e4e76c3abea0a8da5e
2020-08-14 18:13:31 +00:00
Jasmine Cha
58a2095cc0 Audio VTS: Fix empty parameter list failures for AudioV6 am: 1eb1f36877 am: 0c0bdf4db2
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1382482

Change-Id: I7798e6c080a090459a646d9ee3013f3d101b5978
2020-08-03 20:33:06 +00:00
Jasmine Cha
1eb1f36877 Audio VTS: Fix empty parameter list failures for AudioV6
For AudioV6, OptionalInputBufferSizeTest isn't included in macro
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST.

Bug: 162715033
Test: atest VtsHalAudioV6_0TargetTest

Signed-off-by: Jasmine Cha <chajasmine@google.com>
Change-Id: I526fe166594283540804ee61265c6000de5a89e8
2020-08-03 08:49:38 +00:00
Treehugger Robot
3ef9947624 Merge "Provide defaults for android.hardware.audio@6.0-impl" am: 3f5116a1f6 am: 5912212c62
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1366502

Change-Id: Ib211fdb5c61f6ad1893561d9bd6d86bff0b28178
2020-07-22 17:05:44 +00:00
Treehugger Robot
3f5116a1f6 Merge "Provide defaults for android.hardware.audio@6.0-impl" 2020-07-22 16:37:39 +00:00
Mikhail Naganov
4084fa17b5 Audio VTS: Suppress empty parameter list failures am: b9743d4728 am: 948929d067
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1368656

Change-Id: I3d5925bd34bd84cbf65cf6f86797c1a4f4263ac6
2020-07-22 00:33:45 +00:00
Mikhail Naganov
b9743d4728 Audio VTS: Suppress empty parameter list failures
GTest has introduced a check verifying that the parameter list
for TEST_P tests isn't empty. Having an empty parameter list
isn't actually a problem when the VTS test runs on a device
that lacks the corresponding HAL version.

Bug: 161758075
Test: atest VtsHalAudioV4_0TargetTest
Test: atest VtsHalAudioV5_0TargetTest
Test: atest VtsHalAudioV6_0TargetTest
Test: atest VtsHalAudioEffectV4_0TargetTest
Test: atest VtsHalAudioEffectV5_0TargetTest
Test: atest VtsHalAudioEffectV6_0TargetTest
Change-Id: Ib2a017b74f69b1608d8985f403e9b2a8e54b8311
2020-07-21 10:57:03 -07:00
Roman Kiryanov
411edccbb3 Provide defaults for android.hardware.audio@6.0-impl
This will allow vendors to create instances of
this library with other names. A different name
is required if a vendor wants to provide a custom
version (e.g. in HIDL) of
android.hardware.audio@6.0-impl and still
be able to use the library itself (e.g. to load
audio.r_submix.default) -
android.hardware.audio.service does not load both
libraries and prefers the default one.

Bug: 161485545
Test: boot emulator, check if audio works
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: I55c4f9b1386be3464ad0f5f2568423843e7eae88
2020-07-20 16:08:17 -07:00
Inseob Kim
e396a3d004 Use shared variant of VNDK libmedia_helper
Vendor modules should use shared VNDK.

Bug: 137178339
Test: m && boot blueline
Change-Id: I56ad69125811ff768d8064af34acf5603b575b4b
Merged-In: I56ad69125811ff768d8064af34acf5603b575b4b
2020-07-20 16:08:00 -07:00
Dan Shi
3b6534e36d Use StopServicesSetup to stop/start framework. am: 8a648312f8 am: 95d430d6c8
Change-Id: I96a02ab530d4efd386c5f835bbb932e62ea8ea7d
2020-05-13 18:19:37 +00:00
Dan Shi
8a648312f8 Use StopServicesSetup to stop/start framework.
Bug: 155774142
Test: none
Exempt-From-Owner-Approval: This CL replaces target preparer, shouldn't
change test behavior.

Change-Id: I83cffadfff15e6352a69641c3227efb63e7a34e4
2020-05-12 14:07:30 -07:00
Treehugger Robot
09f4f0b61b Merge "audio: Centralize audio configuration paths specification" am: c2e1f3baef am: fefefa63a6
Change-Id: I029ebd83595381768858cbb3efe92c2f3b09ffac
2020-04-16 23:35:46 +00:00
Mikhail Naganov
5a6ffb21a5 audio: Centralize audio configuration paths specification
The list of possible paths for the audio configuration
files is now retrieved using audio_get_configuration_paths()
function. All duplicated lists of known configuration
directories have been removed.

Bug: 153680356
Test: atest VtsHalAudioV5_0TargetTest \
            VtsHalAudioPolicyV1_0TargetTest \
            VtsHalAudioEffectV5_0TargetTest
Change-Id: I1e40fdf8d6e3a5ac339f7f138f62063bb87bd3da
2020-04-15 10:09:38 -07:00
Dan Shi
eb5f33e0ef Rename vts-core to vts am: ba894f81db am: 55d110bcd0
Change-Id: Ifc137320af42febc24937f09e5baa4c5a95ac1c4
2020-04-07 23:56:42 +00:00
Dan Shi
ba894f81db Rename vts-core to vts
Bug: 151896491
Test: local build
Exempt-From-Owner-Approval: This CL update suite name vts-core to vts as
the suite name is updated. This CL won't change test logic or behavior.

Change-Id: I562b4dc50765e953800a814a8fd84a01c1b9352b
Merged-In: I562b4dc50765e953800a814a8fd84a01c1b9352b
2020-04-07 15:17:02 -07:00
Mikhail Naganov
5e45410c9a Merge "audio: Check result from oneway calls" into rvc-dev am: 6d0d85d9b2
Change-Id: Ia77d1abf145193f718eff3cde21d1663a10f8d2f
2020-03-20 02:23:01 +00:00
Mikhail Naganov
2adec4f116 audio: Check result from oneway calls
As oneway HIDL calls generate methods that return 'Result<void>',
the returned value must be checked to avoid triggering an
assertion if the result was an error (e.g. due to the client death).

Bug: 151900655
Test: N/A
Change-Id: I4721240b5959d6f11cb4447b30928bf4c83da058
2020-03-19 20:39:12 +00:00
Dan Shi
daa2999781 Merge "Convert VtsHalAudioV*_0TargetTest to parameterized gtest" am: 1b03269ec7 am: e904793d4b
Change-Id: Ib7d0098575ca6f5fd6b963e5f016956b7fb6d2ba
2020-03-17 23:07:14 +00:00
Dan Shi
82cf1f1bb2 Convert VtsHalAudioV*_0TargetTest to parameterized gtest
For version 2, 4 and 5.

Bug: 150299743
Test: atest VtsHalAudioV2_0TargetTest \
  VtsHalAudioV4_0TargetTest \
  VtsHalAudioV5_0TargetTest
Change-Id: I09be1dc79b69caadd2a5468c4e6ed9c1efd76ffd
2020-03-17 13:12:42 -07:00
Mikhail Naganov
d24ab2ba3a Update audio VTS source code to match the change in AudioPolicyConfig
Use getInputDevices instead of getAvailableInputDevices.

Bug: 149854039
Test: atest VtsHalAudioV5_0TargetTest
Change-Id: I0fed71eba8d031465ef98da2bf6be16c2fbfb5ff
Merged-In: I0fed71eba8d031465ef98da2bf6be16c2fbfb5ff
2020-03-10 15:36:43 -07:00
TreeHugger Robot
ce3f17e662 Merge "Update audio VTS source code to match the change in AudioPolicyConfig" into rvc-dev 2020-03-10 19:07:24 +00:00
Mikhail Naganov
20a3e395bf Update audio VTS source code to match the change in AudioPolicyConfig
Use getInputDevices instead of getAvailableInputDevices.

Bug: 149854039
Test: atest VtsHalAudioV5_0TargetTest
Change-Id: I0fed71eba8d031465ef98da2bf6be16c2fbfb5ff
2020-03-09 23:31:29 +00:00
jiabin
5d11612694 Add callback for output stream.
The callback is targeted for events related to an output stream.
Currently, there is one callback event defined, which is codec
format changed event.

Bug: 133526565
Test: manual
Test: atest VtsHalAudioV6_0TargetTest
Change-Id: I73a4914c1ffc30e1c88b8fedd61a031e24a069f6
2020-02-25 09:08:26 -08:00
Andy Hung
7aab1010d4 audio hal: Update offload configuration
Test: no regression with offloaded Play Music
Bug: 133526565
Merged-In: Ie655a96503be5a4ad1660d4b2183b01e514452fd
Change-Id: Ie655a96503be5a4ad1660d4b2183b01e514452fd
(cherry picked from commit c91b679ac1)
2020-02-25 09:06:09 -08:00
Mikhail Naganov
973e4d33b5 audio: Add playback rate parameters to IStreamOut
Playback rate parameters allow changing the playback speed
of audio streams optionally preserving the pitch (this is
often referred to as "timestretch"). HALs can apply these
parameters when decoding of streams is done in hardware.

Bug: 133526565
Test: atest VtsHalAudioV6_0TargetTest
Change-Id: Ie78cd924bd034b57bf5b6a74affd62641ffc0aba
2020-02-20 11:13:14 -08:00
Mikhail Naganov
0a675fcc88 audio: Add Dual Mono Mode and Audio Description Mix Level to IStreamOut
These properties are mainly used on TV platforms.

Bug: 133526565
Test: atest VtsHalAudioV6_0TargetTest
Change-Id: I5dd2fe9cb987bf8435b8e5da96f8590288e5707c
2020-02-18 20:01:29 -08:00
Automerger Merge Worker
d0e8e5f265 Merge "[vts-core] add VtsHalAudioV6_0TargetTest to vts-core" am: a64681e3c1 am: fb2270818c am: dff53cd8b9
Change-Id: Ice48ca0a4c08c1ddfde63c23a9dcacfb3df65e6e
2020-01-25 03:34:59 +00:00
Mikhail Naganov
0debfc3cc7 [vts-core] add VtsHalAudioV6_0TargetTest to vts-core
Add necessary configuration to VtsHalAudioV6_0TargetTest.

Bug: 146015418
Bug: 146104851
Test: atest VtsHalAudioV6_0TargetTest
Change-Id: I3e1bac38598ba5909c8eeb4f83e00bfd0bbbb058
2020-01-23 13:42:15 -08:00
Jaideep Sharma
9e62926f25 audiohal : add support for call_screen mode
Bug: 140384450
Test: make
Change-Id: Iea7816ba35538e5ee966dae4f57abf147d203bd0
2020-01-23 09:37:37 -08:00
Eric Laurent
2c75ca6b27 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
Merged-In: I73d78c4f234fd80443a1cb3772c2d65457968652
2020-01-10 11:16:42 -08:00
Mikhail Naganov
6c070ca4e8 audio: Add IDevice::updateAudioPatch method
Add method 'updateAudioPatch' which should be used when
an existing patch needs to be updated with new routing.
Use of this method allows audio HAL to avoid disrupting
audio stream while changing routing.

Bug: 79248321
Test: atest VtsHalAudioV6_0TargetTest
Change-Id: I6c87f67fa4f2463ba9e8f0272a3232f5c9c55714
2019-12-13 19:28:37 -08:00
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
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
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
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