Commit graph

509 commits

Author SHA1 Message Date
Kevin Rocard
202bc18e0b Audio VTS: run tear-down hooks in LIFO instead of FIFO am: cfab8dac2b
am: 5381192973

Change-Id: Icb1940e1a6b8c9f4fe053f71dfadc52bb9e59fe0
2018-08-10 14:45:37 -07:00
Kevin Rocard
5381192973 Audio VTS: run tear-down hooks in LIFO instead of FIFO
am: cfab8dac2b

Change-Id: Ibd24dda91b5d334a62553dfe980d6559743688b8
2018-08-10 14:29:43 -07:00
Kevin Rocard
cfab8dac2b Audio VTS: run tear-down hooks in LIFO instead of FIFO
The audio tests use a static cache of some HAL objects for
performance reasons (speed up by 10x on Pixel).
Those object are destroy during the test environment tear-down.

This tear-down was destroying the objects in a FIFO instead of LIFO
order. Thus the DeficesFactory was destroyed before the Device it
created.

Bug: 79889318
Test: vts-tradefed run commandAndExit vts --module VtsHalAudioV2_0Target
      check that the device destructor is called before the
      devicesFactory one.
Change-Id: I1b4345158139ba14a8779a9508f7ebdc41129d1d
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-06-29 20:09:50 +00:00
Mikhail Naganov
1d33a8788d Merge "audio hal: Add 'interface' declarations for IDeviceFactory into .rc" into pi-dev
am: 4f0635a2a9

Change-Id: I66586d84d276370f2fdc863f3795e8cf2e45623e
2018-05-29 12:04:43 -07:00
Mikhail Naganov
2c484238d1 audio hal: Add 'interface' declarations for IDeviceFactory into .rc
Declaring the interfaces allows HIDL hwservicemanager to start
the HAL service in case it has crashed before audioserver
has called 'getService'.

Bug: 80227481
Test: use the repro case from the bug
Change-Id: Ibb46beb714b3985ab373d56d92da1105cfda28c6
2018-05-25 13:02:25 -07:00
Steven Moreland
cbc30e1f58 Merge "Update comments for doc comments." into pi-dev
am: cce4c95c1c

Change-Id: Id691cf973a214ee1d2f62297c13c8c030fc7a8bb
2018-05-18 18:43:45 -07:00
TreeHugger Robot
cce4c95c1c Merge "Update comments for doc comments." into pi-dev 2018-05-19 01:32:44 +00:00
Steven Moreland
4ee4582230 Update comments for doc comments.
Doc comments look like "/** ... */" and they
can only be in certain places.

Bug: 79865343
Test: m
Change-Id: Ic15c08ff7dc6e4f9827c1dbe7f7236c11a572ec1
2018-05-18 10:10:32 -07:00
Kevin Rocard
c9e570ac24 Merge "VTS tests should be static" into pi-dev
am: 318d3c4ff6

Change-Id: Ib35487ad1645737056935cbf3c60b95e3de16a9c
2018-05-17 19:10:49 -07:00
Kevin Rocard
271d7aaf11 VTS tests should be static
VTS tests can only depend on NDK shared libraries,
they are pushed and run on older desert version.

In theory the VTS tests should be built against the NDK,
but this is not possible due to all the system dependencies.

Bug: 78871270
Test: compile
Change-Id: I48fbffd0316efc151917071c54aa19e533c615df
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-05-16 18:04:57 -07:00
android-build-team Robot
610f34929c Merge changes I29bbf6bf,Ib0b03fb6 into pi-dev
am: 8f3b492c83

Change-Id: I4382fd70c9937526d8e1a808bda15cb24ec72bc0
2018-05-04 17:26:10 -07:00
android-build-team Robot
8f3b492c83 Merge changes I29bbf6bf,Ib0b03fb6 into pi-dev
* changes:
  Audio HAL HIDL wrapper: Fix incorrect conversion of TTY Mode
  Audio V4 VTS: test setter even if getter is NOT_SUPPORTED
2018-05-05 00:18:23 +00:00
Kevin Rocard
912bd4bf2f Audio HAL HIDL wrapper: Fix incorrect conversion of TTY Mode
The TTYMode enum numeric value was converted to a char* instead of its
literal value and vice versa.

