Commit graph

526 commits

Author SHA1 Message Date
Kevin Rocard
921724c2c9 Audio VTS: Workaround async HIDL destructor by sleeping
am: d87a288e82

Change-Id: I6af4b725b9917d99c450287ba4bfce864371a104
2018-09-20 10:48:42 -07:00
Kevin Rocard
d87a288e82 Audio VTS: Workaround async HIDL destructor by sleeping
The test creates an instance of the Audio HAL then destroys it and create it again.
The test assumed that the destruction was synchronous when in fact it is async with
no way of knowing when the object has been destroyed.

As a result, until a better solution is found, sleep for 100ms to hopefully let enouth
time for the HAL destructor to return.

Bug: 112566489
Test: adb shell /data/nativetest64/VtsHalAudioV4_0TargetTest/VtsHalAudioV4_0TargetTest --gtest_filter=*OpenPrimaryDeviceUsingGetDevice
      atest VtsHalAudioV4_0TargetTest
Change-Id: I0ec75c12007d39060232632708722df5bf0f99d7
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-09-19 18:27:15 +00:00
Kevin Rocard
c23b3a5dda Merge "Audio VTS: Always check for Result::isOk()" into pie-vts-dev
am: 2070f8b0b8

Change-Id: Icf4a294d1fef7626b8248500dffc6bcd0189571e
2018-09-18 10:57:50 -07:00
Kevin Rocard
e8957a35ea Audio VTS: Always check for Result::isOk()
A test was not checking for the Result::isOk() resulting
in an assert being triggered in HIDL code if the HAL crashed.

Test: (sleep 0.3; adb shell pkill audio) &
      adb shell /data/nativetest64/VtsHalAudioV4_0TargetTest/VtsHalAudioV4_0TargetTest
      # Test finishes in failure but does not crash
Signed-off-by: Kevin Rocard <krocard@google.com>

Change-Id: I97a6213fe82a5e9a6eb333dc1dc2476102610b58
2018-09-06 18:22:23 +00:00
Kevin Rocard
30c2361ad4 Merge "Allow getCapturePosition to return 0 frames for unprepared streams" into pie-vts-dev
am: 137194ef5e

Change-Id: Ibef9acb447f71a94c27ad62ffd93b87126637143
2018-08-30 10:22:35 -07:00
Kevin Rocard
eb2b0093cf Allow getCapturePosition to return 0 frames for unprepared streams
For device supporting getCapturePosition,
VTS only allowed unprepared stream to return INVALID_STATE.
Now also allow for the stream to return 0 frames similarly to the other
non started states.

Test: vts-tradefed run commandAndExit vts --module VtsHalAudioV2_0Target
Bug: 110367728
Cherry-piked from: d01dc3edac9e92981e7ae419d0e7622f753acf94
Merged-In: Ibdf8df8cb8809e98c40a50035371df6893fe4da4
Change-Id: Ibdf8df8cb8809e98c40a50035371df6893fe4da4
Signed-off-by: Kevin Rocard <krocard@google.com>
(cherry picked from commit 6c9c6e62c1)
2018-08-29 10:29:07 -07:00
Kevin Rocard
2642ddb86f Merge "VTS: Do not require XML for Audio effect V2" into pie-vts-dev
am: 5e6dd1288e

Change-Id: If389674923030e041dfdb95cd99cd0316603c917
2018-08-28 12:25:23 -07:00
Treehugger Robot
5e6dd1288e Merge "VTS: Do not require XML for Audio effect V2" into pie-vts-dev 2018-08-28 19:13:44 +00:00
Kevin Rocard
94b543c03c Merge "Audio VTS was testing wrong uninitialized variable due to typo" into pie-vts-dev
am: b3e86d489a

Change-Id: I13b546ec0e8785040e4096a7658474f2eff6c90e
2018-08-28 12:03:40 -07:00
Kevin Rocard
8ca56c3dee VTS: Do not require XML for Audio effect V2
In O, the Audio effect V2 HAL allows not to have an audio effect XML
configuration but to use a .conf format.

In P, before this patch, the Audio effect V2 HAL _requires_ to have an
audio effect XML configuration and forbids the use of a .conf format.

This is discouraged by Treble as it means that an unchanged HAL V2
implementation that was compatible with O VTS will not be with P VTS.

As a result, revert to the Oreo behavior for Audio Effect V2 VTS.

