and fakes implemented in: test/android/java/src/org/chromium/device/bluetooth/Fakes.java
.
Thus:
bluetooth_adapter_android.h
owns:android/.../ChromeBluetoothAdapter.java
uses:android/.../wrapper/BluetoothAdapterWrapper.java
FakeBluetoothAdapter
bluetooth_device_android.h
owns:android/.../ChromeBluetoothDevice.java
uses:android/.../wrapper/BluetoothDeviceWrapper.java
FakeBluetoothDevice
bluetooth_gatt_service_android.h
owns:android/.../ChromeBluetoothRemoteGattService.java
uses:android/.../wrapper/BluetoothGattServiceWrapper.java
FakeBluetoothGattService
Fake objects are controlled by bluetooth_test_android.cc
.
See also: Class Diagram of Web Bluetooth through Bluetooth Android
Within this directory, BluetoothAdapter exposes Bluetooth stack agnostic APIs for performing various operations and this is implemented by various platform specific classes. For ChromeOS, BluetoothAdapter is implemented by BluetoothAdapterFloss and [BluetoothAdapterBluez] (https://source.chromium.org/chromium/chromium/src/+/main:device/bluetooth/bluez/bluetooth_adapter_bluez.h;drc=d8468bb60e224d8797b843ee9d0258862bcbe87f).
In addition to above classes, we have BluetoothConnectionLogger and BluetoothUtils classes for recording metrics on Bluetooth operations. BluetoothUtils is also used for ChromeOS-specific functionality such as filtering out Bluetooth devices of certain classes (ex: Phones) from the UI.
Bluez and Fluoride are bluetooth stacks used in ChromeOS and Android respectively. Given the relatively small market segment for ChromeOS when compared to Android, device manufacturers do not always go through interoperability testing and validation on devices running ChromeOS.
To ease this, a project has been undertaken to make the Android Bluetooth stack multiplatform and migrate ChromeOS from Bluez to Fluoride. This project is titled Floss and is currently underway.
Various Bluetooth UI surfaces in ChromeOS perform their operations by using APIs defined in [CrosBluetoothConfig] (https://source.chromium.org/chromium/chromium/src/+/main:chromeos/ash/services/bluetooth_config/cros_bluetooth_config.h;drc=d8468bb60e224d8797b843ee9d0258862bcbe87f)
CrosBluetoothConfig in turn utilizes classes in this directory to interact with the Bluetooth stack. It is usually preferrerd to use CrosBluetoothConfig API for performing Bluetooth related operations and direct interaction with adapters in this directory should only be necessary if more granular functionality is required.
See test/README.md