In Android, the structure of the Bluetooth system is as follows:
In this architecture, the bottom-up sequence is the module driver, the Bluetooth protocol stack, the bluetooth.apk, the framework, and various Bluetooth applications. Among them, the kernel of the driver is directly and hardware to deal with, generally by the module manufacturer. Android layer, the bottom is the processing of specific Bluetooth protocol stack, which contains a variety of Bluetooth profile specific implementation, BLUETOOTH.APK is the link between the Bluetooth protocol stack and the framework, using the JNI interface to communicate the framework and C implementation protocol stacks implemented in Java, and to implement state machines to control various work states of various profiles. Framwork provides a variety of interfaces for applications. Such a functional division is not necessarily accurate, but I personally understand a little.
The premise is that the module hardware to support the A2DP Sink, so before the transplant needs to communicate with the manufacturer to see the hardware support does not support the function of Sink.
Bluetooth protocol stack is the most complex part of the whole system, is the specific implementation of various profile protocol processing place, relatively speaking, Java implementation of the bluetooth.apk and the framework are simpler. So in the process of porting, the protocol stack is copied intact from 5.0, and then some modifications in the bluetooth.apk and framework are made to match the protocol stack. This is the general idea of the transplant.
Implementing Bluetooth A2DP Sink (ii) in Android4.2--porting Android5.0 Bluetooth protocol stack