Instead convert it to/from its literal value.
Eg: TTYMode::FULL -> "FULL" instead of "3"
    "FULL" -> 0 as atoi conversion would fail

Test: atest VtsHalAudioV4_0TargetTest
Bug: 71486871
Change-Id: I29bbf6bf3b5532269afcc5d39ea10eff2871bdea
Signed-off-by: Kevin Rocard <krocard@google.com>
Signed-off-by: Jungyee Yoo <jungyee.yoo@lge.corp-partner.google.com>
2018-05-01 17:07:31 -07:00
Kevin Rocard
c1d89888b9 Audio V4 VTS: test setter even if getter is NOT_SUPPORTED
Previously, the setter of optional properties were not tested
if the getter was not supported.
This was an issue as the framework rarely gets, most
often only sets as it consider having the ownership of those properties.
Thus implementation tend to only support set.

As a result optional setter were not tested although called by the
framework.

For example the default impl setTtyMode has a bug that was not detected
because the Pixel HAL does not support getTtyMode.

This patch makes sure to always test getter and setter.

Test: atest VtsHalAudioV4_0TargetTest
Bug: 71486871
Change-Id: Ib0b03fb6eb77cc0428a33eb463166dd7c339bd3d
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-05-01 17:07:29 -07:00
Steven Moreland
c90461c738 rename hidl_enum_{iterator,range}
This is actually a range, not an iterator.

Bug: 78573628
Test: m
Change-Id: Ie824a3eabcb7d5af94a8752e1498bdc8c7032e40
2018-05-02 00:06:33 +00:00
android-build-team Robot
d5c9702411 Merge "Add AUDIO_MICROPHONE_CHANNEL_MAPPING_CNT." into pi-dev 2018-04-30 23:05:33 +00:00
jiabin
ca3803f10e Add AUDIO_MICROPHONE_CHANNEL_MAPPING_CNT.
Bug: 75041465
Test: make
Change-Id: I2cb444637ddfa67949cb95af80c691fa6892b639
2018-04-30 14:21:58 -07:00
jiabin
bad3b28b60 Add vts for microphone enumeration APIs.
Bug: 64038649
Test: run vts --module VtsHalAudioV4_0Target
Change-Id: If75ee585a9d865d010fc7d2a081b930fba022a20
2018-04-25 10:17:29 -07:00
Kevin Rocard
adf9e18c01 Merge changes I2f70f2ec,I9d77a59e,Ied3a657d,Ib6e9d017,I95db94ed, ... into pi-dev
* changes:
  Audio V4: Add missing VTS
  Audio V4: VTS Pause was testing resume
  Audio V4: factorize analyzeStatus
  Audio V4: fix invalid SupportedChannelMasks test
  Audio V4: setMode VTS incorrectly assume 0 was invalid
  Audio V4: XSD device category was missing hearing aid
  Audio V4: some legacy getSupported can return NOT_SUPPORTED
  Audio V4: Improve VTS error messages
2018-04-25 01:21:58 +00:00
Kevin Rocard
d2f6be72ef Audio V4: Add missing VTS
Test: atest VtsHalAudioV4_0TargetTest
Bug: 74037175
Change-Id: I2f70f2ec6d4b1ee015de6b4937832903d945fdeb
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-04-24 10:47:50 -07:00
Kevin Rocard
82cef8d3f9 Audio V4: VTS Pause was testing resume
Bug: 74037175
Test: VtsHalAudioV4_0TargetTest
Change-Id: I9d77a59e69452e0891dc4e8e2cc2a14fef4fda41
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-04-23 21:59:44 -07:00
Kevin Rocard
64c3932736 Audio V4: factorize analyzeStatus
This factorization had not been ported from the AOSP patch.
The code is functionally identical.

Test: compile
Bug: 69010523
Change-Id: Ied3a657d7c219b580eb32377789096f6b2f6dc19
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-04-23 21:59:44 -07:00
Eric Laurent
8370b093bc Merge "Audio V4: dump effect HAL using the standard debug()" into pi-dev 2018-04-23 23:09:10 +00:00
Kevin Rocard
cff6813819 Audio V4: fix invalid SupportedChannelMasks test
Test was calling getSupportedSamplingRate instead of channel mask.

