"default" implies using "primary" legacy device module.
This doesn't change anything for binderized mode, because
the server was only registering itself as "sound_trigger.primary",
so it was the only possibility anyways.
Usage of "stub" (debugging) module is still possible
if audioflinger and corresponding services are built with
USE_LEGACY_LOCAL_AUDIO_HAL=true (added makefile check to ensure
that).
Test: "Ok Google" from screen off state on sailfish
Bug: 36570720
Change-Id: I88f1ebd4c1efd0f91e37458746c336a4beef33ae
vendor_available: separate copy built on the vendor partition for
BOARD_VNDK_VERSION := current devices.
**************************************************
See full implications + warning on:
https://android-review.googlesource.com/#/c/369995/
(Ia4eb5378d941033b07673daf682e66051cd3c075)
***************************************************
Test: (sanity) audio works on internal marlin
Test: (sanity) hangouts call on internal marlin
Test: warnings don't show up on BOARD_VNDK_VERSION := current devices.
Bug: 33241851
Change-Id: I2de1b789a44d238e31108312b4ec0dd5d404b1e6
If prepareToWrite or prepareToRead fails after EventFlag is created, it
is not destroyed. This lead to strange random crashes (double free it seems).
Use the RAII pattern to manage the EventFlag life cycle.
Test: Run test on target
Bug: 36311550
Change-Id: I53a04a62b7d12fdcc94afd8ced3e547aa6edff50
Signed-off-by: Kevin Rocard <krocard@google.com>
The audio buffer size is not provided by the client, it is computed from
the sample size and the number of sample.
No check was done as if the multiplication of these two numbers would
produce an overflow. This leaded to erroneous memory access crashing the
media server.
Test: Run on target
Bug: 36311550
Change-Id: I3436800ab6ac1b5e6a6aa4d03d6b96910eb54652
Signed-off-by: Kevin Rocard <krocard@google.com>
If the requested buffer was too big, memory allocation would fail,
resulting if a audio hal crash (uncatch exception thrown by new).
Properly hadle the failure by retuning INVALID_PARAMETERS in such case.
Bug: 36311550
Test: Run test on target
Change-Id: Ib4170eb6a9f88f9352d0912083b43d600771bb8e
Signed-off-by: Kevin Rocard <krocard@google.com>
The result status was not checked.
Test: Run test on target
Bug: 36311550
Change-Id: I197b52d0b5a1276d3e3beba105bb91639f89e060
Signed-off-by: Kevin Rocard <krocard@google.com>
Some test did not have any documentation
Test: compile & run
Bug: 36311550
Change-Id: I37c40f6f17993a275e5c40b9a835ac04acf4f8e6
Signed-off-by: Kevin Rocard <krocard@google.com>
Stream objects used to hold a pointer to underlying HAL device
object which they didn't own. Since destruction of server side
objects is asynchronous, it was possible that a Device object
gets destroyed before Stream objects, making all the HAL device
object pointer to become stale.
Fixed by adding a strong reference to Device objects into Stream
objects.
Bug: 36702804
Change-Id: I3da3611afbb91d6fd6410ac5b8af2a2eebfa6dac
Test: ran Loopback app and HAL VTS tests
(cherry picked from commit 96d3573cda)
For methods that can't be meaningfully tested, add tests
verifying that they at least don't crash.
Bug: 32022706
Change-Id: I234c2ae4b6bc173450cf50e8749ea966cbc2d2a2
Test: this is a test
commit e6653b5d failed to include devices (IN|OUT)_USB_HEADSET
in (IN|OUT)_ALL and (IN|OUT)_ALL_USB masks
Test: audio playback and capture regression tests on marlin
Change-Id: I218b0c3ff868f3e1434e93a9e2fb07b3e16a2df8
Return are movable only, thus the fact that assertResult took a copy of
the value meant that the callee had to provide an rvalue.
This was not needed as the Result was not modified. Change it to a const
reference.
Test: run test on board
Bug: 34170075
Signed-off-by: Kevin Rocard <krocard@google.com>
Added tests covering IEffect, IEqualizerEffect, and
ILoudnessEnhancer interfaces.
Minor corrections in the interface definitions and implementations:
- fixed descriptions and @callflow annotations in IEffect;
- fixed type used for band levels in IEqualizerEffect;
- fixed specification of frequencies in IEqualizerEffect;
- fixed some bugs in previously non-execrices Effects code;
- warning messages changed to error messages.
Test: this is a test
Bug: 32022706
Change-Id: I0e0bc111b07d944ad8a0321e8b1ec703f8d1a73e
For now most tests are negative.
Test: run test on board
Bug: 34170075
Change-Id: Id207ae310e0fa5a3ab4db49122249594cd2c2703
Signed-off-by: Kevin Rocard <krocard@google.com>
Add negative test for the remaining methods of IStream
and positive one for most.
Test: run test on board
Bug: 34170075
Change-Id: Ib18c6d2e4d0a14ee4517f31319ddecf5e23ac8de
Signed-off-by: Kevin Rocard <krocard@google.com>
As some part of this big test were failing, it was difficult to actually
track on the dashboard what was wrong.
Split it in small independent equivalent tests.
Test: mm & run on target
Bug: 34170075
Change-Id: I03686e55ec112f0f0c0ef2683c5dc1ae79ff8d5e
Signed-off-by: Kevin Rocard <krocard@google.com>
This eases the debuging of failing tests.
Also print hex value of the enums as well of their literal values.
Test: run the test on target
Bug: 34170075
Change-Id: Iea1d7d2269e0e5b413240aaa905daae755846e74
Signed-off-by: Kevin Rocard <krocard@google.com>
ASSERT_INVALID_ARGUMENTS was a macro that asserted that a given Result
or Return contained INVALID_ARGUMENT. The problem was that a result can
have lots of other values like INVALID_STATE or NOT_SUPPORTED.
Additionally not all test expect only one possible result.
Introduce two overload of ASSERT_RESULT()
The first one takes an expected Result value and compare it to the
obtained one.
The second take a list and expect the obtained one to be in this list.
Test: run the test on target
Bug: 34170075
Change-Id: I798729f27f723c98292610bfb43dbdb2724ec2ca
Signed-off-by: Kevin Rocard <krocard@google.com>
The gtest dashboard only shows test names, not their parameters.
This mean that parametrized tests are names 0,1,2...
Thus when one test fails, the dashboard info is not very useful.
This patch appends the audio config to the test name.
Test: run the test on target
Bug: 34170075
Change-Id: I77090a3a17e4a3e97ecb72a8a89ad2d88626d96f
Signed-off-by: Kevin Rocard <krocard@google.com>
Master volume was the first pair of getter/setter tested
and did not use the generic test*Accessor function.
Test: run the corresponding vts test
Test: vts-tradefed r vts-hal-hidl -m VtsHalAudioV2_0Target
Bug: 34170075
Change-Id: I77080a3a17e4a3e97ecb72a8a89ad2d88626d96f
Signed-off-by: Kevin Rocard <krocard@google.com>
The IDevice::debugDump method dumps debug info in a file descriptor.
Such file descriptor was previously the writing end of a pipe.
As the test is not multithreaded, if the dump was bigger than the pipe
buffer, a deadlock would occur.
With this patch, the test uses a file instead of a pipe. Thus write
will never block infinitely.
Test: run the corresponding vts test
Test: vts-tradefed r vts-hal-hidl -m VtsHalAudioV2_0Target
Bug: 34170075
Change-Id: I928cae712a1cb4411f907b3a9583014ba6486abc
Signed-off-by: Kevin Rocard <krocard@google.com>
Its base class was tested but not the primary
device getters and setters.
Test: run the corresponding vts test
Test: vts-tradefed r vts-hal-hidl -m VtsHalAudioV2_0Target
Bug: 34170075
Change-Id: Ic451761c7b8b29fd302a62aba83be6ce7be35f64
Signed-off-by: Kevin Rocard <krocard@google.com>
Test: run the corresponding vts test
Test: vts-tradefed r vts-hal-hidl -m VtsHalAudioV2_0Target
Bug: 34170075
Change-Id: I0652f1bf748de99a8a2594630daf5ea2acec8934
Signed-off-by: Kevin Rocard <krocard@google.com>
Previously failing tests were commented because I thought
our implementation had to pass all tests.
As a mater of facts, it is not the case and tests are allowed to fail.
Bugs will be raised for those failure.
This is much better way to track the fixes that FIXMEs.
Test: run the corresponding vts test
Test: vts-tradefed r vts-hal-hidl -m VtsHalAudioV2_0Target
Bug: 34170075
Change-Id: I928cae712a1cb4411f907b3a9583014ba6487abd
Signed-off-by: Kevin Rocard <krocard@google.com>
Do not close the native fd for shared memory passed by
the legacy HAL as it is owned by tinyalsa implementation.
Test: test MMAP NO IRQ playback and capture streams
Bug: 31458351
Change-Id: Ie0c2a38574e5ac5c13fdb8a5c81fd02cf7d0e47a
Add missing devices for USB headset to allow distinction
between USB sound cards and simple USB headsets.
Add output and input flags indicating special output
and input profiles to used for VoIP streams.
Test: make.
Change-Id: I7967866e15991dbf2f4349daa3ff3baa87c1c062
Test: run the vts test on target
Test: vts-tradefed r vts-hal-hidl -m VtsHalAudioV2_0Target
Bug: 34170075
Change-Id: I4bd6cb0aa5b7cc628537cd7c024542c4db8b592d
Signed-off-by: Kevin Rocard <krocard@google.com>
Diagnostic logging can be removed now as we have figured out that the problem isn't with the legacy hal.
This reverts commit 8d391c8eed.
Change-Id: I70a3454c05a0f49f3a3bed06e5a11616ed90ddf3
Temporary change for investigating b/35813113. Need to test
the hypothesis that sometimes either legacy HAL, or the wrapper
reports more bytes written than being asked for.
Bug: 35813113
Change-Id: I6596403e0ddcdcc8b061d1977e329f67670f30db
Test: make
The getService() and registerAsService() methods of interface objects
now have default parameters of "default" for the service name. HALs
will not have to use any service name unless they want to register
more than one service.
Test: builds
Bug: 33844934
Change-Id: I49622132d25c15597f46c19330a9d0b8dbffa704
The getService() and registerAsService() methods of interface objects
now have default parameters of "default" for the service name. HALs
will not have to use any service name unless they want to register
more than one service.
Test: builds; VTS HalAudioEffectHidlTargetBasicTest passes
Bug: 33844934
Change-Id: I7796982c4cad976aeeabf7708ec0104505332cad
The getService() and registerAsService() methods of interface objects
now have default parameters of "default" for the service name. HALs
will not have to use any service name unless they want to register
more than one service.
Test: builds
Bug: 33844934
Change-Id: I7ccbf802fcded790b4be325f36a34a3af6b42052
We need google shims on the vendor partition because they are providing
an implementation of a vendor defined interface. They were written by
google just as a courtesy/to make the transition easier. They're
basically a set for vendors to assemble their hal implementations
from.
Bug: 34135607
Test: marlin persist.hal.binderization on/off
Change-Id: I2e2af5af39264cf290259755bb9b2eb9827a21f5
This fixes a power regression caused by periodic wakeups of
the driver threads even when the device is idle.
The timeout is really not needed, it used to be there to ensure that
the thread exits its loop, but then an explicit wake-up call before
closing the thread had been added for this purpose.
Bug: 34682579
Test: Follow repro steps from the bug, compare power consumption
to the legacy version of the audio HAL.
Change-Id: I0bfc2079a449894c5d0bd6ef19b53ca425795a9e
Java intermediates are now created in the common rather than the device-
specific generated sources subdirectory.
Bug: 33842609
Test: make
Change-Id: I16af4cd19bf0b24baa0ad9ebfdb86b4d959c8672
Make sure the server aborts if it can't register the main audio
service and the effects service.
Soundtrigger and FM radio are optional, thus their failure to
register is only logged.
Bug: 34634573
Change-Id: If96e3238fe4d986e91581cc1ea0d9b36c24a8b9c
Test: restart audio service
HALs are prohibited from using framework binder, and there is
no equivalent scheduling policy service in hwbinder. Thus, in order
to match priorities of FastCapture / Mixer threads with their
counterparts in the HAL, it is needed to request the priority boost
from audioflinger on behalf of the HAL.
Bug: 34131400
Change-Id: I7c8db9d520b4cf272d2896ad875752b109b57ab7
Test: check priority match between audioflinger's and hal's threads
When outputting audio, the framework issues several HAL calls
from the same thread that writes into data FMQ. These calls
also need to be served on the same thread that writes audio data
to HAL. The same thing happens when audio input is commenced.
Add a command FMQ for passing different commands to the HAL thread.
This way, depending on the calling thread, the same call may go
either via hwbinder or via the command queue.
This dramatically reduces jitter in RTT measurements (although
doesn't improve the latency).
Bug: 30222631
Test: scripted RTT app
Change-Id: I04c826e2479d8210fd9c99756241156cda3143b6
There were two problems:
1. Joining of reader / writer / process threads (the threads that
interact with HAL) was taking up to 1 second because the thread
was usually waiting for an event flag to be toggled, or a 1s
timeout.
2. Calling IStream.close or IEffect.close shouldn't tax the caller.
Changed the code so a call to close only signals the thread that
it's time to exit, and then the thread is only joined in the
effect or stream destructor.
Bug: 34800063
Bug: 34499806
Test: see repro steps in the bugs
Change-Id: Ife20524a1eba4ec9a78152e89862526e8cd5c960
Legacy BT A2DP implementation of Audio HAL may be returning EAGAIN
from get_presentation_position, this is normal and shouldn't be
logged. Otherwise we create logspam as this HAL function is called
often.
Bug: 30222631
Change-Id: I9394dbc1d53c1f4136c2d538fccd519964ff1697
Test: play music via BT A2DP
Some legacy implementations of the effects HAL use the condition
of the reply buffer being NULL as an indication that they shouldn't
apply attenuation to the input audio data. Therefore, separate
methods are needed to distinguish the use cases of delegating the
volume control to the effect, and just informing the effect of the
volume changes.
A new method added to IEffect: volumeChangeNotification that implements
the second use case. The contract of setAndGetVolume method has been
updated to indicate that it is only called in the first use case.
Also updated the wrapper for a generic IEffect commands to pass NULL
pointers to the command and reply buffers in case when the size
of the input or output data is 0, to preserve compatibility with
direct calls from the framework.
Bug: 34368451
Test: volume control works when both Bass Boost and Equalizer are
enabled in the NXP implementation of the effects
Change-Id: I3c9a5bbdff561802bc94080c51703385a8903282
Fixed broken functionality for some devices relying on
a stub HAL module to be present (e.g Fugu).
Bug: 34360879
Test: make and check stub HAL is loaded in HIDL passthrough mode
Change-Id: Ibad050d63827c4e49604273efd76ac8074bb00d2
The combo call to stream_out->write + get_presentation_position
wasn't delivering the results of these calls entirely
correctly. Since the 'WriteResult' struct was lacking the field
for returning the status of the call to
'get_presentation_position', the client could erroneously update
the presentation position to bogus values if the call to the
legacy HAL had failed.
Updated IStreamOut.WriteStatus to include the missing field,
and updated the code to fill it out.
Also fixed logspam resulting from calling a stubbed
stream_in->get_capture_position.
Bug: 30222631
Test: Loopback RTT, media CTS
Change-Id: I38ac3b01beb095e176b54608e11e71ae5d5eafb6
Remove converage from test configs or entire config if not used
to define other test params. Tested each one individually to ensure
coverage still works.
Test: run vts -m (each test affected)
Change-Id: Ic1495a38ae9d1b32e851bc646f9c8e778eee2df1
Result: no hwbinder calls due music processing.
Added IEffect.close method for explicitly freeing up of resources
consumed by the effect before automatic server objects reaping
gets to it.
Added IEffect.setProcessBuffers method for updating the input /
output buffers on the go.
Test: make, use Play Music with effects, check traces
Bug: 30222631
Change-Id: Ia1e1bc7098fab59aa970e0ce4acdb48007409644
Result: no hwbinder calls due read / write session.
Added IStream.close method for explicitly freeing up of resources
consumed by the stream before automatic server objects reaping
gets to it.
Test: make, perform Loopback RTT, check traces
Bug: 30222631
Change-Id: I678559f6ef30026685df787cd2ba7c2ee449ed27
Threadpool can now be configured/joined if needed with
configureRpcThreadpool() / joinRpcThreadpool().
Bug: 31226656
Test: mma
Change-Id: I0d7d9924cc8c8851cc2b61ebdae906204909890e
Used hardware/interfaces/update-base-files.sh to update
file system/media/audio/include/system/audio-base.h
Test: make
Bug: 30947943
Change-Id: Id1f6971a1e40ab963c19f42a95516e6d8a26fc60
Translation between audio_offload_info_t and AudioOffloadInfo
was missing a field. This was causing compressed tracks to play
using 'deep_buffer' mode instead of 'offload'.
Changing output stream async callback methods to 'oneway',
since they don't require anything from the callee.
Change-Id: I27fe7fb715e421f102db21a10d34e1dc3134cf01
Test: play MP3 file with Play Music, check audioflinger dump
audioserver receives a change that makes it to crash once it
detects that audiohal server has crashed (because audioflinger
can't gracefully restore the state of the audio system).
As audioserver.rc file prescribes restaring the audiohal on
audioserver restart, there is no need to rely on the init process
to restart the audiohal. Moreover, asking the init process to do
that causes a double restart of the audiohal service if it crashes.
Test: kill audio-hal process, watch dmesg and logcat
Change-Id: Iac4cc79cdc1a3debd2b9cfcdf42f11451d7ce24c
This happens often, and it's normal. Avoid logging it down as this
causes logspam.
Bug: 33353073
Change-Id: Ia3b1b8af61bdf83e9bcde0e5bed0285af037df45
Test: cause the system to play some sounds (e.g. UI clicks), watch logcat
Extended audio offload structure: added support to add bit_width,
offload buffer size and usage info.
Add support for direct PCM audio stream. Direct PCM stream
is used when pcm data required post processing in DSP. Direct PCM
stream is used for both track offload and PCM offload.
Add audio proxy source device.
Add support for additional audio formats: EVRC, QCELP, WMA, WMA,
AAC_ADIF, AMR, MP2, FLAC, ALAC, APE, DSD, LDAC.
Extend audio channel mask.
Test: make
Change-Id: I02d2f1fff6fa467688c1bad158ae18b5fa8c0f5b
Several issues addressed:
-- added IDevice.supportsAudioPatches to query whether
create/removeAudioPatch is actually supported by HAL;
-- IStreamOutCallback proxy needs to be owned by IStreamOut
implementation. In order for the client to reset the reference,
added method IStreamOut.clearCallback;
-- IDevice.open{Input|Output}Stream need to return a "suggested" audio
config from HAL;
-- code for converting between system/audio.h and HIDL
data structures has been moved to
android.hardware.audio.common@2.0-util library for reuse;
-- added a workaround for the issue with QC effects HAL trying to write
into the input parameters buffer, which is r/o by Binder design.
Bug: 30222631
Change-Id: I64af24d79c12d6ac3b0f87d085a821913e29237b
Test: tried using with WIP HIDL client on N5X
find . -name "*.h" -exec sed -i 's/HIDL_GENERATED_\(.*\)_H_/\U\1_H/g' {}
+
They now match what would be generated by -Lc++-impl. This prevents
confusion over whether or not the files are autogenerated.
Change-Id: I4aa89a39907024aa9525df71ff3715979f431357
Similar commit: https://android-review.googlesource.com/#/c/305996/
Test: pass
Changes made to the .hal definition:
- introduce Effect ID returned by the IEffectsFactory that
needs to be passed to IStream.{add|remove}Effect; otherwise
it's impossible to retrieve the underlying HAL effect handle;
- change "bus address" in DeviceAddress to "string" type;
- fix signature of some methods w.r.t. returning Result;
- remove unused "struct AudioPatch".
Bug: 30222631
Test: make
Change-Id: Icb51729ef57bb2a5b0b78609735e7481bc04f95c
To allow genrules with more than one tool, rename the tool property to
tools and make it an array, replace $tool with $(location <label>),
and use $() for other variables for consistency.
Bug: 31948427
Test: compare build.ninja
Change-Id: I3d714f70a2af0dc60faeee10e09b6ed166601f1d
Changes made to the .hal definition:
- added missing generated Result for methods implemented via legacy
"command" function;
- fixed Aux Channels feature definition;
- added "size" parameter for reply data in cases where the wrapper
needs to allocate a reply buffer;
- added method for generic support of feature configs;
- added new Result type;
- use arrays instead of strings in effect descriptor to ease
conversion from / to legacy HAL;
- added missing method to the Preset Reverb interface;
- fixed names of the Visualizer enums to avoid clashes with defines
from the legacy HAL file.
The implementation isn't hooked up to the server yet. Need to implement
devices and streams first.
Bug: 30222631
Change-Id: I75bb42f19ac3303759e918b6d6a91646b1555f8c
Test: make
I11496e4c3dd6d0d43f635886b46609cb8e430efc removed
hidl/IServiceManager.h, remove it from service.cpp.
Test: m -j android.hardware.audio@2.0-service
Change-Id: I9e45345b345acb1cc15343c889361c2775933cc3
Audio HAL service is common to audio, audio effect, sound trigger and
bradcast radio HALs.
Bug: 32022304
Change-Id: I3952b9c6de3a6b34e757942120320cf8ae036ed5
Created after hardware/audio.h with the following changes:
- names changed to satisfy HAL style guide;
- defined getter / setter methods for properties, and interfaces
for devices where needed;
- stream out callback changed to be used over RPC;
- 'dump' method is already defined by BBinder, so in HAL
interfaces it is replaced by 'debugDump'.
Note that audio data is currently transferred using byte buffer,
which is not effective due to memory copy and HwBinder transaction
involved. The transfer method will be changed to FastMessageQueue.
Bug: 30222631
Test: make
Change-Id: Ibb3bd940a91820e81d1a2b53b38d63b9e3de148a
Since in generated C++ code class enums are used, the names of enum
values are scoped anyway, thus carrying the prefix only clutters
code.
For C enums, newly introduced "value_prefix" annotation is used
to add the required prefix.
Added annotations for effects HAL types are just informational,
but can be used would C headers generation ever be required.
Also:
- renamed AudioInputFlags -> AudioInputFlag for consistency;
- moved AUDIO_INTERLEAVE_... constants into their own enum.
Bug: 31800672
Change-Id: I5b325f3440e0057ca98c4617040c7e5a89d2283d
Test: make
Created after hardware/audio_effect.h with the following changes:
- names changed to satisfy HAL style guide;
- defined an interface per effect, an interface method
per command, and getter / setter methods for properties;
- retained methods for executing proprietary commands
and accessing proprietary properties, only to be used
for third-party software effects;
- HIDL vector type is used instead of count / array pairs;
- provider callback changed to be used over RPC;
- 'dump' is method is already defined by generated code.
Note that audio data is currently transferred using AudioBuffers,
which is not effective due to memory copy and HwBinder transaction
involved. The transfer method will be changed to FastMessageQueue.
Bug: 30222631
Test: make
Change-Id: Ic8ea5c19688610ebe642c7597d2bcfa3226977e7
The following types are not used in HAL and being removed:
- AudioContentType;
- AudioUsage;
- AudioFlagsMask;
- AudioAttributes.
This is in order to reduce synchronization burden and also
allow extending framework without updating HAL.
Bug: 30222631
Change-Id: Ic5df1800224fd1506dcf624b0cd20f9fd36cb949
Test: make
These types are migrated from system/audio.h. The order and syntax
of declarations is preserved where available. The following
changes have been made:
- names changed to satisfy HAL style guide;
- some previously separate enums grouped into one to allow
using values between them (HIDL doesn't allow using values
of one enum in another, and even if it would, that will
probably be incompatible with C++11 enum classes it generates;
- as HIDL doesn't have sizeof, these were substituted with values;
- unions can't contain HIDL string type, thus some names are
expressed as uint8_t arrays;
- "handle" is a reserved word in HIDL;
- HIDL vector type is used instead of count / array pairs;
- obviously, macros and inline functions not migrated.
Bug: 30222631
Test: make
Change-Id: If55de3774deaa0b3f68ca6100e61ccaf79f29183