xref: /aosp_15_r20/hardware/interfaces/audio/README.md (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1*4d7e907cSAndroid Build Coastguard Worker# Audio HAL
2*4d7e907cSAndroid Build Coastguard Worker
3*4d7e907cSAndroid Build Coastguard WorkerDirectory structure of the audio HAL related code.
4*4d7e907cSAndroid Build Coastguard Worker
5*4d7e907cSAndroid Build Coastguard Worker## Directory Structure for AIDL audio HAL
6*4d7e907cSAndroid Build Coastguard Worker
7*4d7e907cSAndroid Build Coastguard WorkerThe AIDL version is located inside `aidl` directory. The tree below explains
8*4d7e907cSAndroid Build Coastguard Workerthe role of each subdirectory:
9*4d7e907cSAndroid Build Coastguard Worker
10*4d7e907cSAndroid Build Coastguard Worker* `aidl_api` — snapshots of the API created each Android release. Every
11*4d7e907cSAndroid Build Coastguard Worker  release, the current version of the API becomes "frozen" and gets assigned
12*4d7e907cSAndroid Build Coastguard Worker  the next version number. If the API needs further modifications, they are
13*4d7e907cSAndroid Build Coastguard Worker  made on the "current" version. After making modifications, run
14*4d7e907cSAndroid Build Coastguard Worker  `m <package name>-update-api` to update the snapshot of the "current"
15*4d7e907cSAndroid Build Coastguard Worker  version.
16*4d7e907cSAndroid Build Coastguard Worker* `android/hardware/audio/common` — data structures and interfaces shared
17*4d7e907cSAndroid Build Coastguard Worker  between various HALs: BT HAL, core and effects audio HALs.
18*4d7e907cSAndroid Build Coastguard Worker* `android/hardware/audio/core` — data structures and interfaces of the
19*4d7e907cSAndroid Build Coastguard Worker  core audio HAL.
20*4d7e907cSAndroid Build Coastguard Worker* `default` — the default, reference implementation of the audio HAL service.
21*4d7e907cSAndroid Build Coastguard Worker* `vts` — VTS tests for the AIDL HAL.
22*4d7e907cSAndroid Build Coastguard Worker
23*4d7e907cSAndroid Build Coastguard Worker## Directory Structure for HIDL audio HAL
24*4d7e907cSAndroid Build Coastguard Worker
25*4d7e907cSAndroid Build Coastguard WorkerRun `common/all-versions/copyHAL.sh` to create a new version of the HIDL audio
26*4d7e907cSAndroid Build Coastguard WorkerHAL based on an existing one. Note that this isn't possible since Android T
27*4d7e907cSAndroid Build Coastguard Workerrelease. Android U and above uses AIDL audio HAL.
28*4d7e907cSAndroid Build Coastguard Worker
29*4d7e907cSAndroid Build Coastguard Worker* `2.0` — version 2.0 of the core HIDL API. Note that `.hal` files
30*4d7e907cSAndroid Build Coastguard Worker  can not be moved into the `core` directory because that would change
31*4d7e907cSAndroid Build Coastguard Worker  its namespace and include path.
32*4d7e907cSAndroid Build Coastguard Worker   - `config` — the XSD schema for the Audio Policy Manager
33*4d7e907cSAndroid Build Coastguard Worker     configuration file.
34*4d7e907cSAndroid Build Coastguard Worker* `4.0` — version 4.0 of the core HIDL API.
35*4d7e907cSAndroid Build Coastguard Worker* ...
36*4d7e907cSAndroid Build Coastguard Worker* `common` — common types for audio core and effect HIDL API.
37*4d7e907cSAndroid Build Coastguard Worker   - `2.0` — version 2.0 of the common types HIDL API.
38*4d7e907cSAndroid Build Coastguard Worker   - `4.0` — version 4.0.
39*4d7e907cSAndroid Build Coastguard Worker   - ...
40*4d7e907cSAndroid Build Coastguard Worker   - `7.0` — version 7.0.
41*4d7e907cSAndroid Build Coastguard Worker      - `example` — example implementation of the core and effect
42*4d7e907cSAndroid Build Coastguard Worker        V7.0 API. It represents a "fake" audio HAL that doesn't
43*4d7e907cSAndroid Build Coastguard Worker        actually communicate with hardware.
44*4d7e907cSAndroid Build Coastguard Worker   - `all-versions` — code common to all version of both core and effect API.
45*4d7e907cSAndroid Build Coastguard Worker      - `default` — shared code of the default implementation.
46*4d7e907cSAndroid Build Coastguard Worker         - `service` — vendor HAL service for hosting the default
47*4d7e907cSAndroid Build Coastguard Worker           implementation.
48*4d7e907cSAndroid Build Coastguard Worker      - `test` — utilities used by tests.
49*4d7e907cSAndroid Build Coastguard Worker      - `util` — utilities used by both implementation and tests.
50*4d7e907cSAndroid Build Coastguard Worker* `core` — VTS tests and the default implementation of the core API
51*4d7e907cSAndroid Build Coastguard Worker  (not HIDL API, it's in `audio/N.M`).
52*4d7e907cSAndroid Build Coastguard Worker   - `7.0` — code specific to version V7.0 of the core HIDL API
53*4d7e907cSAndroid Build Coastguard Worker   - `all-versions` — the code is common between all versions,
54*4d7e907cSAndroid Build Coastguard Worker     version-specific parts are enclosed into conditional directives
55*4d7e907cSAndroid Build Coastguard Worker     of preprocessor or reside in dedicated files.
56*4d7e907cSAndroid Build Coastguard Worker       - `default` — code that wraps the legacy API (from
57*4d7e907cSAndroid Build Coastguard Worker         `hardware/libhardware`).
58*4d7e907cSAndroid Build Coastguard Worker         - `util` — utilities for the default implementation.
59*4d7e907cSAndroid Build Coastguard Worker       - `vts` VTS tests for the core HIDL API.
60*4d7e907cSAndroid Build Coastguard Worker* `effect` — same for the effect HIDL API.
61*4d7e907cSAndroid Build Coastguard Worker   - `2.0`
62*4d7e907cSAndroid Build Coastguard Worker      - `config` — the XSD schema for the Audio Effects configuration file.
63*4d7e907cSAndroid Build Coastguard Worker   - `4.0`
64*4d7e907cSAndroid Build Coastguard Worker   - ...
65*4d7e907cSAndroid Build Coastguard Worker   - `all-versions`
66*4d7e907cSAndroid Build Coastguard Worker       - `default` — code that wraps the legacy API (from
67*4d7e907cSAndroid Build Coastguard Worker         `hardware/libhardware`).
68*4d7e907cSAndroid Build Coastguard Worker         - `util` — utilities for the default implementation.
69*4d7e907cSAndroid Build Coastguard Worker       - `vts` VTS tests for the effect HIDL API.
70*4d7e907cSAndroid Build Coastguard Worker* `policy` — Configurable Audio Policy schemes.
71*4d7e907cSAndroid Build Coastguard Worker   - `1.0` — note that versions of CAP are not linked to the versions
72*4d7e907cSAndroid Build Coastguard Worker     of audio HAL.
73*4d7e907cSAndroid Build Coastguard Worker      - `vts` — VTS tests for validating actual configuration files.
74*4d7e907cSAndroid Build Coastguard Worker      - `xml` — XSD schemas for CAP configuration files.
75