Bug: 77307068
Test: atest VtsHalAudioV4_0TargetTest
Change-Id: Ib6e9d017793edfc95853cab0c2955b8c801bc66f
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-04-23 15:28:20 -07:00
Kevin Rocard
dea4c3803f Audio V4: setMode VTS incorrectly assume 0 was invalid
Thus the test was always incorrectly failing.
Also improve the test error messages.

Bug: 77307068
Test: VtsHalAudioV4_0TargetTest
Change-Id: I95db94ed99f7ca32af35422e36a95084e72279d8
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-04-21 01:32:34 -07:00
Kevin Rocard
92dcce0924 Audio V4: XSD device category was missing hearing aid
Bug: 77307068
Test: atest VtsHalAudioV4_0TargetTest
Change-Id: I9de9b826d01fe90c1a7d16631d0f808b29ad4775
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-04-21 01:32:34 -07:00
Kevin Rocard
6512b60502 Audio V4: some legacy getSupported can return NOT_SUPPORTED
Legacy implementation through getParameter can not return a status_t.
This is problematic for
 - getSupportedChannelMasks(format)
 - getSupportedSampleRate(format)
as they should be able to return NOT_SUPPORTED if they do not support
the provided format.

In that case, allow the legacy implementation to return an empty string
that will be converted to NOT_SUPPORTED.

Test: atest VtsHalAudioV4_0TargetTest
Bug: 77307068
Change-Id: I78c37caf059885e3d33e6a308876dbc0e3ef7145
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-04-21 01:32:34 -07:00
Kevin Rocard
16d6547901 Audio V4: Improve VTS error messages
This does not change the test logic or constraints.
It only improves the error messages.

Bug: 77307068
Test: atest VtsHalAudioV4_0TargetTest
Change-Id: I6c79ddd014d4ab8aba4f1d0b918888f83dfb63ad
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-04-21 01:32:34 -07:00
Kevin Rocard
fba21730f8 Audio: setParam improve status_t to Result consistency
The rest of the API (*::analyseStatus) returns NOT_SUPPORTED
when the legacy API returns -ENOSYS.

setParameter legacy -> treble shim did not follow this
conversion due to the legacy API stating that for get_paramers,
-ENOSYS should be returned if
"the implementation does not accept a parameter change while the
 output is active but the parameter is acceptable otherwise",
aka INVALID_STATE.

Thus setParameter shim used to return
 - OK for OK
 - INVALID_STATE for -ENOSYS
 - INVALID_ARGUMENTS for everything else

This leads to several problems:
 - an implementation of the legacy API can not report NOT_SUPPORTED
 - it is inconsistent with the rest of the status_t conversion methods
 - shim methods implemented over getParameter can not distinguish
   between different failures as required by the .hal documentation

Most importantly, on the system side, the Result is transformed to a
status_t again but without any special logic for methods wrapping
getParameter in the shim.
This can not be changed as the system can not know which methods
are implemented with a legacy wrapper under the Treble API boundary.

Thus setParam now converts status_t to Result in the same way
as all the other shim methods.

This patch is the second half of I41204c0807d2bd4675e941771cbc9a43d7d14855
that was reverted due to a merge conflict.

Bug: 72873273
Bug: 69811500
Bug: 69010523
Test: playback and record for media and voice call
Original-Change-Id: I41204c0807d2bd4675e941771cbc9a43d7d14855
Change-Id: I41328afce56ce31d4a26159ca2d4b16d14cce05b
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-04-20 17:05:17 -07:00
Kevin Rocard
147a454bb2 Audio: make core/4.0/default/Util.h version dependant
This patch does not have any functional change.
It refactors Util.h to make it version dependant.
This is needed in the next patch to add a helper
that uses HIDL types.

This patch is the fixed first half of
I41204c0807d2bd4675e941771cbc9a43d7d14855
that was reverted due to a merge conflict.

Bug: 72873273
Bug: 69811500
Bug: 69010523
Test: playback and record for media and voice call
Original-Change-Id: I41204c0807d2bd4675e941771cbc9a43d7d14855
Change-Id: Ie543519fa0dca62486b75f42bb0c8a93d6cad3c3
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-04-20 17:05:15 -07:00
Kevin Rocard
3d41027bc1 Audio V4: dump effect HAL using the standard debug()
A debugDump was used previously because the debug did not exist.
Now that the framework uses debug(), the HAL must also do so.

