Commit graph

222 commits

Author SHA1 Message Date
Mikhail Naganov
95fa26f096 Merge "VTS Audio Effect: Allow 'NOT_SUPPORTED' from IEffect::offload method" into oc-dev am: 2bb2add8a9
am: 2d6f470495

Change-Id: Ibc558b4ca5af3e03c7eddff43450779c2026b118
2017-05-19 20:40:49 +00:00
Mikhail Naganov
2d6f470495 Merge "VTS Audio Effect: Allow 'NOT_SUPPORTED' from IEffect::offload method" into oc-dev
am: 2bb2add8a9

Change-Id: I4002f571964e615ec0e8357468cbf037fbdb0a43
2017-05-19 20:35:34 +00:00
Mikhail Naganov
c11724572e VTS Audio Effect: Allow 'NOT_SUPPORTED' from IEffect::offload method
HAL may not support offloading, and a call to IEffect::offload
is allowed to return an error code.

Update the test to accept either OK or NOT_SUPPORTED.

Bug: 38437110
Test: still passes
Change-Id: I1822010eed73f61bb0e0ae1852739b47fa72eade
2017-05-19 11:29:28 -07:00
Eric Laurent
3510657437 Merge "audio HAL: fix getParameters status check." into oc-dev am: af7bc59c0a
am: 7f7a0a880c

Change-Id: Ib1663485edb5abf7322ad0ef197e821ba5e21ba8
2017-05-18 17:47:36 +00:00
Eric Laurent
7f7a0a880c Merge "audio HAL: fix getParameters status check." into oc-dev
am: af7bc59c0a

Change-Id: Icd5926031ace47bc0dc1b1f24cb48e107851fcd7
2017-05-18 17:37:02 +00:00
Eric Laurent
45d4032215 audio HAL: fix getParameters status check.
Bug: 38326193
Test: VTS tests for module VtsHalAudioV2_0TargetTest.

Change-Id: If4109cea68120d722a3b1084ad583170e950cfa0
2017-05-17 18:38:47 -07:00
Kevin Rocard
6ade5e3c1b Merge changes from topic 'audio-primary-hal-vts-fix' into oc-dev am: c558ddf3fa
am: cdf142d8dd

Change-Id: I3429df38464282106bef8464a4852bd5b29f763d
2017-05-16 19:33:39 +00:00
Kevin Rocard
cdf142d8dd Merge changes from topic 'audio-primary-hal-vts-fix' into oc-dev
am: c558ddf3fa

Change-Id: I15868923cdfd165e20468d1c885a256fefd0eeca
2017-05-16 19:13:11 +00:00
Kevin Rocard
a1d6ea4ba7 Audio HAL: A speech volume outside of [0,1] is an error
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-15 14:51:28 -07:00
Chih-Hung Hsieh
7eb57b60ab Remove unused lambda capture
New clang compiler gives warning to unused lambda captures.
Apply clang-format.

Bug: 37423073
Test: Build

Change-Id: Icdf019df1a6c9dcadeb35551377d7afa09eebb3e
2017-05-15 14:02:45 -07:00
Kevin Rocard
fcf186bd59 Audio HAL VTS: Some methods are not optional
Some mandatory methods were allowed to return NOT_SUPPORTED
although their implementations is mandatory.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: Ibe4b3cf73257309975ed11269a38315051fa9064
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-12 16:02:30 -07:00
Kevin Rocard
c8e1b1dadc Merge changes from topic 'audio-primary-hal-vts-fix' into oc-dev
am: 257c2f1a43

Change-Id: Ic8850d915b5672e7529f99e7d57845b2de44857a
2017-05-12 06:57:47 +00:00
Kevin Rocard
257c2f1a43 Merge changes from topic 'audio-primary-hal-vts-fix' into oc-dev
* changes:
  Audio HAL: A volume/gain outside of [0,1] is an error
  Audio HAL VTS: Log test unexpected behaviour
  Audio HAL VTS: Improve ASSERT of Result and Return
  Audio HAL VTS: stopped stream state getters may return INVALID_STATE
  Audio HAL VTS: setGain allow -0.0
  Audio HAL VTS: Some methods are optional
  Audio HAL VTS: GetPresentationPosition may return 0 on stop stream
  Audio HAL VTS: getDevice() == NONE => not supported
  Audio HAL VTS: Getter test assert logic was incorrect
  Audio HAL VTS: debugDump can only test for crash
  Audio HAL VTS: Sanitize prepareFor{Writing,Reading} input size
  Audio HAL VTS: refactor prepareFor{Reading,Writing}
  Audio HAL VTS: Sanitize setMode input
  Audio HAL VTS: Allow OK when setting a non existing parameter
  Audio HAL VTS: differentiate getParam success/failure/not_implemented
  Audio HAL VTS: Fix style on modified files
2017-05-11 22:34:40 +00:00
Steven Moreland
a32ebce372 Update makefiles for c++-sources and c++-headers. (2/2)
am: bc71124120

