README.md
1This directory contains code that accesses Android (hw)binder interfaces and is
2dynamically loaded and used by traced_probes / perfetto command line client.
3The code in this directory is built as a separate .so library and can depend on
4on Android internals.
5
6Block diagram:
7
8```
9+---------------+ +---------------------------------+
10| traced_probes |- - -> | libperfetto_android_internal.so |
11+---------------+ ^ +---------------+-----------------+
12 | |
13 | | [ Non-NDK libraries ]
14 | +-> libbase.so
15 | +-> libutils.so
16 | +-> libhidltransport.so
17 | +-> libhwbinder.so
18 | +-> android.hardware.xxx@2.0
19 |
20 + dynamically loaded on first use via dlopen()
21```
22
23The major reason for using a separate .so() and introducing the shared library
24layer is avoiding the cost of linker relocations (~150 KB private dirty)
25required for loading the graph of binder-related libraries.
26
27The general structure and rules for code in this directory is as-follows:
28- Targets herein defined must be leaf targets. Dependencies to perfetto targets
29 (e.g. base) are not allowed, as doing that would create ODR violations.
30- Headers (e.g. health_hal.h) must have a plain old C interface (to avoid
31 dealing with name mangling) and should not expose neither android internal
32 structure/types nor struct/types defined in perfetto headers outside of this
33 directory.
34- Dependencies to Android internal headers are allowed only in .cc files, not
35 in headers.
36