Bug: 78307161
Test: adb shell dumpsys media.audio_flinger
Change-Id: Ic5841d5284d742c572629249b80aa1de841983c7
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-04-20 22:15:15 +00:00
Kevin Rocard
3c50fab048 Merge "Revert "Audio: setParam improve status_t to Result consistency"" into pi-dev 2018-04-19 03:32:46 +00:00
Kevin Rocard
f26235fde0 Revert "Audio: setParam improve status_t to Result consistency"
This commit broke sailfish build in V4 due to 
https://cs.corp.google.com/android/hardware/interfaces/audio/core/all-versions/default/include/core/all-versions/default/PrimaryDevice.impl.h?q=hardware/interfaces/audio/core/all-versions/default/include/core/all-versions/default/PrimaryDevice.impl.h:251

not being updated.

This is really strange as
 1) sailfish should not build the V4 code in the first place
 2) walleye is not broken although it should be the broken code
 3) neither treehugger nor my local builds found this issue

Revert to give the time to investigate.

This reverts commit 2c6755a00c.

Reason for revert: <INSERT REASONING HERE>

Change-Id: Ibf5270c15d52212a41b3b4eb4c0fcfe82a08fd6b
2018-04-19 03:29:55 +00:00
Kevin Rocard
f21217f173 Merge "Audio: setParam improve status_t to Result consistency" into pi-dev 2018-04-19 02:08:06 +00:00
Mikhail Naganov
93a2065eca audio: Add VTS tests for new interface methods in V4.0
Add VTS tests for the following methods:
  IStreamOut::selectPresentation
  IPrimaryDevice::getBtHfpEnabled
  IPrimaryDevice::setBtHfpEnabled
  IPrimaryDevice::setBtHfpSampleRate
  IPrimaryDevice::setBtHfpVolume
  IPrimaryDevice::setBtScoHeadsetDebugName
  IPrimaryDevice::updateRotation

Fix the default implementation of IPrimaryDevice::setBtHfpVolume

Bug: 74037175
Test: VtsHalAudioV4_0TargetTest
Change-Id: I39beb05184d0ecdb2799de037e1c5c3c383f5494
2018-04-18 08:41:16 -07:00
Kevin Rocard
2c6755a00c Audio: setParam improve status_t to Result consistency
The rest of the API (*::analyseStatus) returns NOT_SUPPORTED
when the legacy API returns -ENOSYS.

setParameter legacy -> treble shim did not follow this
conversion due to the legacy API stating that for get_paramers,
-ENOSYS should be returned if
"the implementation does not accept a parameter change while the
 output is active but the parameter is acceptable otherwise",
aka INVALID_STATE.

Thus setParameter shim used to return
 - OK for OK
 - INVALID_STATE for -ENOSYS
 - INVALID_ARGUMENTS for everything else

This leads to several problems:
 - an implementation of the legacy API can not report NOT_SUPPORTED
 - is inconsistent with the rest of the status_t conversion methods
 - shim methods implemented over getParameter can not distinguish
   failures error required by the .hal documentation

Most importantly, on the system side, the Result is transformed to a
status_t again but without any special logic for methods wrapping
getParameter in the shim.
This can not be changed as the system can not know which methods
are implemented with a legacy wrapper under the Treble API boundary.

Thus setParam now converts status_t to Result in the same way
as all the other shim methods.

Bug: 72873273
Bug: 69811500
Bug: 69010523
Test: playback and record for media and voice call
Change-Id: I41204c0807d2bd4675e941771cbc9a43d7d14855
Merged-In: I41204c0807d2bd4675e941771cbc9a43d7d14855
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-04-17 20:59:32 -07:00
TreeHugger Robot
c4db9d17cd Merge "Audio V4: Use of EffectFlags over bitfield<EffectFlags>" into pi-dev 2018-04-10 19:34:22 +00:00
Kevin Rocard
4be23925c0 Audio V4: Use of EffectFlags over bitfield<EffectFlags>
This was breaking Treble interface consistency test.