Note that the audio effect V4 VTS is not changed by this patch and
still requires an audio effect XML configuration.
Aka device _updating_ to P will not have to upgrade to XML but new
devices lunching on P are still required to have an audio effect
XML configuration.

This commit only changes VTS code.

Test: cd hardware/interfaces/audio/effect/
      mmm 2.0/vts/functional 4.0/vts/functional && adb sync data
      adb push *.0/xml/audio_effects_conf_V*.xsd /data/local/tmp/
      adb shell
      cd /data/nativetest64
      OPS=--gtest_filter=CheckConfig.audioEffectsConfigurationValidation
      VtsHalAudioEffectV2_0TargetTest/VtsHalAudioEffectV2_0TargetTest $OPS
      VtsHalAudioEffectV4_0TargetTest/VtsHalAudioEffectV4_0TargetTest $OPS
      rm /{odm,vendor,system}/etc/audio_effects.xml || true
      VtsHalAudioEffectV2_0TargetTest/VtsHalAudioEffectV2_0TargetTest $OPS
      ! VtsHalAudioEffectV4_0TargetTest/VtsHalAudioEffectV4_0TargetTest $OPS
Bug: 111421676
Change-Id: Ifb15d65ae4aa65759c8ebaa91cbc8c02234030dc
Merged-In: Ifb15d65ae4aa65759c8ebaa91cbc8c02234030dc
Signed-off-by: Kevin Rocard <krocard@google.com>
(cherry picked from commit b41b575475)
2018-08-28 18:18:21 +00:00
Kevin Rocard
8073d8e41c Audio VTS was testing wrong uninitialized variable due to typo
The test was testing a uninitialized variable instead of testing
the result of the tested method.

Bug: 110963314
Test: vts-tradefed run commandAndExit vts --module VtsHalAudioV2_0Target
Merged-In: I9a212eef690ae627fd7f7dbfaf4a0b4047c491b3
Change-Id: I9a212eef690ae627fd7f7dbfaf4a0b4047c491b3
Signed-off-by: Kevin Rocard <krocard@google.com>
(cherry picked from commit 72641e7ad0)
2018-08-28 17:46:41 +00:00
Kevin Rocard
8a452029f9 Effect VTS: Allow an effect proxy as pre/post processing am: 0f0328fc4e
am: a3268e954d

Change-Id: Ic9afa418ca68ed98368ab4696c4d3a3e5e8ccbdb
2018-08-20 11:21:39 -07:00
Kevin Rocard
a3268e954d Effect VTS: Allow an effect proxy as pre/post processing
am: 0f0328fc4e

Change-Id: I570e2a73de01900cf39b5d08cfed370ee17a0e38
2018-08-20 11:13:35 -07:00
Treehugger Robot
54c3572e99 Merge changes from topic "share-buffer"
* changes:
  Audio default HAL: hidl_memory size must be positive
  Aaudio: Implement app shareable flag instead of -size hack
2018-08-17 23:03:44 +00:00
Kevin Rocard
86910f0fc5 Audio default HAL: hidl_memory size must be positive
hidl_memory size is not used on the framework side but is checked by the
hidl framework to be a sensible value.
Due to a hack in O and P, the value can be negative, this leads to
errors in HIDL.

This patch make sure the hidl_memory size is always positive and thus
not affected by the hack.

Test: adb shell data/nativetest64/write_sine/write_sine -pl -m3 -x
Bug: 38118159
Change-Id: Ie53c46c558e8042d74ee32b55219195da82e4bcc
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-08-15 18:06:00 +00:00
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
51cdd13351 Aaudio: Implement app shareable flag instead of -size hack
Test: adb shell data/nativetest64/write_sine/write_sine -pl -m3 -x
Bug: 38118159
Change-Id: I2e2fc5801ee9f45565be6f989c0d83d0fdf54618
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-08-10 18:27:35 +00:00
Kevin Rocard
0f0328fc4e Effect VTS: Allow an effect proxy as pre/post processing
Effect proxy were previously mistakenly forbidden as post
or pre processing effects.

An effect being a proxy or not should not affect where
it can be use in the effect framework.

Bug: 111421676
Test: xmllint --noout --schema hardware/interfaces/audio/effect/2.0/xml/audio_effects_conf_V2_0.xsd $(find -name audio_effects.xml)
Change-Id: Iad1c1467226b86a2935a36dd90cf2e32f7f753b0
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-07-19 09:04:21 -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