Commit graph

50 commits

Author SHA1 Message Date
Keun Soo YIM
68ae05dd2d pack VTS cc_test binaries as general-tests
Test: make general-tests
Bug: 120093339
Merged-In: I363450d205868f900e4925ccff1430e2a569f2a4
Change-Id: I363450d205868f900e4925ccff1430e2a569f2a4
2018-12-07 10:49:56 -08:00
Kevin Rocard
5596e985d4 Audio VTS: Do not constrain implementation frameCount
am: 069bc45044

Change-Id: I3ec1df7f581e5b11e0d394139c1421109c16fc19
2018-10-03 16:15:32 -07:00
Kevin Rocard
069bc45044 Audio VTS: Do not constrain implementation frameCount
The test was assuming Stream::getFrameCount() would return the
AudioConfig::frameCount used to create the stream, similarly
to the sampleRate or the channelMask.

Nevertheless this is not the case as the AudioConfig::frameCount
field is not to used by Stream::openOutputStream (nor Input) as
the buffer size is chosen by the HAL, not the framework.

Thus the test can not assume the frameCount chosen by the HAL and
must not test for a particular value.

Test: atest VtsHalAudioV4_0TargetTest
Bug: 116169974
Change-Id: Ibbf0825f540957e01e7c512d851cb9628991f4c4
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-10-02 22:07:39 +00:00
jiabin
c17b71ff83 Test getActiveMicrophones API when mic is found on the device.
am: 497edcc026

Change-Id: I55a1ab98ef141b9834ec22491b31e09f581fca1a
2018-09-27 11:39:22 -07:00
jiabin
497edcc026 Test getActiveMicrophones API when mic is found on the device.
Before this patch the default microphone was required to have characteristics
although it is not always an attached device, thus its characteristics can not
be known by the HAL. Additionally, the HAL might not know the active
microphone info of a input stream if it has not been started yet.

This patch only tests microphones which characteristics are reported by the HAL
and start the input stream before requesting active microphones.

Bug: 109787938
Test: vts-tradefed run vts --module VtsHalAudioV4_0Target
Change-Id: If55bfc8210d4f9443d34951f717c6772b46dde04
Merged-In: If55bfc8210d4f9443d34951f717c6772b46dde04
2018-09-26 10:05:15 -07:00
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
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
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
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
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
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
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
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
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
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
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
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
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
18f463eeae Audio V4: Duplicate V2 tests
Because VTS must no be modified for old API version (except bug fixes),
as that could break retrocompatiblity.
As a result, a full copy is made. This commit is only:
$ cp -r core/2.0/vts/ core/4.0/vts
$ cp -r effect/2.0/vts/ effect/4.0/vts

With a V2 replaced by V4 test target name to avoid conflict.

Bug: 38184704
Test: Compile
Change-Id: Iddf9e7a9d42bfe84cf067a08d249a9cc0e6b7241
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-03-14 19:38:03 -07:00
Kevin Rocard
5ec293316e Audio V4: Implement the shim core 4.0 -> legacy
All the new files added are a copy of the 2.0 ones, with just the
version 2 that was changed to 4.

Due to the rollback on the retrocompatiblity breakage,
the split of implementation is not strictly needed any more.
This makes the current split in .impl.h and double include
unnecessary complicated.
This will need to be factorized in a future patch.

Bug: 38184704
Test: compile
Change-Id: I0d699ade7558ed68125b300f8522e2767ae1ee37
Merged-In: I0d699ade7558ed68125b300f8522e2767ae1ee37
Cherry-picked from master
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-03-06 11:30:51 -08:00
Kevin Rocard
4d46cea59c Audio V4: Add owner files for implementations
Bug: 38184704
Test: none
Change-Id: If45a4d7e16ecd045866230b48fde477d21f124e0
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-03-02 12:55:48 -08:00
Zhuoyao Zhang
f62c91f057 Convert audio hal test to use VtsHalHidlTargetTestEnvBase
Bug: 64203181
Test: make vts
      vts-tradefed run vts -m VtsHalAudioV2_0Target

Change-Id: I1f85216c992eabf70f7e907b5d2afc4fb59cbb4a
2018-01-23 18:20:56 -08:00
Kevin Rocard
740224e3e0 Audio V4: move 2.0/vts to core/2.0/vts to match effect's vts
Move in order to adhere to the new folder organisation.

Bug: 38184704
Test: compile
Change-Id: I7398cab951ee628782f81098b57b04a1402b4041
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-01-20 10:49:57 -08:00
Kevin Rocard
3887e24436 Audio V4: Rename audio/device to audio/core
The name device has already too many meaning, thus rename the main audio
api to core.

Bug: 38184704
Test: compile
Change-Id: I178dfef05af8f8579196affbe2cbc5f6c3f9af55
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-01-20 10:49:57 -08:00