Bug: 77853088
Test: play music effect work
Change-Id: Ieb54f9c154e346286da353d0c3cdc770574c9bfe
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-04-10 09:49:26 -07:00
Kevin Rocard
1fe076b44d Audio V4: Synchronize the devices between the policy XSD and .hal
- The ALL devices should not appear in the XSD as they are helpers for
enum value validity checks.
 - Add the V4 values HEARING AIDS, ECHO_CANCELLER, BLUETOOTH_BLE.
 - Sort the values in the same order as the enum values in
audio-base.h for easier comparison.

Bug: 77307068
Test: xmllint -xinclude --schema \
        hardware/interfaces/audio/4.0/config/audio_policy_configuration.xsd \
        out/target/product/walleye/vendor/etc/audio_policy_configuration.xml
Signed-off-by: Kevin Rocard <krocard@google.com>

Change-Id: I8b970d21eb0b3f256d6866be9ef935d12283076e
2018-04-04 22:18:48 +00:00
Kevin Rocard
60c1ad7797 Audio V4: Add metadata update to legacy API
The metadata API was not present in the legacy HAL which lots of
developer still use.

Test: Check the method is correctly called on each track change
Bug: 38184704
Bug: 69623109
Change-Id: If56b4ee3739194e49808cf24d728c791b0588f9f
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-03-30 10:21:48 -07:00
TreeHugger Robot
ab5c4f072c Merge "Support query microphones information." into pi-dev 2018-03-30 16:59:41 +00:00
TreeHugger Robot
1d6501ee52 Merge "Audio V4: Add V2 XML in V4 effect" into pi-dev 2018-03-28 20:48:18 +00:00
Kevin Rocard
1641a23adf Audio V4: fix typo in XSD for VTS
Bug: 76165942
Bug: 74037175
Bug: 38184704
Change-Id: If8acbdfd27af726620d53fbded139f1107817ef4
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-03-27 16:32:00 +00:00
Kevin Rocard
79f1a6faee Audio V4: Add V2 XML in V4 effect
The XML format has not changed. Symlink the V4 XSD to the V2.

Bug: 76165942
Bug: 38184704
Test: vts-tradefed run commandAndExit vts --module VtsHalAudioEffectV4_0Target
Change-Id: I25a61c125c461c6c5b89d53142dcf887d6c94347
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-03-23 15:21:53 -07:00
jiabin
1b09e26909 Support query microphones information.
Add conversions between hal and framework.

Bug: 64038649
Bug: 75041465
Test: Manual Testing and Cts test
Change-Id: I88a292f0509e09467750affbe84350ed82cdd500
2018-03-21 15:24:20 -07:00
Kevin Rocard
a8da86e403 Audio V4: do not override V4 audo policy config XSD
The xsd did not have its version in its name, thus the V4 and V2 were
overwriting each other.

Bug: 38184704
Test: vts-tradefed run commandAndExit vts --module VtsHalAudioV4_0Target
Change-Id: Id7e733729a9afcdcc582f88a5527b6eb1c7283bf
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-03-21 14:43:36 -07:00
TreeHugger Robot
14dc815cdc Merge changes from topic "audio-hal-v4" into pi-dev
* changes:
  Audio V4: Update V2 tests to V4
  Fix issues in ReturnIn
  Audio V4: Duplicate V2 tests
2018-03-21 03:13:53 +00:00
Dean Wheatley
ce8b2734f7 Add 5.1.2, 5.1.4, 7.1.2, 7.1.4 output channel masks
They were supposed to be added by the change with id
I2f488462614114e4c82149460b030585981ae15e
but actually were not.

Also, rename OUT_TOP_CENTER_... to OUT_TOP_SIDE_...
according to Dean's suggestion.

Bug: 38184704
Bug: 63901775
Test: make
Change-Id: Ib263b06e4f3aa84525c2255f7a52f9bb39dbebcd
2018-03-19 09:38:00 -07:00
Kevin Rocard
e3afd40e91 Audio V4: Update V2 tests to V4
Bug: 74037175
Bug: 38184704
Test: vts-tradefed run commandAndExit vts --module VtsHalAudioV4_0Target
Change-Id: Ic8da941fc042b7ef838edf8fdac36b2f0fa1fd32
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-03-14 19:38:03 -07:00
Kevin Rocard
8532f6b2cc Fix issues in ReturnIn
Bug: 74037175
Test: compile
Change-Id: Icc3a0d1d489474de7c6255a014dccecc4dda4aa2
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-03-14 19:38:03 -07:00