Commit graph

132 commits

Author SHA1 Message Date
Kevin Rocard
30a7fcca29 Audio V4: Implement the shim effect 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: If412eb55ebf6afc773593547af9395a09b6825c2
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-03-02 13:20:02 -08:00
Zhuoyao Zhang
7dc6ce8107 Convert audio effect hal test to use VtsHalHidlTargetTestEnvBase
Bug: 64203181
Test: make vts
      vts-tradefed run vts -m VtsHalAudioEffectV2_0Target

Change-Id: Ifbdbfe5d5627f9281ba773cbeac718488d997efd
2018-02-08 12:45:17 -08:00
Kevin Rocard
87ac081930 Audio V4: Create audio V4.0 .hal makefiles
Run update-makefiles.sh to create all HAL makefiles.

Test: update-makefiles.sh
Bug: 38184704
Change-Id: I2532c4b9d1f0f6252ceaffbfb0c5d0a615400c72
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-02-01 16:17:34 -08:00
Kevin Rocard
eacb99697f Audio V4: More fixes of the audio 2.0 API
Remove unnecessary Result typedef.
Make bufferSizeFrames and burstSizeFrames unsigned
as they should not be negative.
Remove legacy AudioInterleave.
Remove implicit callflow annotation.
Make EffectConfigParameters a bitfield.

Bug: 38184704
Test: hardware/interfaces/update-makefiles.py
Change-Id: I33e6f7869d20ca0cad4123f32347754e5a514caa
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-02-01 16:17:34 -08:00
Kevin Rocard
0fd5bc2dce Audio V4: Remove deprecated function and enum
The debugDump function was deprecated by the introduction of the
debug method in the IBase.

AudioMode CURRENT and INVALID should not be passed to the
vendor.

Bug: 38184704
Test: none
Change-Id: I0e14c71ce7216524587a6ba28cae0cdb821bae23
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-02-01 15:24:25 -08:00
Kevin Rocard
79c574082d Audio V4: bitfield enum now use the bitfield class
The audio HAL has lots of enums were each value is a specific bit
pattern (usually a single bit) and are expected to be used as a
combination of value (kind of like a bitfield).

Nevertheless the 2.0 methods only had the enums themselves in their
signatures which leads the HIDL API checkers to warn that invalid values
were passed.

Currently, there are no way to express a value which is a combination
of enum values. The closest thing is the bitfield type.

Thus transition all enums combination to bitfield.

Note that AudioDevice as NOT been transition systematically
as both the enums and the combination are meaningful:
 - the enum is one device
 - the combination is a list of device.

Test: none
Bug: 38184704
Change-Id: I155cf7bc5d88fc5cf8954903d55aa8d7ca458a4b
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-02-01 15:24:25 -08:00
Kevin Rocard
74980b56eb Audio V4: Fix documentation and useable/untestable bugs
Add missing documentation, especially for failure cases
and methods that are optional.
Add missing operation status for testability.
Add format for getSupported* methods as they could not
be implemented in 2.0 for multi-format stream (HDMI).

