summaryrefslogtreecommitdiff
path: root/audio/2.0/default
AgeCommit message (Collapse)Author
2018-03-06Audio V4: Move service entry point to commonKevin Rocard
The HAL audio service entry point is not version dependant and is common to core and effect. Bug: 38184704 Test: compile Change-Id: I143cf28490afc978791ccd7e8aeee2106cbb2ebd Merged-In: I143cf28490afc978791ccd7e8aeee2106cbb2ebd Cherry-picked from master Signed-off-by: Kevin Rocard <krocard@google.com>
2018-02-28audio: Initialize processstate with vndbinderHaynes Mathew George
Initialize processtate with vndbinder to allow vendor components to talk via vndbinder Test: re-launch android.hardware.audio@2.0 service Change-Id: I9fafff157c5e497a8125b13741b56e0852534ffa
2018-01-22Merge "soundtrigger: Fall back to V2.0 if V2.1 is not present"TreeHugger Robot
2018-01-22soundtrigger: Fall back to V2.0 if V2.1 is not presentMikhail Naganov
A device may not be configured to ship with ST V2.1 impl, in this case the device will stuck in a boot loop because the framework will be attempting to instantiate ST, but the service will not have ST server side registered. Since the service code is the same for all devices, allow a fallback to ST V2.0. This way, if only V2.0 is present on the device, it will be registered, and the framework will find it. The actual version used can be determined by examining output of 'lshal' command. Also remove obsolete dependency on broadcast radio. Bug: 63600413 Bug: 68823037 Test: Try taimen both with ST V2.0 and V2.1 impls Change-Id: I484659b1df5a7e4b11db91d0cf75a7079786c766
2018-01-20Audio V4: Move the legacy wrapper before refactorKevin Rocard
This will make diff much more clear and allow git to follow the files. Bug: 38184704 Test: compile Change-Id: I946b20254dcda1cb31b48898d0b5f46b185ebafe Signed-off-by: Kevin Rocard <krocard@google.com>
2018-01-20Audio V4: Fix issues in the legacy wrapper raised by clang-formatKevin Rocard
This patch only contains cosmetic reformatting imposed by clang-format. Bug: 38184704 Test: compile Change-Id: I57545f2b8de1e982028ef4794328741d91682e0c Signed-off-by: Kevin Rocard <krocard@google.com>
2018-01-20Audio V4: Transition legacy wrapper to Android.bpKevin Rocard
Bug: 38184704 Test: compile Change-Id: I950b3c38e1ae8093414ce1054a8530047a81ccca Signed-off-by: Kevin Rocard <krocard@google.com>
2018-01-20Audio V4: Make common helper version independentKevin Rocard
The implementation uses the version provided by macro. Bug: 38184704 Test: compile Change-Id: Ib5565bdf77ed9e42fc8271a4317eb88681aefcd5 Signed-off-by: Kevin Rocard <krocard@google.com>
2018-01-19soundtrigger: Switch audio service to load soundtrigger 2.1Mikhail Naganov
Bug: 68823037 Test: check /proc/.../maps of android.hardware.audio@2.0-service Change-Id: Ie244ca4ea548bdad8116d0a9f267bb41a6a6d50d
2017-12-22audio: Fix StreamOut ownership in default wrapper am: 718b510080 am: 890deeed1eMikhail Naganov
am: 9a58cc7b4c Change-Id: Id350abe5d8d7b88334cbe11b56a4a37864c8f397
2017-12-21audio: Fix StreamOut ownership in default wrapperMikhail Naganov
StreamOut::asyncCallback could became an owner of StreamOut causing the destructor to be called on the offload callback thread, while the legacy HAL is holding a mutex, which resulted in a deadlock. Removed erroneous usage of sp<StreamOut> in asyncCallback. The legacy HAL joins the offload callback thread when closing output stream, thus StreamOut destructor is guaranteed to finish only after the offload callback thread has exited, and using a raw pointer to StreamOut inside asyncCallback is correct. Bug: 70863217 Change-Id: I0d77018cf3df5ad07251732733288d425dd836eb Test: manual
2017-11-29Merge "Fix inequality typo in StreamIn::getCapturePosition" am: ba3225718b ↵Daniel Van Veen
am: 3770968cf9 am: d0161b948a Change-Id: Idd1d697f45057872d1a88ed42487cc1e1859d229
2017-11-29Merge "Fix inequality typo in StreamIn::getCapturePosition"Daniel Van Veen
am: ba3225718b Change-Id: I9ec534a8ec45525021180fa9219a1e3d4f34d0a7
2017-11-29Fix inequality typo in StreamIn::getCapturePositionDaniel Van Veen
This was preventing getCapturePosition() being called from the default HIDL implementation. Test: cts-tradefed run cts -m CtsMediaTestCases \ -t android.media.cts.AudioRecordTest Change-Id: I9c920108f68fb895a7f7a9d2ea27c291a91c1afb
2017-11-28Merge "Use -Werror in hardware/interfaces/audio" am: 7a4422d2a5 am: ae9fb022a3Chih-Hung Hsieh
am: 5d8244ee3f Change-Id: I0826ee82634360949a94b3ca51011fe52f9f8079
2017-11-28Merge "Use -Werror in hardware/interfaces/audio"Chih-Hung Hsieh
am: 7a4422d2a5 Change-Id: Ib0cf1e15856fd58f0f2ea726e3d5b94177ab33a1
2017-11-28Use -Werror in hardware/interfaces/audioChih-Hung Hsieh
* Remove unused variables, lambda function parameters.. Bug: 66996870 Test: build with WITH_TIDY=1 Change-Id: I28e8eb1af434f62cab6f41285b9a400f7f57cd13
2017-10-20Audio HIDL wrapper: Improve status_t to Return conversion for get_parameterKevin Rocard
set_parameter wrapper was converting status_t as such: OK -> OK -ENOSYS -> INVALID_STATE everything else -> INVALID_ARGUMENTS Which was inconsistent with the rest of the wrapper which was doing: OK -> OK -EINVAL -> INVALID_ARGUMENTS -ENODATA -> INVALID_STATE -ENODEV -> NOT_INITIALIZED -ENOSYS -> NOT_SUPPORTED everything else -> INVALID_STATE Unfortunately, identical conversion can not be achieve as legacy set_parameter specifically require -ENOSYS -> INVALID_STATE in `get_parameter` docstring: * If the implementation does not accept a parameter change while * the output is active but the parameter is acceptable otherwise, it must * return -ENOSYS. As a result implement: OK -> OK -EINVAL -> INVALID_ARGUMENTS -ENODATA -> INVALID_STATE -ENODEV -> NOT_INITIALIZED -ENOSYS -> INVALID_STATE <--- unchanged everything else -> INVALID_ARGUMENTS <--- unchanged Test: Playback and record over builtin & USB. Hangout call Test: vts-tradefed run commandAndExit vts --module VtsHalAudioV2_0Target Bug: 67030461 Change-Id: I13649eb00f8465921e5c718c5d5df120e1262ff7 Signed-off-by: Kevin Rocard <krocard@google.com>
2017-10-11Merge "Legacy wrapper: Use arbitrary limit on buffer size" into oc-mr1-dev ↵Kevin Rocard
am: 0f65d6e38a am: 0534965a28 Change-Id: I46a57ba6be7b9e132728f31d616b65aea812645d
2017-10-10Legacy wrapper: Use arbitrary limit on buffer sizeKevin Rocard
The legacy HAL wrapper prepareForWrite and prepareForRead used to return INVALID_ARGUMENTS if the computed buffer size just under SIZE_MAX. This meant that the limitation depended on the architecture (32 vs 64 bit size_t). This caused VTS test failure on 64 bits. Instead of dynamically calculating an arbitrary max size, choose a fixed one. This max buffer size has been chosen at 1GiB. It should be enough for the foreseeable future and not too close from the 4GiB max on 32 bit. Test: vts-tradefed run commandAndExit vts --module VtsHalAudioV2_0Target Bug: 67030516 Change-Id: I4cc3efda9bb66e6dae8b4e6785f52d9e51440aee Signed-off-by: Kevin Rocard <krocard@google.com>
2017-09-12Add 'vendor.' prefix to a vendor HAL service nameJaekyun Seok
To prevent property name collisions between properties of system and vendor, 'vendor.' prefix must be added to a vendor HAL service name. You can see the details in http://go/treble-sysprop-compatibility. Test: succeeded building and tested on a walleye device Bug: 36796459 Change-Id: I4e8fbee791ec917a8f627a1366f4d44ec7e6febc
2017-08-28Move Broadcast Radio HAL to a separate binary.Tomasz Wasilczyk
Bug: 63600413 Test: VTS, instrumentation Change-Id: I34a779a6608f52bcadaca1dc159bcee02186b49f
2017-07-14Add OWNERS for audio-related HAL default implementationsMikhail Naganov
Test: not needed Change-Id: Idefe7be10bde22866be82f87118b9b54e74c3f40
2017-07-12Use broadcastradio 1.1 default implementation by default.Tomasz Wasilczyk
Also, remove a warning for 1.1 interface, as the hidl freeze mechanism is now in place. Bug: b/34348946 Test: VTS, instrumentalization Change-Id: I82025a7de8abd0758ba8b196bbbfc48b9322ac3b
2017-06-01Merge "Revert "audiohal: Add diagnostics to investigate HAL call crashes"" ↵Mikhail Naganov
into oc-dev am: 5482fe026c am: f652c9e031 Change-Id: I7de1922316cb85789cc4cbf13fe70509de61032e
2017-06-01Merge "Revert "audiohal: Add diagnostics to investigate HAL call crashes"" ↵TreeHugger Robot
into oc-dev
2017-05-31Revert "audiohal: Add diagnostics to investigate HAL call crashes"Mikhail Naganov
This reverts commit 6c0f76a684bc58eb10181f71d9f45c5799ca7c6a. Since the root cause of the crash has been established, there is no need to keep this code around. Bug: 36225019 Change-Id: I74e570e863a0cdec5d9029f1672e2e8066c246b5
2017-05-23audiohal: Prevent logspam when calling get_presentation_positionMikhail Naganov
get_presentation_position can return ENODATA if the stream has stopped but the write is still querying the position. Bug: 38376424 Change-Id: I9d516a19fb347843a8ec8e8e9a0f5eab0b0798e6 Test: no log messages from StreamHAL about get_presentation_position
2017-05-17audio HAL: fix getParameters status check.Eric Laurent
Bug: 38326193 Test: VTS tests for module VtsHalAudioV2_0TargetTest. Change-Id: If4109cea68120d722a3b1084ad583170e950cfa0
2017-05-15Audio HAL: A speech volume outside of [0,1] is an errorKevin Rocard
Hals are supposed to received normalized volumes, between 0 and 1. Previously volumes outside [0,1] were clamp to this range. This clamping has the capability to hide bugs thus return an error if such volume is received. Test: vts-tradefed run vts --module VtsHalAudioV2_0Target Test: call/play music/record/video... Bug: 36311550 Change-Id: Iab70f9c651540ea2434d10939d28c1c842db19e0 Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08Audio HAL: A volume/gain outside of [0,1] is an errorKevin Rocard
Hals are supposed to received normalized volumes, between 0 and 1. Previously volumes outside [0,1] were clamp to this range. This clamping has the capability to hide bugs thus return an error if such volume is received. Test: vts-tradefed run vts --module VtsHalAudioV2_0Target Test: call/play music/record/video... Bug: 36311550 Change-Id: Ia4880bdff6111cbcdae6a4ebee921eddae141ee4 Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08Audio HAL VTS: Sanitize prepareFor{Writing,Reading} input sizeKevin Rocard
Return an error if framesCount or frameSize are null to avoid a division by zero when calculating the buffer size. The message queues are allocated with a buffer size but if two big they will assert not return an error. Thus take some margin on the buffer size check. Note that both function should be refactored as 99% identical. Test: vts-tradefed run vts --module VtsHalAudioV2_0Target Test: call/play music/record/video... Bug: 36311550 Change-Id: I0576e9016ef2e567c8d4e171c6237883d9865db9 Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08Audio HAL VTS: refactor prepareFor{Reading,Writing}Kevin Rocard
Those functions had lots of copy paste on errors and the following patch will even add more error detections. Refactor the hidl_cb call to avoid all duplication. Note that both function should be refactored as 99% identical. Test: vts-tradefed run vts --module VtsHalAudioV2_0Target Test: call/play music/record/video... Bug: 36311550 Change-Id: I40d6926b4f9f5e3aba51e878f55fb013f4ca09c1 Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08Audio HAL VTS: Sanitize setMode inputKevin Rocard
Some values of AudioMode are exposed although implementation detail. Make sure the client can not use them. Test: vts-tradefed run vts --module VtsHalAudioV2_0Target Test: call/play music/record/video... Bug: 36311550 Change-Id: If513c2a06efa8a92459f0af80c63232fc63302b0 Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08Audio HAL VTS: differentiate getParam success/failure/not_implementedKevin Rocard
When sending parameters to the HAL (and some getters are implemented with getParameters), the client expect a status consistent with the other HIDL methods. Ie: not implemented or success and failure. Unfortunately, the legacy get_parameter interface, which currently most Audio HIDL implementation are a wrapper around, do not return such error code. Get parameters return a list of key values. - If a requested key does not return a key value pair, consider it not implemented - If a requested key returns a key not followed by a correct value, consider it a failure - otherwise it is a success Test: vts-tradefed run vts --module VtsHalAudioV2_0Target Test: call/play music/record/video... Bug: 36311550 Change-Id: Id6711e9c1974fe5a336b6de83a9b6d14f74437c9 Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08Audio HAL VTS: Fix style on modified filesKevin Rocard
In order to avoid style inconsistency as well as non functional modification in following patches, fix the style of all files modified for the fix of the VTS tests. Patch generated with: $ clang-format -i --style file -- <file list> Bug: 36311550 Test: compile Change-Id: I53dbcdabf959a6100e34a2ee4d0f951d525049cb
2017-05-04audiohal: Add diagnostics to investigate HAL call crashesMikhail Naganov
This is intended to clarify whether surprising zeroing out of HAL control structures happens to a particular HAL module, or to any HAL module at random. Unfortunately, the crash itself can't be prevented as audioflinger can't work around a HAL outage, and needs to be restarted anyway. Bug: 36225019 Test: verified that the logged string contains the information Change-Id: I5843d89b4e5385b4ce269f72b5891ccb646daeba
2017-05-04audiohal: Fix incorrect parameter handling in IDevicesFactory::openDeviceMikhail Naganov
Check for possibly invalid values of IDevicesFactory::Device enum. Bug: 37592306 Change-Id: I4a2300d3be9ab38e6c51ba8a3b5bbbb606a11c2b Test: VTS (cherry picked from commit 8c16d85122472ef01a9e023c9568968faac1aff8)
2017-05-03Revert "audiohal: Get rid of multiple inheritance in IDevice implementation"Mikhail Naganov
This reverts commit e4228e7aa683044e17e6592c9014b5d4691445e7. Further analysis of the bug has shown that the problem is not related to the use of multiple inheritance. Bug: 36225019 Change-Id: Icdcaf84061c0ecf29f891521bd961c3ee89f1cfc
2017-04-29audiohal: Get rid of multiple inheritance in IDevice implementationMikhail Naganov
We still not sure what causes crashes in Device::get|setParam*, but it seems that it is somehow caused by the fact that the parameters code is in a separate class with virtual methods, from which Device class inherits along with IDevice interface. The workaround is to substitute multiple inheritance with delegation in Device class. Hopefully this will either eliminate crashes or make the underlying reasons more clear. Some of the code got reformatted by clang-format as a presubmit requirement. Bug: 36225019 Test: make Change-Id: Id785c3565bbebd5acc26ca46472961698d9c6208
2017-04-25audiohal: Fix handling of invalid arguments in 'debugDump' methodsMikhail Naganov
Add checks for validity of the passed in native handle. Bug: 37590777 Change-Id: If906f0086c3442819e1844cc521215d5b74af015 Test: VTS (cherry picked from commit 7bae6a0b635b142cfba9d4c4612e1e114f85b842)
2017-04-20audio hal: initialize audio patch handleDerek Chen
Initialize audio patch handle to avoid uninitialized value causing validation failure in vendor hal audio patch. Bug: 36994757 Test: Initiate voice call, no audio heard from other end Change-Id: I4cf57210432430af89109f605813645ff332bfbb
2017-04-19Audio primary hal: fix member function used before initKevin Rocard
prepare for write was refactor by Ib4170eb6a9f88f9352d0912083b43d600771bb8e to use temporary variable in a rai pattern. Nevertheless the member variable was still used too early in prepareForRead resulting in a crash for capture. Test: assistant, camcorder Bug: 37492059 Change-Id: I08140834959c440798cd40700dd089adca2f3e40 Signed-off-by: Kevin Rocard <krocard@google.com>
2017-04-19Merge changes from topic 'vts-audio-fix' into oc-devTreeHugger Robot
* changes: Audio HAL: Destroy EventFlag on failed prepareTo{write,read} Audio HAL: Check for buffer size overflow Audio HAL: Detect buffer memory allocation failure Audio HAL: Detect openDevice failure Audio HAL VTS: Fix documentation
2017-04-17audio hal: explicitly import headersSteven Moreland
Test: works with BOARD_VNDK_VERSION := current Bug: 33241851 Change-Id: I34983a5527a16e8e9f5a6a87edac0b741aeb67d6
2017-04-14soundtrigger: Use "default" instance name for HAL serviceMikhail Naganov
"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
2017-04-07Audio HAL: Destroy EventFlag on failed prepareTo{write,read}Kevin Rocard
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>
2017-04-07Audio HAL: Check for buffer size overflowKevin Rocard
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>
2017-04-07Audio HAL: Detect buffer memory allocation failureKevin Rocard
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>
2017-03-30audiohal: Fix UAF of HAL devices in Stream objectsMikhail Naganov
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 96d3573cda6f76bcbfc277e69d94914a565218d8)