Change-Id: Icf36068a4d863a8520854c7a83e51f960c188e12
2017-05-11 00:48:55 +00:00
Steven Moreland
bc71124120 Update makefiles for c++-sources and c++-headers. (2/2)
Test: pass
Bug: 38174080
Change-Id: Icad451f9f9ad5f46412356a4171a8a1222f8e545
2017-05-09 19:58:43 -07:00
Kevin Rocard
4c030024df Audio HAL: A volume/gain outside of [0,1] is an error
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-08 18:28:12 -07:00
Kevin Rocard
96f46c4a23 Audio HAL VTS: Log test unexpected behaviour
Some test output infos that are useful to understand how they run.
Unfortunately the xml report does not seem to be saved by VTS tradefed.
Thus output them in logcat.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: I9a2cc10160c3b1c8f81db0464efbc6b26600cadc
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08 14:43:03 -07:00
Kevin Rocard
f26f67a16b Audio HAL VTS: Improve ASSERT of Result and Return
Previously tests on Result and Return were using ASSERT_NO_FATAL_FAILURE
and helper methods.
This leaded to complex error messages were the error did not pointed to
the helper methods instead of the ASSERT_RESULT call.
Additionally SCOPE_TRACE messages are repeated
for each ASSERT_NO_FATAL_FAILURE level.

Use ::testing::AssertionResult to improve drastically the error messages.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: If705502546606d678df3f1966b0cd9f3ef8c2529
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08 14:43:02 -07:00
Kevin Rocard
304b6c810e Audio HAL VTS: stopped stream state getters may return INVALID_STATE
A never started stream should have its render position and next write
timestamp at 0 or indicate that the state is invalid.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: I62e16066bb22101ee8f75154fc6c85a66be2f402
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08 14:43:02 -07:00
Kevin Rocard
c4f1b2f86a Audio HAL VTS: setGain allow -0.0
Previously -0.0 was consider an invalid value as not in the range [0,1].
But it is quite difficult in C++ to differentiate -0.0 and 0.0 as -0.0 == 0.0
and such difference has no impact in practice.

Thus leave the implementation support or not -0.0.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: Ia0ebcb325f77adcf8471620f418da1cbe8995e36
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08 14:43:02 -07:00
Kevin Rocard
98390a6c2c Audio HAL VTS: Some methods are optional
Although the method documentation does not say it,
some HIDL interface methods are optional.

Update the tests to allow NOT_SUPPORTED to be returned.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: If31acc2dbdb6d1d563910e85c99401c48f4f3f86
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08 14:43:02 -07:00
Kevin Rocard
476e38fd31 Audio HAL VTS: GetPresentationPosition may return 0 on stop stream
GetPresentationPosition returns the last time a sample was written to
the hardware.
Calling it on a stop stream should return 0 sample written, but the
timestamps of that measure is of little importance.
Thus allow this timestamp to be 0 indicating that the measure was never
actually made.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: I3c33b60f98e8cbea269a7739cc1889af932dcff5
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08 14:43:02 -07:00
Kevin Rocard
8f8730c762 Audio HAL VTS: getDevice() == NONE => not supported
getDevice does not return a Result, thus it can not return NOT_SUPPORTED.
Consider NONE as not supported.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: I3b6f7a1fbc1d1535faf549f5b031461cb39d1722
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08 14:43:02 -07:00
Kevin Rocard
4aefd1c1ff Audio HAL VTS: Getter test assert logic was incorrect
Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: Iaf2d71829a15b12dcf56e825773c8a697896a264
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08 14:43:02 -07:00
Kevin Rocard
5e5783daef Audio HAL VTS: debugDump can only test for crash
DebugDump does not return an error code, thus the implementation can not
return not implemented.

As a result, the test can not expect any output from the function.
Only test that the call does not crash and add a log if the function is
probably not implemented in the test.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: I2c18958bceb1eb638491f9afce9d8e8025ccd3ec
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08 14:43:02 -07:00
Kevin Rocard
195205b323 Audio HAL VTS: Sanitize prepareFor{Writing,Reading} input size
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-08 14:43:02 -07:00
Kevin Rocard
c07df49e45 Audio HAL VTS: refactor prepareFor{Reading,Writing}
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-08 14:43:02 -07:00
Kevin Rocard
04364edefc Audio HAL VTS: Sanitize setMode input
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-08 14:42:39 -07:00
Kevin Rocard
f8500dcb5a Audio HAL VTS: Allow OK when setting a non existing parameter
setHwAvSync and setParameters were implemented in the pre-hidl interface
as set_parameters.
Unfortunately set_parameters did not return an error if a key was not
implemented.

As most HIDL implementation will be a wrapper around the pre-hidl
interface, allow those functions to return OK on not implemented key.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: Icfcaa02b7d63e03375fddc90dc5a803754c1874f
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-05-08 14:42:39 -07:00
Kevin Rocard
fa3b4a9334 Audio HAL VTS: differentiate getParam success/failure/not_implemented
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-08 12:42:14 -07:00
Kevin Rocard
72e50e2ef1 Audio HAL VTS: Fix style on modified files
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-08 12:41:57 -07:00
Mikhail Naganov
43266a7691 Merge "audiohal: Add diagnostics to investigate HAL call crashes" into oc-dev
am: 65f7dbc9a9