Test: compile
Bug: 38184704
Change-Id: I14ee5e02ef70a82df6de732f88b065810e9b032f
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-01-31 23:09:23 -08:00
Kevin Rocard
a4e6d8b1de Audio V4: Copy 2.0 .hal files in 4.0
That will ease review of the changes.
The only changes are:
 - replace all @2.0 by 4.0
   $ sed -i 's/@2\.0/@4\.0/g' */4.0/*.hal
 - replace all licence 2016 by 2018
   $ sed -i 's/2016/2018/g' */4.0/*.hal

Moving the .hal in a subfolder forces the package name and the
namespace to change.

This mean that the audio HAL 2.0 and 4.0 will not be consider
different version of the same HAL but two different HALs.

As a result to minimize code change due to tight deadline,
keep the 4.0 core in the audio folder.

Bug: 38184704
Test: hardware/interfaces/update-makefiles.sh
Change-Id: I7c7a826270c9933091f037b795806787e1284583
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-01-31 10:39:47 -08:00
Kevin Rocard
8bdafc1b5c Revert "Audio V4: Split system and vendor Audio.h"
This reverts commit 49c56de516.

Reason for revert: Breaks the build of multiple devices

Change-Id: Iebd868467948b8afa5907462ccc0720cd9c4871e
2018-01-24 06:12:44 +00:00
Kevin Rocard
49c56de516 Audio V4: Split system and vendor Audio.h
audio.h and its dependencies (audio-effect.h, sound_trigger.h...)
used to be shared between system and vendor code.

This led to multiple problems:

1) Such sharing contradicts the Treble policy of
strict independence of framework and vendor code.

2) When audio.h was changed, every vendor needed to update
its code in the next release. This meant that audio*.h
headers were mostly changed in backward compatible manner.
Nevertheless, for P the HIDL interface and thus the audio.h
interface are changed in backward incompatible way.
(Some enum are becoming 64 bit long).

3) As the headers were common, some API used only by the framework
needed to be visible to the vendors (mostly enum values).

4) Treble policy is to support at least one previous HAL version

As a result the audio*.h headers are now duplicated,
one set for the framework, and one for the vendor.

Each set will evolve independently. After this split,
the framework-only APIs will be removed from the vendor headers
and vice versa.

The split is implements as such:

 + for system code

    - NOT moving the libaudio_system_headers
      Eg: system/audio.h and system/audio_effects/effect_equalizer.h
          are still in system/media/audio

    - the legacy audio HAL API that were in libhardware headers
          are now in libaudiohal_legacy_headers
      Eg: hardware/audio.h and hardware/audio_effect.h
          are now in frameworks/av/media/libaudiohal/legacy/

 + for vendor code

    - moving libaudio_system_headers and the legacy audio HAL API
          that were in libhardware_headers in
          android.hardware.audio.common.legacy@2.0
      Note that those headers are now versioned, so migrating to a @4.0
          HIDL HAL will mean changing the legacy dependency too.
      Eg: system/audio.h, system/audio-effect.h, hardware/audio.h
          are now in hardware/interfaces/audio/common/2.0/legacy

    - the legacy audio effect HAL API that was in libaudioeffects
          is now moved in android.hardware.audio.effect.legacy@2.0
      Eg: audio_effects/effect*.h are now in
          hardware/interfaces/audio/effect/2.0/legacy

    - the legacy sound trigger HAL API that were in libhardware_headers
          is now moved in android.hardware.soundtrigger.legacy@2.0
      Eg: hardware/sound_trigger.h is now in
          hardware/interfaces/audio/effect/2.0/legacy

libaudioutil being used by both system and vendor, had
to be renamed for system to libaudioutil_system.

Vendor libs that now depend on the audio.h of a specific
version and are not extensively referenced in non google code,
append @2.0 to their name.

Note that headers that are not expected to change in the 4.0 HAL are
left in all-versions folder to avoid duplication.
This is an implementation detail as the versioned libraries export
the all-versions headers.

Note that strict vendor-system separation is enforced by the
build-system. The system headers are not available for vendor
libs and vice-versa.

Note that this patch is split between numerous git repository (>10),
all the commits having the same Change-id for searchability.

Note that audio_policy.h is no longer exposed to vendors
as the legacy audio policy HAL API was never officially supported.
As a result the audiopolicy stub implementation has been removed.

Test: compile taimen-userdebug walleye-userdebug
              sailfish-userdebug marlin-userdebug
              gce_x86_phone-userdebug gce_x86_phone
              full-eng aosp_arm aosp_x86-eng
Test: check that the emulator booted and played audio
Test: full QA on sailfish-userdebug and taimen-userdebug
Bug: 38184704
Change-Id: I950f4e0a55613d72e32eba31bd563cb5bafe2d1a
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-01-22 22:00:56 -08:00
Kevin Rocard
62588b69f6 Audio V4: Make effect default wrapper device independent
What was done in this patch:
 # move headers in all-versions/default folder for qualified inclusion
mkdir -p audio/effect/all-versions/include/effect/all-versions/default/
mv audio/effect/all-versions/*[hp] $_
 # Go in the all-versions header folder
cd $_
 # Use a macro for the version
sed -i '/^#/!s/V2_0/AUDIO_HAL_VERSION/g' *
 #Remove 2.0 includes
sed -i "/include.*2.0/d" *
 # Add include guard to make sure AUDIO_HAL_VERSION is set
sed -i '/limitations under the License/!b;N;a\n#include <common/all-versions/IncludeGuard.h>' *
 # Remove guard include macro
sed -i '/^#.*[H_]$/d' *
 # Remove LOG_TAG
sed -i '/LOG_TAG/d' *
 # Remove local include (include "XXX")
sed -i '/include.*"/{N;/\n$/d;D}' *
 # Replace implementation with inclusion
cd audio/effect/2.0/
git checkout HEAD^^
ls *h *cpp| sed -r 's/.*h$/\0 \0/;s/(.*)cpp/\1impl.h \0/' |xargs -L1 printf '1h;2,$H;$!d;g;s$namespace.*}[^\\n]*$#define AUDIO_HAL_VERSION V2_0\\\n#include <effect/all-versions/default/%s>\\\n#undef AUDIO_HAL_VERSION$\000%s\000'|xargs -0 -n2 sed -i
+ manual update of Android.bp and removal of duplicate include

Bug: 38184704
Test: compile
Change-Id: If99871516f3069fcb9e699ab670a665d7d507e7d
2018-01-20 10:49:57 -08:00
Kevin Rocard
1bd2a336bc Audio V4: Move the legacy effect wrapper before refactor
This will make diff much more clear and allow git to follow the files.

Bug: 38184704
Test: compile
Change-Id: I90deaad883a52ef8fbcd3109937f90d46d458f8c
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-01-20 10:49:57 -08:00
Kevin Rocard
22505e6bf1 Audio V4: Fix issues in the effect legacy wrapper raised by clang-format
This patch only contains cosmetic reformatting imposed by clang-format.

Bug: 38184704
Test: compile
Change-Id: If5e61eecd0a67fec19997792c9db73936ce7be2e
Signed-off-by: Kevin Rocard <krocard@google.com>
2018-01-20 10:49:57 -08:00
Kevin Rocard
6891d7ec28 Audio V4: Make common helper version independent
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-20 10:49:57 -08:00
Chih-Hung Hsieh
dbd7e5f031 Merge "Use -Werror in hardware/interfaces/audio" am: 7a4422d2a5 am: ae9fb022a3
am: 5d8244ee3f

Change-Id: I0826ee82634360949a94b3ca51011fe52f9f8079
2017-11-28 19:18:04 +00:00
Chih-Hung Hsieh
ae9fb022a3 Merge "Use -Werror in hardware/interfaces/audio"
am: 7a4422d2a5

Change-Id: Ib0cf1e15856fd58f0f2ea726e3d5b94177ab33a1
2017-11-28 19:03:31 +00:00
Chih-Hung Hsieh
b38c1aebc1 Use -Werror in hardware/interfaces/audio
* Remove unused variables, lambda function parameters..

Bug: 66996870
Test: build with WITH_TIDY=1
Change-Id: I28e8eb1af434f62cab6f41285b9a400f7f57cd13
2017-11-28 17:11:33 +00:00
Xin Li
bb9e38fef9 Merge commit '1a06284b24f5eb7bb9c1fea0817da8898b3b1bff' from
oc-mr1-dev-plus-aosp into stage-aosp-master

Change-Id: I2a044eb8c9981d0a8198ffe2df55559afbd76341
Merged-In: I4fb9f18884f7ef21162015a0032c4431444f7025
2017-11-14 12:08:38 -08:00
Steven Moreland
8db261bc99 Updating makefiles for hidl_interface.
Bug: 64487114
Test: manual
Merged-In: Ie13d9e014cf2b81c18c67f551b4644fb9f0ba812
Change-Id: Ie13d9e014cf2b81c18c67f551b4644fb9f0ba812
2017-11-13 10:00:18 -08:00
Steven Moreland
a1169dd600 Update makefiles for hidl_interface.
Bug: 35570956
Test: manual
Change-Id: I7a220b78ee081240e1dc30ef5672ba39e3e98375
2017-11-10 09:06:55 -08:00
Steven Moreland
d28c1bdf62 Merge "Automatic mk -> bp." am: e5fd969f19 am: 72c720a4e3
am: 26013bf6ac

Change-Id: Id936fb4806d122045c771c951220361efeef10c6
2017-11-07 21:24:49 +00:00
Steven Moreland
26013bf6ac Merge "Automatic mk -> bp." am: e5fd969f19
am: 72c720a4e3

Change-Id: Icfc8b46117e94461906806023852836a0ace3a55
2017-11-07 21:21:40 +00:00
Steven Moreland
90e3a50f03 Automatic mk -> bp.
Automatic mk -> bp conversion for all modules here
which can be converted and built automatically.

Test: Soong resolves all dependencies
Bug: 37512442
Change-Id: Ib789212cb88d55731397c600d132e7c672c0d8be
2017-11-03 16:30:28 +00:00
TreeHugger Robot
2aa5fe9241 Merge "Audio VTS: improve audio policy validation error messages" 2017-10-28 07:11:23 +00:00
TreeHugger Robot
7e156d1512 Merge "Add the audio team as owner of the audio VTS" 2017-10-24 02:31:10 +00:00
Kevin Rocard
f16fabef5d Add the audio team as owner of the audio VTS
Change-Id: I514c37b3c9da3df700fa208e79ff6597f8914092
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-10-23 21:26:16 +00:00
Steven Moreland
116161d94e Update for Soong java makefiles. am: c3e80fa01e am: 0fff75dee1
am: 6c811964a1

Change-Id: I85ccbb4a15cd18938607f5bca4e065b9d7e0182b
2017-10-11 16:31:07 +00:00
Steven Moreland
c3e80fa01e Update for Soong java makefiles.
Test: pass
Bug: 33420795
Change-Id: Id9b1919a19b8ff682738cfb0869a479b4dbb4293
2017-10-10 23:07:20 +00:00
Steven Moreland
0653f3b212 Merge "Remove useless Android.mk files." am: 75d5cf515a am: f27cfa15d7
am: 33dc30ce49

Change-Id: Ia35d20e0fc1df6f7c46b5581537d7ed387965899
2017-10-05 21:51:13 +00:00
Treehugger Robot
75d5cf515a Merge "Remove useless Android.mk files." 2017-10-05 21:40:27 +00:00
Steven Moreland
4b60470f1a Remove useless Android.mk files.
These have been c/p'd all over the place.

Test: m -j nothing
Bug: 33420795
Change-Id: I77979866dbb2345a41a873c84ec3fccd7b127510
2017-10-04 15:52:40 -07:00
Steven Moreland
9a17f41f6f Merge "Update for hidl adapter module defaults." am: 988c977079 am: 861651985f
am: b53e6ad535

Change-Id: I23269fb7a9bdd352e670a80f390527d9eef31412
2017-10-04 21:51:00 +00:00
Steven Moreland
527fd76a0e Update for hidl adapter module defaults.
Test: pass
Change-Id: Idc6a943149a279bf17cfcfd0f2571473e53bbbbf
2017-10-04 12:47:03 -07:00
Steven Moreland
9fdd241905 Merge "Fix typo in update makefiles." am: 9960148420 am: f07e364ce3
am: 71a193a425

Change-Id: I45ae43f07323254212532acbf0f891d11143b05f
2017-09-26 23:58:51 +00:00
Steven Moreland
a5299ee739 Fix typo in update makefiles.
Bug: 37518178
Test: pass
Change-Id: Ic401b3a473f15ca4c01e58b3072e19db7c31b653
2017-09-26 21:59:43 +00:00
Kevin Rocard
69a76b1dfa Audio VTS: improve audio policy validation error messages
If multiple config are found, each will be validated before failing the
test.
Also add a missing new line before dumping libxml2 errors.

Test: run the following script to check for regressions and test that
      invalid config make the test fail.

    runTest() {(
      set -xu
      local readonly MODULE=$1
      local readonly TEST=$2
      local readonly XML=$3
      runVTS() { vts-tradefed run commandAndExit vts \
            --skip-all-system-status-check --primary-abi-only \
            --skip-preconditions --module $MODULE -t $TEST |
                 awk '/FAILED: 0/{e=1} {print} END {exit !e}'; }

      local FAIL=0 # used instead of return if clean up is needed

      echo "# Test valid config"
      runVTS || return 1

      echo "# Test multiple invalid match"
      adb shell touch /system/etc/$XML
      runVTS && FAIL=2
      adb shell rm /system/etc/$XML

      echo "# Test multiple valid match (not supported if xinclude)"
      if !adb shell grep -q xi:include /vendor/etc/$XML; then
        adb shell cp /{vendor,system}/etc/$XML
        runVTS || FAIL=3
        adb shell rm /system/etc/$XML
      fi

      echo "# Test invalid config"
      adb shell sed -i "'2i<fuu/>'" /vendor/etc/$XML
      runVTS && FAIL=4
      adb shell sed -i 2d /vendor/etc/$XML

      echo "#Test no config"
      adb shell mv /vendor/etc/$XML{,.hide}
      runVTS && FAIL=5
      adb shell mv /vendor/etc/$XML{.hide,}

      echo "# Test that the test did not break the config"
      runVTS || FAIL=6

      return $FAIL
    )}
    runTest VtsHalAudioV2_0Target CheckConfig.audioPolicyConfigurationValidation audio_policy_configuration.xml &&
    runTest VtsHalAudioEffectV2_0Target CheckConfig.audioEffectsConfigurationValidation audio_effects.xml &&
    echo TEST PASSED

Bug: 64881365
Change-Id: If0443f85e0d687eed04819337519e4d9f09f5ca9
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-09-26 17:15:59 +00:00
Steven Moreland
97228c0b7d Update makefiles for hidl adapter. am: 26a0bb2762 am: 73949c1d7e
am: b94d0c7290

Change-Id: If766cffbcc003cc0cc5eb98969b924aa918fff44
2017-09-26 12:53:13 +00:00
Steven Moreland
26a0bb2762 Update makefiles for hidl adapter.
Bug: 37518178
Test: manual
Change-Id: I50e999907d3c64d2b039272b823971998da64d1b
2017-09-25 18:35:56 +00:00
Tri Vo
c619cac2be Merge "Audio test statically links to dependencies." into oc-mr1-dev 2017-08-16 17:33:24 +00:00
Tri Vo
eb8dfd8c01 Audio test statically links to dependencies.
This test now statically links to libs not guaranteed to be on the
device.

Bug: 64040096
Test: vts-tradefed run commandAndExit vts --skip-all-system-status-check 
--primary-abi-only --skip-preconditions 
--module VtsHalAudioEffectV2_0Target
Test: vts-tradefed run commandAndExit vts --skip-all-system-status-check 
--primary-abi-only --skip-preconditions 
--module VtsHalAudioV2_0Target

Change-Id: I331d7e4abdf7e520df6d508a8059b6358ad4398f
2017-08-15 17:38:58 +00:00
Steven Moreland
dfd8287506 Updating all makefiles.
Bug: 64487114
Test: none
Merged-In: I8608c8f636c35f21e4246a805a9eff6d14124e0a
Merged-In: I2fa89b6661c39859ec4fb62c4bb0a05a35e645f0
Merged-In: Ifdc3c17cb2b85c18b37dac2d03bb5c8935c23180
Change-Id: I170fa1c4fe39f8109b1670db58ef99bb11afc0be
2017-08-14 20:25:09 +00:00
Justin Yun
608d773ef8 Update make file for vndk enabled.
Update the Android.bp generated with hidl-gen.

Test: build with and without BOARD_VNDK_VERSION=current
Bug: 63866913
Change-Id: I1a9db1df49e0f13c5790da2b118ae9ec63ba34a7
2017-08-04 14:12:23 +09:00
Tri Vo
f5d136c231 Update Android.bp HIDL makefiles
Allow HAL definition libs to be static.

Bug: 32920003
Bug: 64040096
Test: update-all-google-makefiles.sh
Change-Id: I1483d572bea6799717d1614fb7d52fe225e31104
2017-08-03 00:30:01 +00:00
Kevin Rocard
60012203d3 Audio VTS: Change test utility from dyn to static lib
Bug: 63801053

In order to avoid having to instruct vts-tradefed to push the test
utility library on the target before runing the audio VTS,
duplicating the makefile declaration,
make the library static.

Test: make vts
Test: vts-tradefed run commandAndExit vts --module VtsHalAudioV2_0Target
Change-Id: I7a98b2aaf0e0f6f91a92b7f01df1c630540ad697
Merged-In: I7a98b2aaf0e0f6f91a92b7f01df1c630540ad697
(cherry picked from commit 921d12ea6d)
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-07-20 10:01:44 -07:00
Mikhail Naganov
afae464376 Add OWNERS for audio-related HAL default implementations
Test: not needed
Change-Id: Idefe7be10bde22866be82f87118b9b54e74c3f40
2017-07-14 17:14:53 +00:00
Mikhail Naganov
6301fc325e Add VTS test for validating audio effects config against XML schema
If the device contains /vendor/etc/audio_effects.xml (the new XML
format for the audio effects configuration), the test validates
this config against the schema contained in
audio/effect/2.0/xml/audio_effects_conf_V2_0.xsd
(pushed to the device by the VTS test runner)

Change-Id: Ib57d30e3c1e32ce5d74f906a216f9bb8f635a28c
Test: this is a test
Bug: 37492580
2017-07-07 17:45:15 -07:00
Kevin Rocard
6a0af3c51b Can not specify an audio effect for the default stream
The default stream is an alias to an other stream.
One can not allocate effects for it in the configuration
as it could conflict with the stream it aliases.

Test: run xmllint against all audio effect configs
Bug: 37492580
Change-Id: Ia2bbc13b5cf2a0a40e5eeff7ee22a7423ec16767
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-07-07 17:45:15 -07:00
Kevin Rocard
3296cee7e5 Configure audio effects libraries with relative path
audio effects.conf legacy format had the libraries specified
in absolute path.
Nevertheless those libraries must be in specific folders.
The .conf loader used to strip the prefix of the paths then
try to load the libraries in those specific folders.

With new xml format the user only has to specify the name of the library
and the loader will load it from the known folders.

Test: run xmllint against a config with absolute paths
Bug: 37492580
Change-Id: I2863e04b3cdf0c6758d9f7be33796621fee527ed
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-07-07 17:45:15 -07:00
Kevin Rocard
627fdaae3d Audio effect XSD: Give effect proxy its own tag
Effect and effect proxy do not have the same xml structure.
As they had the same xml tag, it was impossible to discriminate them in
the xsd. Leading to xsd validating incorrect xml.

This patch changes the xsd to force proxy effect to have the type
<effectProxy> instead of <element>.

With this patch, effects have to be explicit about being a proxy and
they are forced to have a hw *and* a sw library.

Bug: 37492580
Test: validated xsd against converted effects.conf
Test: vendor/box/user/mnaganov/audio-effects-conf/test.sh
Change-Id: Idf8a1040feccbfd6a346ab9bc892f3b7e87df530
Signed-off-by: Kevin Rocard <krocard@google.com>
2017-07-07 17:45:15 -07:00
Mikhail Naganov
7a5614bc9e Revert "Revert of "Audio: Add XML schema for audio effects configuration""
Add the configuration back on the master development branch.

This reverts commit d5196af814.

Bug: 37492580
Change-Id: Ie2d3218d942a995aec4d6b73fb7813e76604066b
Test: not needed
2017-07-07 17:45:03 -07:00