This header contains IPC specific structures and code not related to
BT and audio HAL protocols. This allows to fully decouple IPC from
HAL messages.
This is first step to make HAL part of IPC unit-testable and reusable
between BT HAL and audio HAL.
This removes compatibility with Android 4.3 and older. Android 4.4 is
current target. Due to bug in Audio HAL in 4.2 build was failing on
that version anyway.
This allows to correctly handle remote version info property. Although
this property is marked as get/set in HAL only get is implemented as
I fail to see how this property could be settable.
We should be sending BT_STATUS_DONE when calling init on already
initialized interface like Bluedroid does. This indicates that previosly
registered callbacks are still registered, not those passed with second
init call.
If property to be set is of enum type it should be first converted to
byte value as size of enum might varry depending on architecture.
To keep code simple command buffer uses len received from framework
as this is more or equal to HAL property size.
There is no need to use dynamic allocation for enum properties
convertion. Each property type can be present only once in properties
callback so using static allocation is safe. This also remove need
for cleanup properties after HAL callback is called making code
simpler.
Register handlers on service init. Since this requires all handlers to
be registered (unknown opcode is considered IPC error) missing handlers
stubs are provided.
Some HAL defined types that are passed as type-len-value in properties
callback needs to be repacked at runtime to match defined types.
This is due to HAL using data types without strict refined sizes like
enums or unpacked structures. This is needed only if data is passed as
TLV. With data passed to callbacks as parameters compiler will handle
types convertion.
Currently only enum types are supported.
Notification thread is started on IPC init and it can be scheduled
before main thread.
Fix following crash on HAL init:
pid: 3392, tid: 3492, name: droid.bluetooth >>> com.android.bluetooth <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000028
eax 00000000 ebx ce047f64 ecx ce0405d0 edx f7763724
esi cdf3af00 edi f837fb90
xcs 00000023 xds 0000002b xes 0000002b xfs 00000000 xss 0000002b
eip ce042289 ebp cdf3a9f8 esp cdf3a9e0 flags 00010292
backtrace:
#00 pc 00003289 /system/lib/hw/bluetooth.default.so (bt_thread_associate+25)
#01 pc 000015f8 /system/lib/hw/bluetooth.default.so (notification_handler+40)
#02 pc 0000f804 /system/lib/libc.so (__thread_entry+276)
#03 pc 0002999d /system/lib/libc.so
#04 pc 00082ae7 /system/lib/libdvm.so (dvmThreadSelf()+39)
#05 pc 00010db9 /system/lib/libc.so (pthread_mutex_unlock+25)