Change-Id: I1f0d90fa7705d2716dbd3358418706ccae8dccb9
2017-05-05 00:08:46 +00:00
Mikhail Naganov
6c0f76a684 audiohal: Add diagnostics to investigate HAL call crashes
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-04 14:34:37 -07:00
Mikhail Naganov
63a3014646 Merge "audiohal: Fix incorrect parameter handling in IDevicesFactory::openDevice" into oc-dev
am: f66f505bc6

Change-Id: Ie6a32e496f723413421bef285a4370ddef7214bc
2017-05-04 21:34:06 +00:00
Mikhail Naganov
8604a738a7 audiohal: Fix incorrect parameter handling in IDevicesFactory::openDevice
Check for possibly invalid values of IDevicesFactory::Device enum.

Bug: 37592306
Change-Id: I4a2300d3be9ab38e6c51ba8a3b5bbbb606a11c2b
Test: VTS
(cherry picked from commit 8c16d85122)
2017-05-04 18:30:31 +00:00
Mikhail Naganov
62ce08c3a2 Merge "Revert "audiohal: Get rid of multiple inheritance in IDevice implementation"" into oc-dev
am: ed84acb9ff

Change-Id: Id618a6d2d483e805a3ad9d6991d2ae782de00da3
2017-05-03 19:15:49 +00:00
Mikhail Naganov
86685f56da Revert "audiohal: Get rid of multiple inheritance in IDevice implementation"
This reverts commit e4228e7aa6.

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-05-03 16:40:27 +00:00
Steven Moreland
5c63b11f76 Remove redundant dependencies
android.hidl.base@1.0 and android.hidl.manager@1.0 are built into libhidltransport.

Test: links
Bug: 33276472
Merged-In: I08aaad80f7e2fc262aa3a8b66fe932e8133a928d
Change-Id: I08aaad80f7e2fc262aa3a8b66fe932e8133a928d
2017-05-02 15:29:30 -07:00
Mikhail Naganov
e4228e7aa6 audiohal: Get rid of multiple inheritance in IDevice implementation
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-29 00:48:57 +00:00
Mikhail Naganov
c8c6a81f0f audiohal: Support stateful downmixer effects
Fraunhofer's downmixer has additional buffering, this is incompatible
with how DownmixerBufferProvider used to process incomplete buffers.

Now the effects HIDL wrapper delivers frameCount updates in
audiobuffers to the server side. This fixes playback of multichannel
sound streams.

Bug: 36181621
Test: play 5.1 track from Play Music
Change-Id: Iffe3327c6eedef85151eec2b41e0aedfb7ffa6dc
2017-04-27 12:37:28 -07:00
Mikhail Naganov
95344ba2f5 Merge "audiohal: Fix handling of invalid arguments in 'debugDump' methods" into oc-dev 2017-04-26 22:53:33 +00:00
Mikhail Naganov
3e6fe754f6 audiohal: Fix handling of invalid arguments in 'debugDump' methods
Add checks for validity of the passed in native handle.

Bug: 37590777
Change-Id: If906f0086c3442819e1844cc521215d5b74af015
Test: VTS
(cherry picked from commit 7bae6a0b63)
2017-04-25 20:21:37 +00:00
Mikhail Naganov
3a2470f82d audiohal: Fix typos in comments, add missing comments
These changes are in comments only, no ABI breaking changes.

Bug: 32238101
Test: make
Change-Id: Iead4ba01dae1a1c05d8fbed7f194182128e9e6ad
2017-04-25 10:59:53 -07:00
Derek Chen
ab24ecd952 audio hal: initialize audio patch handle
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-20 23:48:52 +00:00
Kevin Rocard
34b44cd7db Audio primary hal: fix member function used before init
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-19 09:38:42 -07:00
TreeHugger Robot
d7e88525a7 Merge changes from topic 'vts-audio-fix' into oc-dev
* 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-19 00:44:34 +00:00
Steven Moreland
a8a9cc6606 audio hal: explicitly import headers
Test: works with BOARD_VNDK_VERSION := current
Bug: 33241851
Change-Id: I34983a5527a16e8e9f5a6a87edac0b741aeb67d6
2017-04-17 15:56:52 -07:00
Mikhail Naganov
3acaa668c1 soundtrigger: Use "default" instance name for HAL service
"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-14 15:52:11 +00:00
TreeHugger Robot
5df7894213 Merge "audio.common@2.0-util: vendor_available + in Soong" into oc-dev 2017-04-14 04:00:09 +00:00
Andreas Huber
6fa374ad30 Changed the naming scheme for Treble java libraries (both static and dynamic)
android.hardware.foo@1.0-java => android.hardware.foo-V1.0-java

Bug: 37207894
Test: make
Change-Id: I177f4cfd42f635aaf096107af8309d1a82ed41c0
Merged-In: I8b91881dfaf507c0d852d56ebbb53ff0987e5a34
2017-04-13 15:23:46 -07:00