├── .clang-format ├── .gitignore ├── .style.yapf ├── Android.bp ├── AndroidTestTemplate.xml ├── BUILD.gn ├── Cargo.toml ├── CleanSpec.mk ├── EventLogTags.logtags ├── METADATA ├── MODULE_LICENSE_APACHE2 ├── NOTICE ├── OWNERS ├── PREUPLOAD.cfg ├── README.md ├── TEST_MAPPING ├── apex ├── Android.bp ├── apex_manifest.json ├── com.android.bluetooth.updatable.avbpubkey ├── com.android.bluetooth.updatable.pem ├── com.android.bluetooth.updatable.pk8 ├── com.android.bluetooth.updatable.x509.pem └── key.pem ├── audio_a2dp_hw ├── Android.bp ├── include │ └── audio_a2dp_hw.h ├── src │ ├── audio_a2dp_hw.cc │ └── audio_a2dp_hw_utils.cc └── test │ └── audio_a2dp_hw_test.cc ├── audio_bluetooth_hw ├── Android.bp ├── audio_bluetooth_hw.cc ├── device_port_proxy.cc ├── device_port_proxy.h ├── stream_apis.cc ├── stream_apis.h ├── utils.cc ├── utils.h └── utils_unittest.cc ├── audio_hal_interface ├── Android.bp ├── BUILD.gn ├── a2dp_encoding.cc ├── a2dp_encoding.h ├── a2dp_encoding_host.cc ├── client_interface.cc ├── client_interface.h ├── client_interface_unittest.cc ├── codec_status.cc ├── codec_status.h ├── hal_version_manager.h ├── hearing_aid_software_encoding.cc ├── hearing_aid_software_encoding.h ├── hearing_aid_software_encoding_host.cc ├── le_audio_software.cc └── le_audio_software.h ├── audio_hearing_aid_hw ├── Android.bp ├── include │ └── audio_hearing_aid_hw.h ├── src │ ├── audio_hearing_aid_hw.cc │ └── audio_hearing_aid_hw_utils.cc └── test │ └── audio_hearing_aid_hw_test.cc ├── binder ├── Android.bp └── android │ ├── bluetooth │ ├── BluetoothActivityEnergyInfo.aidl │ ├── BluetoothAudioConfig.aidl │ ├── BluetoothAvrcpPlayerSettings.aidl │ ├── BluetoothClass.aidl │ ├── BluetoothCodecConfig.aidl │ ├── BluetoothCodecStatus.aidl │ ├── BluetoothDevice.aidl │ ├── BluetoothGattCharacteristic.aidl │ ├── BluetoothGattDescriptor.aidl │ ├── BluetoothGattIncludedService.aidl │ ├── BluetoothGattService.aidl │ ├── BluetoothHeadsetClientCall.aidl │ ├── BluetoothHidDeviceAppQosSettings.aidl │ ├── BluetoothHidDeviceAppSdpSettings.aidl │ ├── BufferConstraints.aidl │ ├── DeviceGroup.aidl │ ├── IBluetooth.aidl │ ├── IBluetoothA2dp.aidl │ ├── IBluetoothA2dpSink.aidl │ ├── IBluetoothAvrcpController.aidl │ ├── IBluetoothAvrcpTarget.aidl │ ├── IBluetoothCallback.aidl │ ├── IBluetoothConnectionCallback.aidl │ ├── IBluetoothDeviceGroup.aidl │ ├── IBluetoothGatt.aidl │ ├── IBluetoothGattCallback.aidl │ ├── IBluetoothGattServerCallback.aidl │ ├── IBluetoothGroupCallback.aidl │ ├── IBluetoothHeadset.aidl │ ├── IBluetoothHeadsetClient.aidl │ ├── IBluetoothHearingAid.aidl │ ├── IBluetoothHidDevice.aidl │ ├── IBluetoothHidDeviceCallback.aidl │ ├── IBluetoothHidHost.aidl │ ├── IBluetoothLeAudio.aidl │ ├── IBluetoothManager.aidl │ ├── IBluetoothManagerCallback.aidl │ ├── IBluetoothMap.aidl │ ├── IBluetoothMapClient.aidl │ ├── IBluetoothMetadataListener.aidl │ ├── IBluetoothOobDataCallback.aidl │ ├── IBluetoothPan.aidl │ ├── IBluetoothPbap.aidl │ ├── IBluetoothPbapClient.aidl │ ├── IBluetoothProfileServiceConnection.aidl │ ├── IBluetoothSap.aidl │ ├── IBluetoothSocketManager.aidl │ ├── IBluetoothStateChangeCallback.aidl │ ├── IBluetoothVcp.aidl │ ├── IBluetoothVolumeControl.aidl │ ├── OobData.aidl │ ├── bluetooth_device.cc │ ├── bluetooth_device.h │ └── le │ │ ├── AdvertiseData.aidl │ │ ├── AdvertiseSettings.aidl │ │ ├── AdvertisingSetParameters.aidl │ │ ├── IAdvertisingSetCallback.aidl │ │ ├── IPeriodicAdvertisingCallback.aidl │ │ ├── IScannerCallback.aidl │ │ ├── PeriodicAdvertisingParameters.aidl │ │ ├── PeriodicAdvertisingReport.aidl │ │ ├── ResultStorageDescriptor.aidl │ │ ├── ScanFilter.aidl │ │ ├── ScanResult.aidl │ │ └── ScanSettings.aidl │ └── os │ ├── parcel_uuid.cc │ └── parcel_uuid.h ├── bta ├── Android.bp ├── BUILD.gn ├── ag │ ├── bta_ag_act.cc │ ├── bta_ag_api.cc │ ├── bta_ag_at.cc │ ├── bta_ag_at.h │ ├── bta_ag_cfg.cc │ ├── bta_ag_cmd.cc │ ├── bta_ag_int.h │ ├── bta_ag_main.cc │ ├── bta_ag_rfc.cc │ ├── bta_ag_sco.cc │ └── bta_ag_sdp.cc ├── ar │ ├── bta_ar.cc │ └── bta_ar_int.h ├── av │ ├── bta_av_aact.cc │ ├── bta_av_act.cc │ ├── bta_av_api.cc │ ├── bta_av_cfg.cc │ ├── bta_av_ci.cc │ ├── bta_av_int.h │ ├── bta_av_main.cc │ └── bta_av_ssm.cc ├── dm │ ├── bta_dm_act.cc │ ├── bta_dm_api.cc │ ├── bta_dm_cfg.cc │ ├── bta_dm_ci.cc │ ├── bta_dm_int.h │ ├── bta_dm_main.cc │ └── bta_dm_pm.cc ├── gatt │ ├── bta_gattc_act.cc │ ├── bta_gattc_api.cc │ ├── bta_gattc_cache.cc │ ├── bta_gattc_int.h │ ├── bta_gattc_main.cc │ ├── bta_gattc_queue.cc │ ├── bta_gattc_utils.cc │ ├── bta_gatts_act.cc │ ├── bta_gatts_api.cc │ ├── bta_gatts_int.h │ ├── bta_gatts_main.cc │ ├── bta_gatts_utils.cc │ ├── database.cc │ ├── database.h │ ├── database_builder.cc │ └── database_builder.h ├── hd │ ├── bta_hd_act.cc │ ├── bta_hd_api.cc │ ├── bta_hd_int.h │ └── bta_hd_main.cc ├── hearing_aid │ ├── hearing_aid.cc │ └── hearing_aid_audio_source.cc ├── hf_client │ ├── bta_hf_client_act.cc │ ├── bta_hf_client_api.cc │ ├── bta_hf_client_at.cc │ ├── bta_hf_client_at.h │ ├── bta_hf_client_int.h │ ├── bta_hf_client_main.cc │ ├── bta_hf_client_rfc.cc │ ├── bta_hf_client_sco.cc │ └── bta_hf_client_sdp.cc ├── hh │ ├── bta_hh_act.cc │ ├── bta_hh_api.cc │ ├── bta_hh_cfg.cc │ ├── bta_hh_int.h │ ├── bta_hh_le.cc │ ├── bta_hh_main.cc │ └── bta_hh_utils.cc ├── include │ ├── bta_ag_api.h │ ├── bta_api.h │ ├── bta_ar_api.h │ ├── bta_av_api.h │ ├── bta_av_ci.h │ ├── bta_av_co.h │ ├── bta_dm_acl.h │ ├── bta_dm_api.h │ ├── bta_dm_ci.h │ ├── bta_dm_co.h │ ├── bta_gatt_api.h │ ├── bta_gatt_queue.h │ ├── bta_gatts_co.h │ ├── bta_hd_api.h │ ├── bta_hearing_aid_api.h │ ├── bta_hf_client_api.h │ ├── bta_hfp_api.h │ ├── bta_hh_api.h │ ├── bta_hh_co.h │ ├── bta_jv_api.h │ ├── bta_jv_co.h │ ├── bta_op_api.h │ ├── bta_pan_api.h │ ├── bta_pan_ci.h │ ├── bta_pan_co.h │ ├── bta_sdp_api.h │ ├── bta_vc_api.h │ └── utl.h ├── jv │ ├── bta_jv_act.cc │ ├── bta_jv_api.cc │ ├── bta_jv_cfg.cc │ └── bta_jv_int.h ├── pan │ ├── bta_pan_act.cc │ ├── bta_pan_api.cc │ ├── bta_pan_ci.cc │ ├── bta_pan_int.h │ └── bta_pan_main.cc ├── pb │ └── bta_pbs_int.h ├── sdp │ ├── bta_sdp.cc │ ├── bta_sdp_act.cc │ ├── bta_sdp_api.cc │ ├── bta_sdp_cfg.cc │ └── bta_sdp_int.h ├── sys │ ├── bta_sys.h │ ├── bta_sys_conn.cc │ ├── bta_sys_int.h │ ├── bta_sys_main.cc │ └── utl.cc ├── test │ ├── bta_dip_test.cc │ ├── bta_dm_cust_uuid_test.cc │ ├── bta_dm_test.cc │ ├── bta_gatt_test.cc │ ├── bta_hf_client_add_record_test.cc │ ├── bta_hf_client_test.cc │ ├── common │ │ ├── bta_gatt_api_mock.cc │ │ ├── bta_gatt_api_mock.h │ │ ├── bta_gatt_queue_mock.cc │ │ ├── bta_gatt_queue_mock.h │ │ ├── btm_api_mock.cc │ │ ├── btm_api_mock.h │ │ └── fake_osi.h │ └── gatt │ │ ├── database_builder_sample_device_test.cc │ │ ├── database_builder_test.cc │ │ └── database_test.cc └── vc │ ├── device.cc │ ├── devices.h │ ├── devices_test.cc │ ├── types.h │ ├── vc.cc │ └── vc_test.cc ├── btcore ├── Android.bp ├── BUILD.gn ├── include │ ├── device_class.h │ ├── device_features.h │ ├── event_mask.h │ ├── hal_util.h │ ├── iac.h │ ├── module.h │ ├── osi_module.h │ ├── property.h │ └── version.h ├── src │ ├── device_class.cc │ ├── hal_util.cc │ ├── module.cc │ ├── osi_module.cc │ └── property.cc └── test │ ├── device_class_test.cc │ └── property_test.cc ├── btif ├── Android.bp ├── BUILD.gn ├── avrcp │ ├── avrcp_service.cc │ └── avrcp_service.h ├── co │ ├── bta_av_co.cc │ ├── bta_dm_co.cc │ ├── bta_gatts_co.cc │ ├── bta_hh_co.cc │ └── bta_pan_co.cc ├── include │ ├── btif_a2dp.h │ ├── btif_a2dp_audio_interface.h │ ├── btif_a2dp_control.h │ ├── btif_a2dp_sink.h │ ├── btif_a2dp_source.h │ ├── btif_acl.h │ ├── btif_activity_attribution.h │ ├── btif_api.h │ ├── btif_av.h │ ├── btif_av_co.h │ ├── btif_avrcp_audio_track.h │ ├── btif_bqr.h │ ├── btif_common.h │ ├── btif_config.h │ ├── btif_config_cache.h │ ├── btif_config_transcode.h │ ├── btif_debug.h │ ├── btif_debug_btsnoop.h │ ├── btif_debug_conn.h │ ├── btif_dm.h │ ├── btif_gatt.h │ ├── btif_gatt_util.h │ ├── btif_hd.h │ ├── btif_hf.h │ ├── btif_hh.h │ ├── btif_keystore.h │ ├── btif_metrics_logging.h │ ├── btif_pan.h │ ├── btif_pan_internal.h │ ├── btif_profile_queue.h │ ├── btif_rc.h │ ├── btif_sdp.h │ ├── btif_sock.h │ ├── btif_sock_l2cap.h │ ├── btif_sock_rfc.h │ ├── btif_sock_sco.h │ ├── btif_sock_sdp.h │ ├── btif_sock_thread.h │ ├── btif_sock_util.h │ ├── btif_storage.h │ ├── btif_uid.h │ ├── btif_util.h │ └── stack_manager.h ├── src │ ├── bluetooth.cc │ ├── btif_a2dp.cc │ ├── btif_a2dp_audio_interface.cc │ ├── btif_a2dp_audio_interface_linux.cc │ ├── btif_a2dp_control.cc │ ├── btif_a2dp_sink.cc │ ├── btif_a2dp_source.cc │ ├── btif_activity_attribution.cc │ ├── btif_av.cc │ ├── btif_avrcp_audio_track.cc │ ├── btif_avrcp_audio_track_linux.cc │ ├── btif_ble_advertiser.cc │ ├── btif_ble_scanner.cc │ ├── btif_bqr.cc │ ├── btif_config.cc │ ├── btif_config_cache.cc │ ├── btif_config_transcode.cc │ ├── btif_core.cc │ ├── btif_debug.cc │ ├── btif_debug_btsnoop.cc │ ├── btif_debug_conn.cc │ ├── btif_dm.cc │ ├── btif_gatt.cc │ ├── btif_gatt_client.cc │ ├── btif_gatt_server.cc │ ├── btif_gatt_test.cc │ ├── btif_gatt_util.cc │ ├── btif_hd.cc │ ├── btif_hearing_aid.cc │ ├── btif_hf.cc │ ├── btif_hf_client.cc │ ├── btif_hh.cc │ ├── btif_keystore.cc │ ├── btif_le_audio.cc │ ├── btif_metrics_logging.cc │ ├── btif_pan.cc │ ├── btif_profile_queue.cc │ ├── btif_rc.cc │ ├── btif_sdp.cc │ ├── btif_sdp_server.cc │ ├── btif_sock.cc │ ├── btif_sock_l2cap.cc │ ├── btif_sock_rfc.cc │ ├── btif_sock_sco.cc │ ├── btif_sock_sdp.cc │ ├── btif_sock_thread.cc │ ├── btif_sock_util.cc │ ├── btif_storage.cc │ ├── btif_uid.cc │ ├── btif_util.cc │ ├── btif_vc.cc │ └── stack_manager.cc └── test │ ├── btif_config_cache_test.cc │ ├── btif_hf_client_service_test.cc │ ├── btif_keystore_test.cc │ ├── btif_profile_queue_test.cc │ ├── btif_rc_test.cc │ ├── btif_stack_test.cc │ └── btif_storage_test.cc ├── build.py ├── build ├── Android.bp ├── BUILD.gn ├── config │ └── BUILDCONFIG.gn ├── dpkg │ ├── README.txt │ ├── libchrome-822064 │ │ ├── debian │ │ │ ├── README.Debian │ │ │ ├── changelog │ │ │ ├── compat │ │ │ ├── control │ │ │ ├── install_headers.sh │ │ │ ├── libchrome.install │ │ │ ├── patches │ │ │ │ ├── 0001-Add-missing-includes.patch │ │ │ │ ├── 0001-Remove-absl-from-pkgconfig.patch │ │ │ │ ├── 0001-rebase_path-for-write_args.patch │ │ │ │ └── series │ │ │ └── rules │ │ └── gen-src-pkg.sh │ ├── libchrome │ │ ├── debian │ │ │ ├── README.Debian │ │ │ ├── changelog │ │ │ ├── compat │ │ │ ├── control │ │ │ ├── install_headers.sh │ │ │ ├── libchrome.install │ │ │ ├── patches │ │ │ │ ├── 0001-Add-missing-includes.patch │ │ │ │ ├── 0001-common-mk-rebase_path-output-location-of-generate-pc.patch │ │ │ │ ├── 0001-rebase_path-for-write_args.patch │ │ │ │ └── series │ │ │ └── rules │ │ └── gen-src-pkg.sh │ └── modp_b64 │ │ ├── debian │ │ ├── README.Debian │ │ ├── changelog │ │ ├── compat │ │ ├── control │ │ ├── modp-b64.install │ │ ├── patches │ │ │ ├── 0001-common-mk-rebase_path-output-location-of-generate-pc.patch │ │ │ └── series │ │ └── rules │ │ └── gen-src-pkg.sh ├── fluoride.go ├── install_deps.sh ├── secondary │ └── third_party │ │ ├── aac │ │ └── BUILD.gn │ │ ├── googletest │ │ └── BUILD.gn │ │ ├── libchrome │ │ └── BUILD.gn │ │ ├── libldac │ │ └── BUILD.gn │ │ └── tinyxml2 │ │ └── BUILD.gn └── toolchain │ ├── clang │ ├── BUILD.gn │ └── get_clang_suffix.py │ └── gcc │ └── BUILD.gn ├── common ├── Android.bp ├── BUILD.gn ├── address_obfuscator.cc ├── address_obfuscator.h ├── address_obfuscator_unittest.cc ├── benchmark │ ├── thread_performance_benchmark.cc │ └── timer_performance_benchmark.cc ├── id_generator.h ├── id_generator_unittest.cc ├── leaky_bonded_queue.h ├── leaky_bonded_queue_unittest.cc ├── lru.h ├── lru_unittest.cc ├── message_loop_thread.cc ├── message_loop_thread.h ├── message_loop_thread_unittest.cc ├── metric_id_allocator.cc ├── metric_id_allocator.h ├── metric_id_allocator_unittest.cc ├── metrics.cc ├── metrics.h ├── metrics_linux.cc ├── metrics_unittest.cc ├── once_timer.cc ├── once_timer.h ├── once_timer_unittest.cc ├── os_utils.cc ├── os_utils.h ├── repeating_timer.cc ├── repeating_timer.h ├── repeating_timer_unittest.cc ├── state_machine.h ├── state_machine_unittest.cc ├── stop_watch_legacy.cc ├── stop_watch_legacy.h ├── test │ └── thread_performance_test.cc ├── time_util.cc ├── time_util.h ├── time_util_unittest.cc └── utils.h ├── conf ├── Android.bp ├── bt_did.conf └── bt_stack.conf ├── device ├── Android.bp ├── BUILD.gn ├── include │ ├── controller.h │ ├── esco_parameters.h │ ├── interop.h │ └── interop_database.h ├── src │ ├── controller.cc │ ├── esco_parameters.cc │ └── interop.cc └── test │ └── interop_test.cc ├── doc ├── btsnoop_net.md ├── directory_layout.md ├── log_tags.md ├── network_ports.md ├── power_management.md ├── properties.md ├── pts_guide.md ├── style_guide.md └── supported_features.md ├── embdrv ├── g722 │ ├── Android.bp │ ├── BUILD.gn │ ├── fuzzer │ │ ├── Android.bp │ │ └── g722_enc_fuzzer.cc │ ├── g722_decode.cc │ ├── g722_enc_dec.h │ ├── g722_encode.cc │ └── g722_typedefs.h └── sbc │ ├── Android.bp │ ├── BUILD.gn │ ├── decoder │ ├── Android.bp │ ├── include │ │ ├── oi_assert.h │ │ ├── oi_bitstream.h │ │ ├── oi_bt_spec.h │ │ ├── oi_codec_sbc.h │ │ ├── oi_codec_sbc_private.h │ │ ├── oi_common.h │ │ ├── oi_cpu_dep.h │ │ ├── oi_modules.h │ │ ├── oi_osinterface.h │ │ ├── oi_status.h │ │ ├── oi_stddefs.h │ │ ├── oi_string.h │ │ ├── oi_time.h │ │ └── oi_utils.h │ ├── sbcdecoder_fuzzer.c │ └── srce │ │ ├── alloc.c │ │ ├── bitalloc-sbc.c │ │ ├── bitalloc.c │ │ ├── bitstream-decode.c │ │ ├── decoder-oina.c │ │ ├── decoder-private.c │ │ ├── decoder-sbc.c │ │ ├── dequant.c │ │ ├── framing-sbc.c │ │ ├── framing.c │ │ ├── oi_codec_version.c │ │ ├── readsamplesjoint.inc │ │ ├── synthesis-8-generated.c │ │ ├── synthesis-dct8.c │ │ └── synthesis-sbc.c │ └── encoder │ ├── Android.bp │ ├── include │ ├── sbc_dct.h │ ├── sbc_enc_func_declare.h │ ├── sbc_encoder.h │ ├── sbc_if.h │ └── sbc_types.h │ └── srce │ ├── sbc_analysis.c │ ├── sbc_dct.c │ ├── sbc_dct_coeffs.c │ ├── sbc_enc_bit_alloc_mono.c │ ├── sbc_enc_bit_alloc_ste.c │ ├── sbc_enc_coeffs.c │ ├── sbc_encoder.c │ └── sbc_packing.c ├── gd ├── .clang-format ├── .gitignore ├── Android.bp ├── Android.mk ├── AndroidTestTemplate.xml ├── BUILD.gn ├── README.md ├── att │ ├── Android.bp │ ├── BUILD.gn │ ├── att_module.cc │ └── att_module.h ├── benchmark.cc ├── btaa │ ├── Android.bp │ ├── BUILD.gn │ ├── activity_attribution.fbs │ ├── activity_attribution.h │ ├── android │ │ └── activity_attribution.cc │ ├── attribution_processor.h │ ├── cmd_evt_classification.h │ ├── hci_processor.h │ ├── host │ │ └── activity_attribution.cc │ ├── linux │ │ └── activity_attribution.cc │ ├── linux_generic │ │ ├── attribution_processor.cc │ │ ├── attribution_processor_tests.cc │ │ ├── cmd_evt_classification.cc │ │ ├── hci_processor.cc │ │ └── wakelock_processor.cc │ └── wakelock_processor.h ├── cert │ ├── all_cert_testcases │ ├── async_subprocess_logger.py │ ├── behavior.py │ ├── ble_lib.py │ ├── bluetooth_packets_python3_setup.py │ ├── bt_constants.py │ ├── capture.py │ ├── captures.py │ ├── cert_self_test.py │ ├── cert_self_test_lib.py │ ├── change_waiter.py │ ├── closable.py │ ├── devices_config.json │ ├── event_stream.py │ ├── gd_base_test.py │ ├── gd_base_test_lib.py │ ├── gd_device.py │ ├── gd_sl4a_base_test.py │ ├── gd_sl4a_device_config.json │ ├── gen_html_coverage.sh │ ├── host_config.json │ ├── irun │ ├── logging_client_interceptor.py │ ├── matchers.py │ ├── metadata.py │ ├── os_utils.py │ ├── performance_test_logger.py │ ├── pts.json │ ├── pts_base_test.py │ ├── pts_l2cap_testcase │ ├── py_acl_manager.py │ ├── py_hal.py │ ├── py_hci.py │ ├── py_l2cap.py │ ├── py_le_acl_manager.py │ ├── py_le_iso.py │ ├── py_le_security.py │ ├── py_security.py │ ├── run │ ├── run_pts_l2cap.sh │ ├── rust_android_devices_config.json │ ├── rust_host_config.json │ ├── set_up_and_run_device_cert.sh │ ├── set_up_virtualenv.sh │ └── truth.py ├── common │ ├── Android.bp │ ├── BUILD.gn │ ├── bidi_queue.h │ ├── bidi_queue_unittest.cc │ ├── bind.h │ ├── blocking_queue.h │ ├── blocking_queue_unittest.cc │ ├── byte_array.h │ ├── byte_array_test.cc │ ├── callback.h │ ├── callback_list.h │ ├── circular_buffer.h │ ├── circular_buffer_test.cc │ ├── contextual_callback.h │ ├── init_flags.cc │ ├── init_flags.fbs │ ├── init_flags.h │ ├── init_flags_test.cc │ ├── list_map.h │ ├── list_map_test.cc │ ├── lru_cache.h │ ├── lru_cache_test.cc │ ├── metric_id_manager.cc │ ├── metric_id_manager.h │ ├── metric_id_manager_unittest.cc │ ├── multi_priority_queue.h │ ├── multi_priority_queue_test.cc │ ├── numbers.h │ ├── numbers_test.cc │ ├── observer_registry.h │ ├── observer_registry_test.cc │ ├── stop_watch.cc │ ├── stop_watch.h │ ├── strings.cc │ ├── strings.h │ ├── strings_test.cc │ ├── testing │ │ ├── bind_test_util.h │ │ └── wired_pair_of_bidi_queues.h │ └── type_helper.h ├── crypto_toolbox │ ├── Android.bp │ ├── BUILD.gn │ ├── aes.cc │ ├── aes.h │ ├── aes_cmac.cc │ ├── crypto_toolbox.cc │ ├── crypto_toolbox.h │ └── crypto_toolbox_test.cc ├── docs │ ├── architecture │ │ ├── architecture.md │ │ ├── data_flow_diagram.png │ │ └── style_guide.md │ └── testing │ │ ├── cert_test.md │ │ ├── cert_test_architecture_drawing.png │ │ └── gtest.md ├── dumpsys │ ├── Android.bp │ ├── BUILD.gn │ ├── bluetooth_flatbuffer_test.cc │ ├── bluetooth_flatbuffer_test.fbs │ ├── bundler │ │ ├── Android.bp │ │ ├── BUILD.gn │ │ ├── bundler.cc │ │ ├── bundler.fbs │ │ ├── bundler.gni │ │ ├── bundler.h │ │ ├── extract_files_and_call.py │ │ ├── main.cc │ │ ├── test.bfbs │ │ └── test.cc │ ├── filter.cc │ ├── filter.h │ ├── filter_test.cc │ ├── init_flags.cc │ ├── init_flags.h │ ├── internal │ │ ├── filter_internal.cc │ │ ├── filter_internal.h │ │ ├── filter_internal_test.cc │ │ └── test_data │ │ │ ├── float.bfbs │ │ │ ├── float.fbs │ │ │ ├── float_bfbs.h │ │ │ ├── float_generated.h │ │ │ ├── integer.bfbs │ │ │ ├── integer.fbs │ │ │ ├── integer_bfbs.h │ │ │ ├── integer_generated.h │ │ │ ├── mkfiles │ │ │ ├── root.h │ │ │ ├── string.bfbs │ │ │ ├── string.fbs │ │ │ ├── string_bfbs.h │ │ │ ├── string_generated.h │ │ │ ├── struct.bfbs │ │ │ ├── struct.fbs │ │ │ ├── struct_bfbs.h │ │ │ └── struct_generated.h │ ├── reflection_schema.cc │ ├── reflection_schema.h │ ├── reflection_schema_test.cc │ └── test_data │ │ ├── bar.fbs │ │ ├── bar.h │ │ ├── baz.fbs │ │ ├── baz.h │ │ ├── foo.fbs │ │ ├── foo.h │ │ ├── qux.fbs │ │ ├── qux.h │ │ ├── root.fbs │ │ └── root.h ├── dumpsys_data.fbs ├── facade │ ├── common.proto │ ├── facade_main.cc │ ├── grpc_root_server.cc │ ├── grpc_root_server.h │ ├── read_only_property_server.cc │ ├── read_only_property_server.h │ └── rootservice.proto ├── fuzz │ ├── Android.bp │ ├── helpers.cc │ ├── helpers.h │ └── run ├── fuzz_test.cc ├── grpc │ ├── grpc_event_queue.h │ ├── grpc_module.cc │ └── grpc_module.h ├── hal │ ├── Android.bp │ ├── BUILD.gn │ ├── cert │ │ └── simple_hal_test.py │ ├── facade.cc │ ├── facade.h │ ├── fuzz │ │ ├── fuzz_hci_hal.cc │ │ └── fuzz_hci_hal.h │ ├── hal_facade.proto │ ├── hci_hal.h │ ├── hci_hal_android_hidl.cc │ ├── hci_hal_android_hidl_test.cc │ ├── hci_hal_host.cc │ ├── hci_hal_host.h │ ├── hci_hal_host_test.cc │ ├── serialize_packet.h │ ├── snoop_logger.cc │ ├── snoop_logger.h │ └── snoop_logger_test.cc ├── hci │ ├── Android.bp │ ├── BUILD.gn │ ├── acl_builder_test.cc │ ├── acl_connection_interface.h │ ├── acl_manager.cc │ ├── acl_manager.h │ ├── acl_manager │ │ ├── acl_connection.cc │ │ ├── acl_connection.h │ │ ├── acl_fragmenter.cc │ │ ├── acl_fragmenter.h │ │ ├── assembler.h │ │ ├── classic_acl_connection.cc │ │ ├── classic_acl_connection.h │ │ ├── classic_impl.h │ │ ├── connection_callbacks.h │ │ ├── connection_management_callbacks.h │ │ ├── event_checkers.h │ │ ├── le_acl_connection.cc │ │ ├── le_acl_connection.h │ │ ├── le_connection_callbacks.h │ │ ├── le_connection_management_callbacks.h │ │ ├── le_impl.h │ │ ├── round_robin_scheduler.cc │ │ ├── round_robin_scheduler.h │ │ └── round_robin_scheduler_test.cc │ ├── acl_manager_mock.h │ ├── acl_manager_test.cc │ ├── address.cc │ ├── address.h │ ├── address_pybind11_type_caster.h │ ├── address_unittest.cc │ ├── address_with_type.h │ ├── address_with_type_test.cc │ ├── cert │ │ ├── acl_manager_test.py │ │ ├── controller_test.py │ │ ├── direct_hci_test.py │ │ ├── le_acl_manager_test.py │ │ ├── le_advanced_scanning_test.py │ │ ├── le_advertising_manager_test.py │ │ ├── le_scanning_manager_test.py │ │ └── le_scanning_with_security_test.py │ ├── class_of_device.cc │ ├── class_of_device.h │ ├── class_of_device_pybind11_type_caster.h │ ├── class_of_device_unittest.cc │ ├── command_interface.h │ ├── controller.cc │ ├── controller.h │ ├── controller_mock.h │ ├── controller_test.cc │ ├── enum_helper.h │ ├── facade │ │ ├── acl_manager_facade.cc │ │ ├── acl_manager_facade.h │ │ ├── acl_manager_facade.proto │ │ ├── controller_facade.cc │ │ ├── controller_facade.h │ │ ├── controller_facade.proto │ │ ├── facade.cc │ │ ├── facade.h │ │ ├── hci_facade.proto │ │ ├── le_acl_manager_facade.cc │ │ ├── le_acl_manager_facade.h │ │ ├── le_acl_manager_facade.proto │ │ ├── le_advertising_manager_facade.cc │ │ ├── le_advertising_manager_facade.h │ │ ├── le_advertising_manager_facade.proto │ │ ├── le_initiator_address_facade.cc │ │ ├── le_initiator_address_facade.h │ │ ├── le_initiator_address_facade.proto │ │ ├── le_scanning_manager_facade.cc │ │ ├── le_scanning_manager_facade.h │ │ └── le_scanning_manager_facade.proto │ ├── fuzz │ │ ├── acl_manager_fuzz_test.cc │ │ ├── fuzz_hci_layer.cc │ │ ├── fuzz_hci_layer.h │ │ ├── hci_layer_fuzz_client.cc │ │ ├── hci_layer_fuzz_client.h │ │ ├── hci_layer_fuzz_test.cc │ │ ├── status_vs_complete_commands.cc │ │ └── status_vs_complete_commands.h │ ├── hci_acl_manager.fbs │ ├── hci_layer.cc │ ├── hci_layer.h │ ├── hci_layer_test.cc │ ├── hci_metrics_logging.cc │ ├── hci_metrics_logging.h │ ├── hci_packets.pdl │ ├── hci_packets_fuzz_test.cc │ ├── hci_packets_test.cc │ ├── le_acl_connection_interface.h │ ├── le_address_manager.cc │ ├── le_address_manager.h │ ├── le_address_manager_test.cc │ ├── le_advertising_interface.h │ ├── le_advertising_manager.cc │ ├── le_advertising_manager.h │ ├── le_advertising_manager_mock.h │ ├── le_advertising_manager_test.cc │ ├── le_iso_interface.h │ ├── le_scanning_interface.h │ ├── le_scanning_manager.cc │ ├── le_scanning_manager.h │ ├── le_scanning_manager_test.cc │ ├── le_security_interface.h │ ├── link_key.cc │ ├── link_key.h │ ├── security_interface.h │ ├── uuid.cc │ ├── uuid.h │ ├── uuid_unittest.cc │ ├── vendor_specific_event_manager.cc │ └── vendor_specific_event_manager.h ├── iso │ ├── Android.bp │ ├── cert │ │ ├── cert_le_iso.py │ │ └── le_iso_test.py │ ├── facade.cc │ ├── facade.h │ ├── facade.proto │ ├── internal │ │ ├── iso_manager_impl.cc │ │ └── iso_manager_impl.h │ ├── iso_manager.cc │ ├── iso_manager.h │ ├── iso_module.cc │ └── iso_module.h ├── l2cap │ ├── Android.bp │ ├── BUILD.gn │ ├── cid.h │ ├── classic │ │ ├── cert │ │ │ ├── cert_l2cap.py │ │ │ ├── l2cap_performance_test.py │ │ │ ├── l2cap_test.py │ │ │ └── pts_l2cap_test.py │ │ ├── dynamic_channel.h │ │ ├── dynamic_channel_configuration_option.h │ │ ├── dynamic_channel_manager.cc │ │ ├── dynamic_channel_manager.h │ │ ├── dynamic_channel_service.cc │ │ ├── dynamic_channel_service.h │ │ ├── facade.cc │ │ ├── facade.h │ │ ├── facade.proto │ │ ├── fixed_channel.cc │ │ ├── fixed_channel.h │ │ ├── fixed_channel_manager.cc │ │ ├── fixed_channel_manager.h │ │ ├── fixed_channel_manager_mock.h │ │ ├── fixed_channel_mock.h │ │ ├── fixed_channel_service.cc │ │ ├── fixed_channel_service.h │ │ ├── fixed_channel_service_mock.h │ │ ├── internal │ │ │ ├── channel_configuration_state.h │ │ │ ├── dumpsys_helper.cc │ │ │ ├── dumpsys_helper.h │ │ │ ├── dynamic_channel_service_impl.h │ │ │ ├── dynamic_channel_service_impl_mock.h │ │ │ ├── dynamic_channel_service_manager_impl.cc │ │ │ ├── dynamic_channel_service_manager_impl.h │ │ │ ├── dynamic_channel_service_manager_impl_mock.h │ │ │ ├── dynamic_channel_service_manager_test.cc │ │ │ ├── fixed_channel_impl.cc │ │ │ ├── fixed_channel_impl.h │ │ │ ├── fixed_channel_impl_mock.h │ │ │ ├── fixed_channel_impl_test.cc │ │ │ ├── fixed_channel_service_impl.h │ │ │ ├── fixed_channel_service_impl_mock.h │ │ │ ├── fixed_channel_service_manager_impl.cc │ │ │ ├── fixed_channel_service_manager_impl.h │ │ │ ├── fixed_channel_service_manager_impl_mock.h │ │ │ ├── fixed_channel_service_manager_test.cc │ │ │ ├── link.cc │ │ │ ├── link.h │ │ │ ├── link_manager.cc │ │ │ ├── link_manager.h │ │ │ ├── link_manager_test.cc │ │ │ ├── link_mock.h │ │ │ ├── link_test.cc │ │ │ ├── signalling_manager.cc │ │ │ ├── signalling_manager.h │ │ │ └── signalling_manager_test.cc │ │ ├── l2cap_classic_module.cc │ │ ├── l2cap_classic_module.fbs │ │ ├── l2cap_classic_module.h │ │ ├── l2cap_classic_module_mock.h │ │ ├── link_property_listener.h │ │ ├── link_security_interface.h │ │ ├── security_enforcement_interface.h │ │ └── security_policy.h │ ├── dynamic_channel.cc │ ├── dynamic_channel.h │ ├── fcs.cc │ ├── fcs.h │ ├── fuzz │ │ ├── Android.bp │ │ ├── channel_fuzz_controller.cc │ │ ├── channel_fuzz_controller.h │ │ ├── fuzz_dynamic_channel_manager.h │ │ ├── fuzz_dynamic_channel_manager_impl.h │ │ ├── fuzz_l2cap.cc │ │ ├── fuzz_l2cap_classic_module.h │ │ └── shim_l2cap.h │ ├── internal │ │ ├── basic_mode_channel_data_controller.cc │ │ ├── basic_mode_channel_data_controller.h │ │ ├── basic_mode_channel_data_controller_test.cc │ │ ├── channel_impl.h │ │ ├── channel_impl_mock.h │ │ ├── data_controller.h │ │ ├── data_controller_mock.h │ │ ├── data_pipeline_manager.cc │ │ ├── data_pipeline_manager.h │ │ ├── data_pipeline_manager_mock.h │ │ ├── dynamic_channel_allocator.cc │ │ ├── dynamic_channel_allocator.h │ │ ├── dynamic_channel_allocator_fuzz_test.cc │ │ ├── dynamic_channel_allocator_test.cc │ │ ├── dynamic_channel_impl.cc │ │ ├── dynamic_channel_impl.h │ │ ├── dynamic_channel_impl_test.cc │ │ ├── enhanced_retransmission_mode_channel_data_controller.cc │ │ ├── enhanced_retransmission_mode_channel_data_controller.h │ │ ├── enhanced_retransmission_mode_channel_data_controller_test.cc │ │ ├── fixed_channel_allocator.h │ │ ├── fixed_channel_allocator_test.cc │ │ ├── ilink.h │ │ ├── ilink_mock.h │ │ ├── le_credit_based_channel_data_controller.cc │ │ ├── le_credit_based_channel_data_controller.h │ │ ├── le_credit_based_channel_data_controller_test.cc │ │ ├── parameter_provider.h │ │ ├── parameter_provider_mock.h │ │ ├── receiver.cc │ │ ├── receiver.h │ │ ├── receiver_test.cc │ │ ├── scheduler.h │ │ ├── scheduler_fifo.cc │ │ ├── scheduler_fifo.h │ │ ├── scheduler_fifo_test.cc │ │ ├── scheduler_mock.h │ │ ├── sender.cc │ │ ├── sender.h │ │ └── sender_test.cc │ ├── l2cap_packet_fuzz_test.cc │ ├── l2cap_packet_test.cc │ ├── l2cap_packets.pdl │ ├── le │ │ ├── cert │ │ │ ├── cert_le_l2cap.py │ │ │ ├── dual_l2cap_test.py │ │ │ └── le_l2cap_test.py │ │ ├── dynamic_channel.cc │ │ ├── dynamic_channel.h │ │ ├── dynamic_channel_configuration_option.h │ │ ├── dynamic_channel_manager.cc │ │ ├── dynamic_channel_manager.h │ │ ├── dynamic_channel_service.cc │ │ ├── dynamic_channel_service.h │ │ ├── facade.cc │ │ ├── facade.h │ │ ├── facade.proto │ │ ├── fixed_channel.cc │ │ ├── fixed_channel.h │ │ ├── fixed_channel_manager.cc │ │ ├── fixed_channel_manager.h │ │ ├── fixed_channel_service.cc │ │ ├── fixed_channel_service.h │ │ ├── internal │ │ │ ├── dynamic_channel_service_impl.h │ │ │ ├── dynamic_channel_service_impl_mock.h │ │ │ ├── dynamic_channel_service_manager_impl.cc │ │ │ ├── dynamic_channel_service_manager_impl.h │ │ │ ├── dynamic_channel_service_manager_test.cc │ │ │ ├── fixed_channel_impl.cc │ │ │ ├── fixed_channel_impl.h │ │ │ ├── fixed_channel_impl_mock.h │ │ │ ├── fixed_channel_impl_test.cc │ │ │ ├── fixed_channel_service_impl.h │ │ │ ├── fixed_channel_service_impl_mock.h │ │ │ ├── fixed_channel_service_manager_impl.cc │ │ │ ├── fixed_channel_service_manager_impl.h │ │ │ ├── fixed_channel_service_manager_impl_mock.h │ │ │ ├── fixed_channel_service_manager_test.cc │ │ │ ├── link.cc │ │ │ ├── link.h │ │ │ ├── link_manager.cc │ │ │ ├── link_manager.h │ │ │ ├── link_manager_test.cc │ │ │ ├── link_mock.h │ │ │ ├── signalling_manager.cc │ │ │ └── signalling_manager.h │ │ ├── l2cap_le_module.cc │ │ ├── l2cap_le_module.h │ │ ├── l2cap_le_module_mock.h │ │ ├── link_options.cc │ │ ├── link_options.h │ │ ├── link_property_listener.h │ │ ├── security_enforcement_interface.h │ │ └── security_policy.h │ ├── mtu.h │ ├── psm.h │ ├── signal_id.h │ └── signal_id_test.cc ├── module.cc ├── module.h ├── module_unittest.cc ├── module_unittest.fbs ├── module_unittest_generated.h ├── neighbor │ ├── Android.bp │ ├── BUILD.gn │ ├── cert │ │ ├── neighbor_test.py │ │ └── py_neighbor.py │ ├── connectability.cc │ ├── connectability.h │ ├── discoverability.cc │ ├── discoverability.h │ ├── facade │ │ ├── facade.cc │ │ ├── facade.h │ │ └── facade.proto │ ├── inquiry.cc │ ├── inquiry.h │ ├── inquiry_mock.h │ ├── inquiry_test.cc │ ├── name.cc │ ├── name.h │ ├── name_db.cc │ ├── name_db.h │ ├── page.cc │ ├── page.h │ ├── scan.cc │ ├── scan.h │ └── scan_parameters.h ├── os │ ├── Android.bp │ ├── BUILD.gn │ ├── alarm.h │ ├── alarm_benchmark.cc │ ├── android │ │ ├── metrics.cc │ │ ├── parameter_provider.cc │ │ ├── system_properties.cc │ │ ├── system_properties_test.cc │ │ ├── wakelock_native.cc │ │ └── wakelock_native_test.cc │ ├── files.h │ ├── fuzz │ │ ├── dev_null_queue.h │ │ ├── fake_timerfd.cc │ │ ├── fake_timerfd.h │ │ └── fuzz_inject_queue.h │ ├── handler.h │ ├── host │ │ ├── metrics.cc │ │ ├── parameter_provider.cc │ │ ├── system_properties.cc │ │ ├── system_properties_test.cc │ │ └── wakelock_native.cc │ ├── internal │ │ └── wakelock_native.h │ ├── linux │ │ ├── metrics.cc │ │ ├── parameter_provider.cc │ │ ├── system_properties.cc │ │ ├── system_properties_test.cc │ │ └── wakelock_native.cc │ ├── linux_generic │ │ ├── alarm.cc │ │ ├── alarm_unittest.cc │ │ ├── files.cc │ │ ├── files_test.cc │ │ ├── handler.cc │ │ ├── handler_unittest.cc │ │ ├── linux.h │ │ ├── queue.tpp │ │ ├── queue_unittest.cc │ │ ├── reactive_semaphore.cc │ │ ├── reactive_semaphore.h │ │ ├── reactor.cc │ │ ├── reactor_unittest.cc │ │ ├── repeating_alarm.cc │ │ ├── repeating_alarm_unittest.cc │ │ ├── thread.cc │ │ ├── thread_unittest.cc │ │ ├── wakelock_manager.cc │ │ └── wakelock_manager_unittest.cc │ ├── log.h │ ├── metrics.h │ ├── mock_queue.h │ ├── parameter_provider.h │ ├── queue.h │ ├── queue_benchmark.cc │ ├── rand.h │ ├── reactor.h │ ├── repeating_alarm.h │ ├── system_properties.h │ ├── thread.h │ ├── thread_benchmark.cc │ ├── utils.h │ ├── wakelock_manager.fbs │ └── wakelock_manager.h ├── packet │ ├── Android.bp │ ├── BUILD.gn │ ├── base_packet_builder.h │ ├── base_struct.h │ ├── bit_inserter.cc │ ├── bit_inserter.h │ ├── bit_inserter_unittest.cc │ ├── byte_inserter.cc │ ├── byte_inserter.h │ ├── byte_observer.cc │ ├── byte_observer.h │ ├── custom_field_fixed_size_interface.h │ ├── endian_inserter.h │ ├── fragmenting_inserter.cc │ ├── fragmenting_inserter.h │ ├── fragmenting_inserter_unittest.cc │ ├── iterator.cc │ ├── iterator.h │ ├── packet_builder.h │ ├── packet_builder_unittest.cc │ ├── packet_struct.h │ ├── packet_view.cc │ ├── packet_view.h │ ├── packet_view_unittest.cc │ ├── parser │ │ ├── Android.bp │ │ ├── BUILD.gn │ │ ├── README │ │ ├── bison.gni │ │ ├── checksum_def.cc │ │ ├── checksum_def.h │ │ ├── checksum_type_checker.h │ │ ├── custom_field_def.cc │ │ ├── custom_field_def.h │ │ ├── custom_type_checker.h │ │ ├── declarations.h │ │ ├── enum_def.cc │ │ ├── enum_def.h │ │ ├── enum_gen.cc │ │ ├── enum_gen.h │ │ ├── field_list.h │ │ ├── fields │ │ │ ├── all_fields.h │ │ │ ├── array_field.cc │ │ │ ├── array_field.h │ │ │ ├── body_field.cc │ │ │ ├── body_field.h │ │ │ ├── checksum_field.cc │ │ │ ├── checksum_field.h │ │ │ ├── checksum_start_field.cc │ │ │ ├── checksum_start_field.h │ │ │ ├── count_field.cc │ │ │ ├── count_field.h │ │ │ ├── custom_field.cc │ │ │ ├── custom_field.h │ │ │ ├── custom_field_fixed_size.cc │ │ │ ├── custom_field_fixed_size.h │ │ │ ├── enum_field.cc │ │ │ ├── enum_field.h │ │ │ ├── fixed_enum_field.cc │ │ │ ├── fixed_enum_field.h │ │ │ ├── fixed_field.cc │ │ │ ├── fixed_field.h │ │ │ ├── fixed_scalar_field.cc │ │ │ ├── fixed_scalar_field.h │ │ │ ├── group_field.cc │ │ │ ├── group_field.h │ │ │ ├── packet_field.cc │ │ │ ├── packet_field.h │ │ │ ├── padding_field.cc │ │ │ ├── padding_field.h │ │ │ ├── payload_field.cc │ │ │ ├── payload_field.h │ │ │ ├── reserved_field.cc │ │ │ ├── reserved_field.h │ │ │ ├── scalar_field.cc │ │ │ ├── scalar_field.h │ │ │ ├── size_field.cc │ │ │ ├── size_field.h │ │ │ ├── struct_field.cc │ │ │ ├── struct_field.h │ │ │ ├── variable_length_struct_field.cc │ │ │ ├── variable_length_struct_field.h │ │ │ ├── vector_field.cc │ │ │ └── vector_field.h │ │ ├── flex.gni │ │ ├── gen_cpp.cc │ │ ├── gen_rust.cc │ │ ├── language_l.ll │ │ ├── language_y.yy │ │ ├── logging.h │ │ ├── main.cc │ │ ├── packet_def.cc │ │ ├── packet_def.h │ │ ├── packetgen.gni │ │ ├── parent_def.cc │ │ ├── parent_def.h │ │ ├── parse_location.h │ │ ├── size.h │ │ ├── struct_def.cc │ │ ├── struct_def.h │ │ ├── struct_parser_generator.cc │ │ ├── struct_parser_generator.h │ │ ├── test │ │ │ ├── Android.bp │ │ │ ├── big_endian_test_packets.pdl │ │ │ ├── generated_packet_test.cc │ │ │ ├── simple_sum.h │ │ │ ├── six_bytes.cc │ │ │ ├── six_bytes.h │ │ │ ├── test_packets.pdl │ │ │ ├── variable.cc │ │ │ └── variable.h │ │ ├── type_def.h │ │ └── util.h │ ├── python3_module.cc │ ├── raw_builder.cc │ ├── raw_builder.h │ ├── raw_builder_unittest.cc │ ├── view.cc │ └── view.h ├── proto │ ├── Android.bp │ ├── BUILD.gn │ └── bluetooth │ │ ├── bluetoothKeystore │ │ └── keystore.proto │ │ └── metrics │ │ └── bluetooth.proto ├── rust │ ├── README.md │ ├── common │ │ ├── Android.bp │ │ ├── BUILD.gn │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── asserts.rs │ │ │ ├── ffi │ │ │ ├── sys_prop.cc │ │ │ └── sys_prop.h │ │ │ ├── init_flags.rs │ │ │ ├── lib.rs │ │ │ ├── ready.rs │ │ │ ├── sys_prop.rs │ │ │ └── time.rs │ ├── facade │ │ ├── Android.bp │ │ ├── BUILD.gn │ │ ├── Cargo.toml │ │ ├── helpers │ │ │ ├── Cargo.toml │ │ │ └── lib.rs │ │ └── src │ │ │ ├── lib.rs │ │ │ └── main.rs │ ├── facade_proto │ │ ├── Cargo.toml │ │ ├── build.rs │ │ └── src │ │ │ ├── common.rs │ │ │ └── lib.rs │ ├── gddi │ │ ├── Android.bp │ │ ├── Cargo.toml │ │ ├── macros │ │ │ ├── Cargo.toml │ │ │ └── lib.rs │ │ └── src │ │ │ └── lib.rs │ ├── hal │ │ ├── Android.bp │ │ ├── BUILD.gn │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── facade.rs │ │ │ ├── ffi │ │ │ ├── hidl.cc │ │ │ └── hidl.h │ │ │ ├── hidl_hal.rs │ │ │ ├── lib.rs │ │ │ ├── rootcanal_hal.rs │ │ │ └── snoop.rs │ ├── hci │ │ ├── Android.bp │ │ ├── BUILD.gn │ │ ├── Cargo.toml │ │ ├── custom_types │ │ │ ├── Cargo.toml │ │ │ └── lib.rs │ │ └── src │ │ │ ├── controller.rs │ │ │ ├── controller_facade.rs │ │ │ ├── error.rs │ │ │ ├── facade.rs │ │ │ └── lib.rs │ ├── link │ │ ├── Android.bp │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── acl │ │ │ ├── classic │ │ │ │ ├── facade.rs │ │ │ │ └── mod.rs │ │ │ ├── core.rs │ │ │ ├── fragment.rs │ │ │ └── mod.rs │ │ │ └── lib.rs │ ├── linux │ │ ├── adapter │ │ │ ├── Cargo.toml │ │ │ ├── build.rs │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── dbus_projection │ │ │ ├── Cargo.toml │ │ │ ├── dbus_macros │ │ │ │ ├── Cargo.toml │ │ │ │ └── src │ │ │ │ │ └── lib.rs │ │ │ └── src │ │ │ │ └── lib.rs │ │ ├── mgmt │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ │ └── bin │ │ │ │ └── btmanagerd │ │ │ │ ├── main.rs │ │ │ │ └── state_machine.rs │ │ ├── service │ │ │ ├── Cargo.toml │ │ │ ├── build.rs │ │ │ └── src │ │ │ │ ├── dbus_arg.rs │ │ │ │ ├── iface_bluetooth.rs │ │ │ │ ├── iface_bluetooth_gatt.rs │ │ │ │ └── main.rs │ │ └── stack │ │ │ ├── Cargo.toml │ │ │ ├── btif_macros │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ │ └── lib.rs │ │ │ └── src │ │ │ ├── bluetooth.rs │ │ │ ├── bluetooth_gatt.rs │ │ │ └── lib.rs │ ├── main │ │ ├── Android.bp │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ ├── packets │ │ ├── Cargo.toml │ │ ├── build.rs │ │ └── lib.rs │ ├── shim │ │ ├── Android.bp │ │ ├── BUILD.gn │ │ ├── Cargo.toml │ │ ├── callbacks │ │ │ ├── callbacks.cc │ │ │ └── callbacks.h │ │ └── src │ │ │ ├── bridge.rs │ │ │ ├── controller.rs │ │ │ ├── hci.rs │ │ │ ├── init_flags.rs │ │ │ ├── lib.rs │ │ │ ├── message_loop_thread.rs │ │ │ └── stack.rs │ └── topshim │ │ ├── BUILD.gn │ │ ├── Cargo.toml │ │ ├── bindings │ │ └── wrapper.h │ │ ├── btif │ │ ├── btif_shim.cc │ │ └── btif_shim.h │ │ └── src │ │ ├── btif.rs │ │ ├── lib.rs │ │ └── topstack.rs ├── security │ ├── Android.bp │ ├── BUILD.gn │ ├── cert │ │ ├── cert_security.py │ │ ├── le_security_test.py │ │ └── security_test.py │ ├── channel │ │ ├── Android.bp │ │ ├── security_manager_channel.cc │ │ ├── security_manager_channel.h │ │ └── security_manager_channel_unittest.cc │ ├── ecc │ │ ├── multipoint_test.cc │ │ ├── multprecision.cc │ │ ├── multprecision.h │ │ ├── p_256_ecc_pp.cc │ │ └── p_256_ecc_pp.h │ ├── ecdh_keys.cc │ ├── ecdh_keys.h │ ├── facade.cc │ ├── facade.h │ ├── facade.proto │ ├── facade_configuration_api.cc │ ├── facade_configuration_api.h │ ├── initial_informations.h │ ├── internal │ │ ├── security_manager_impl.cc │ │ └── security_manager_impl.h │ ├── l2cap_security_module_interface.cc │ ├── l2cap_security_module_interface.h │ ├── pairing │ │ ├── Android.bp │ │ ├── classic_pairing_handler.cc │ │ ├── classic_pairing_handler.h │ │ ├── classic_pairing_handler_unittest.cc │ │ ├── oob_data.h │ │ └── pairing_handler.h │ ├── pairing_failure.h │ ├── pairing_handler_le.cc │ ├── pairing_handler_le.h │ ├── pairing_handler_le_legacy.cc │ ├── pairing_handler_le_secure_connections.cc │ ├── pairing_handler_le_unittest.cc │ ├── record │ │ ├── Android.bp │ │ ├── security_record.h │ │ ├── security_record_database.h │ │ ├── security_record_storage.cc │ │ ├── security_record_storage.h │ │ └── security_record_storage_test.cc │ ├── security_manager.cc │ ├── security_manager.h │ ├── security_manager_listener.h │ ├── security_module.cc │ ├── security_module.h │ ├── smp_packets.pdl │ ├── test │ │ ├── ecdh_keys_test.cc │ │ ├── fake_hci_layer.h │ │ ├── fake_l2cap_test.cc │ │ ├── fake_name_db.h │ │ ├── fake_security_interface.h │ │ ├── fake_storage_module.h │ │ ├── mocks.h │ │ └── pairing_handler_le_pair_test.cc │ └── ui.h ├── setup.py ├── shim │ ├── Android.bp │ ├── BUILD.gn │ ├── cert │ │ ├── shim_test.py │ │ └── stack_test.py │ ├── dumpsys.cc │ ├── dumpsys.fbs │ ├── dumpsys.h │ ├── dumpsys_args.cc │ ├── dumpsys_args.h │ ├── dumpsys_args_test.cc │ ├── dumpsys_test.cc │ ├── facade │ │ ├── facade.cc │ │ ├── facade.h │ │ └── facade.proto │ └── test_data │ │ ├── dumpsys_data.bfbs │ │ ├── dumpsys_test_data_bin │ │ └── dumpsys_test_data_bin.h ├── stack_manager.cc ├── stack_manager.h ├── stack_manager_unittest.cc └── storage │ ├── Android.bp │ ├── BUILD.gn │ ├── adapter_config.cc │ ├── adapter_config.h │ ├── adapter_config_test.cc │ ├── classic_device.cc │ ├── classic_device.h │ ├── classic_device_test.cc │ ├── config_cache.cc │ ├── config_cache.h │ ├── config_cache_helper.cc │ ├── config_cache_helper.h │ ├── config_cache_helper_test.cc │ ├── config_cache_test.cc │ ├── device.cc │ ├── device.h │ ├── device_test.cc │ ├── le_device.cc │ ├── le_device.h │ ├── le_device_test.cc │ ├── legacy_config_file.cc │ ├── legacy_config_file.h │ ├── legacy_config_file_test.cc │ ├── mutation.cc │ ├── mutation.h │ ├── mutation_entry.cc │ ├── mutation_entry.h │ ├── mutation_test.cc │ ├── serializable.h │ ├── storage_module.cc │ ├── storage_module.h │ └── storage_module_test.cc ├── hci ├── Android.bp ├── BUILD.gn ├── include │ ├── bt_hci_bdroid.h │ ├── bt_vendor_lib.h │ ├── btsnoop.h │ ├── btsnoop_mem.h │ ├── buffer_allocator.h │ ├── hci_hal.h │ ├── hci_inject.h │ ├── hci_internals.h │ ├── hci_layer.h │ ├── hci_packet_factory.h │ ├── hci_packet_parser.h │ ├── low_power_manager.h │ ├── packet_fragmenter.h │ ├── userial.h │ └── vendor.h ├── src │ ├── btsnoop.cc │ ├── btsnoop_mem.cc │ ├── btsnoop_net.cc │ ├── buffer_allocator.cc │ ├── hci_inject.cc │ ├── hci_layer.cc │ ├── hci_layer_android.cc │ ├── hci_layer_linux.cc │ ├── hci_packet_factory.cc │ ├── hci_packet_parser.cc │ └── packet_fragmenter.cc └── test │ ├── hci_layer_test.cc │ ├── other_stack_stub.cc │ ├── packet_fragmenter_host_test.cc │ └── packet_fragmenter_test.cc ├── include ├── Android.bp ├── abstract_message_loop.h ├── abstract_observer_list.h ├── array_utils.h └── hardware │ ├── avrcp │ ├── avrcp.h │ ├── avrcp_common.h │ └── avrcp_logging_helper.h │ ├── ble_advertiser.h │ ├── ble_scanner.h │ ├── bluetooth.h │ ├── bluetooth_headset_callbacks.h │ ├── bluetooth_headset_interface.h │ ├── bt_activity_attribution.h │ ├── bt_av.h │ ├── bt_common_types.h │ ├── bt_gatt.h │ ├── bt_gatt_client.h │ ├── bt_gatt_server.h │ ├── bt_gatt_types.h │ ├── bt_hd.h │ ├── bt_hearing_aid.h │ ├── bt_hf.h │ ├── bt_hf_client.h │ ├── bt_hh.h │ ├── bt_keystore.h │ ├── bt_le_audio.h │ ├── bt_pan.h │ ├── bt_rc.h │ ├── bt_sdp.h │ ├── bt_sock.h │ └── bt_vc.h ├── internal_include ├── Android.bp ├── bt_common.h ├── bt_target.h ├── bt_trace.h ├── bte.h ├── bte_appl.h └── stack_config.h ├── linux_include └── log │ └── log.h ├── main ├── Android.bp ├── BUILD.gn ├── bte_conf.cc ├── bte_init_cpp_logging.cc ├── bte_logmsg.cc ├── bte_main.cc ├── main_int.h ├── shim │ ├── Android.bp │ ├── BUILD.gn │ ├── acl.cc │ ├── acl.h │ ├── acl_api.cc │ ├── acl_api.h │ ├── acl_legacy_interface.cc │ ├── acl_legacy_interface.h │ ├── activity_attribution.cc │ ├── activity_attribution.h │ ├── btm.cc │ ├── btm.h │ ├── btm_api.cc │ ├── btm_api.h │ ├── config.cc │ ├── config.h │ ├── controller.cc │ ├── controller.h │ ├── dumpsys.cc │ ├── dumpsys.h │ ├── entry.cc │ ├── entry.h │ ├── hci_layer.cc │ ├── hci_layer.h │ ├── helpers.h │ ├── l2c_api.cc │ ├── l2c_api.h │ ├── le_advertising_manager.cc │ ├── le_advertising_manager.h │ ├── le_scanning_manager.cc │ ├── le_scanning_manager.h │ ├── link_connection_interface.h │ ├── link_policy.cc │ ├── link_policy.h │ ├── link_policy_interface.h │ ├── metric_id_api.cc │ ├── metric_id_api.h │ ├── metrics_api.cc │ ├── metrics_api.h │ ├── shim.cc │ ├── shim.h │ ├── stack.cc │ ├── stack.h │ ├── utils.cc │ └── utils.h ├── stack_config.cc └── test │ └── main_shim_test.cc ├── osi ├── Android.bp ├── BUILD.gn ├── include │ ├── alarm.h │ ├── allocation_tracker.h │ ├── allocator.h │ ├── array.h │ ├── buffer.h │ ├── compat.h │ ├── config.h │ ├── fixed_queue.h │ ├── future.h │ ├── hash_map_utils.h │ ├── list.h │ ├── log.h │ ├── mutex.h │ ├── osi.h │ ├── properties.h │ ├── reactor.h │ ├── ringbuffer.h │ ├── semaphore.h │ ├── socket.h │ ├── socket_utils │ │ ├── socket_local.h │ │ └── sockets.h │ ├── thread.h │ └── wakelock.h ├── src │ ├── alarm.cc │ ├── allocation_tracker.cc │ ├── allocator.cc │ ├── array.cc │ ├── buffer.cc │ ├── compat.cc │ ├── config.cc │ ├── fixed_queue.cc │ ├── future.cc │ ├── hash_map_utils.cc │ ├── list.cc │ ├── mutex.cc │ ├── osi.cc │ ├── properties.cc │ ├── reactor.cc │ ├── ringbuffer.cc │ ├── semaphore.cc │ ├── socket.cc │ ├── socket_utils │ │ ├── README │ │ ├── socket_local_client.cc │ │ └── socket_local_server.cc │ ├── thread.cc │ └── wakelock.cc └── test │ ├── AlarmTestHarness.cc │ ├── AlarmTestHarness.h │ ├── AllocationTestHarness.cc │ ├── AllocationTestHarness.h │ ├── alarm_mock.h │ ├── alarm_test.cc │ ├── allocation_tracker_test.cc │ ├── allocator_test.cc │ ├── array_test.cc │ ├── config_test.cc │ ├── fixed_queue_test.cc │ ├── future_test.cc │ ├── fuzzers │ ├── Android.bp │ ├── alarm │ │ ├── Android.bp │ │ └── fuzz_alarm.cc │ ├── allocation_tracker │ │ ├── Android.bp │ │ ├── corpus │ │ │ └── checkfail-regression-156805580 │ │ └── fuzz_allocation_tracker.cc │ ├── allocator │ │ ├── Android.bp │ │ └── fuzz_allocator.cc │ ├── array │ │ ├── Android.bp │ │ └── fuzz_array.cc │ ├── buffer │ │ ├── Android.bp │ │ └── fuzz_buffer.cc │ ├── compat │ │ ├── Android.bp │ │ └── fuzz_compat.cc │ ├── fixed_queue │ │ ├── Android.bp │ │ └── fuzz_fixed_queue.cc │ ├── future │ │ ├── Android.bp │ │ └── fuzz_future.cc │ ├── include │ │ └── libosiFuzzHelperFunctions.h │ ├── list │ │ ├── Android.bp │ │ └── fuzz_list.cc │ └── ringbuffer │ │ ├── Android.bp │ │ └── fuzz_ringbuffer.cc │ ├── hash_map_utils_test.cc │ ├── list_test.cc │ ├── properties_test.cc │ ├── rand_test.cc │ ├── reactor_test.cc │ ├── ringbuffer_test.cc │ ├── semaphore_test.cc │ ├── test_stubs.h │ ├── thread_test.cc │ └── wakelock_test.cc ├── packet ├── Android.bp ├── BUILD.gn ├── avrcp │ ├── Android.bp │ ├── avrcp_browse_packet.cc │ ├── avrcp_browse_packet.h │ ├── avrcp_packet.cc │ ├── avrcp_packet.h │ ├── avrcp_reject_packet.cc │ ├── avrcp_reject_packet.h │ ├── capabilities_packet.cc │ ├── capabilities_packet.h │ ├── change_path.cc │ ├── change_path.h │ ├── general_reject_packet.cc │ ├── general_reject_packet.h │ ├── get_element_attributes_packet.cc │ ├── get_element_attributes_packet.h │ ├── get_folder_items.cc │ ├── get_folder_items.h │ ├── get_item_attributes.cc │ ├── get_item_attributes.h │ ├── get_play_status_packet.cc │ ├── get_play_status_packet.h │ ├── get_total_number_of_items.cc │ ├── get_total_number_of_items.h │ ├── pass_through_packet.cc │ ├── pass_through_packet.h │ ├── play_item.cc │ ├── play_item.h │ ├── register_notification_packet.cc │ ├── register_notification_packet.h │ ├── set_absolute_volume.cc │ ├── set_absolute_volume.h │ ├── set_addressed_player.cc │ ├── set_addressed_player.h │ ├── set_browsed_player.cc │ ├── set_browsed_player.h │ ├── vendor_packet.cc │ └── vendor_packet.h ├── base │ ├── Android.bp │ ├── iterator.cc │ ├── iterator.h │ ├── packet.cc │ ├── packet.h │ ├── packet_builder.cc │ └── packet_builder.h ├── include │ ├── avrcp_packet.h │ └── packet.h └── tests │ ├── avrcp │ ├── avrcp_browse_packet_test.cc │ ├── avrcp_packet_test.cc │ ├── avrcp_reject_packet_test.cc │ ├── avrcp_test_packets.h │ ├── change_path_packet_test.cc │ ├── general_reject_packet_test.cc │ ├── get_capabilities_packet_test.cc │ ├── get_element_attributes_packet_test.cc │ ├── get_folder_items_packet_test.cc │ ├── get_item_attributes_packet_test.cc │ ├── get_play_status_packet_test.cc │ ├── get_total_number_of_items_packet_test.cc │ ├── pass_through_packet_test.cc │ ├── play_item_packet_test.cc │ ├── register_notification_packet_test.cc │ ├── set_absolute_volume_packet_test.cc │ ├── set_addressed_player_packet_test.cc │ ├── set_browsed_player_packet_test.cc │ └── vendor_packet_test.cc │ ├── base │ ├── iterator_test.cc │ ├── packet_builder_test.cc │ ├── packet_test.cc │ └── packet_test_common.h │ ├── fuzzers │ ├── Android.bp │ ├── avrcp_browse_packet_fuzzer.cc │ ├── avrcp_packet_fuzzer.cc │ ├── change_path_req_fuzzer.cc │ ├── change_path_res_fuzzer.cc │ ├── corpus │ │ ├── avrcp_browse_packet_corpus │ │ │ └── validpacket │ │ ├── avrcp_packet_corpus │ │ │ └── validpacket │ │ ├── avrcp_test_packets_corpus │ │ │ └── validpacket │ │ ├── change_path_packet_corpus │ │ │ └── validpacket │ │ ├── generate_corpus.sh │ │ ├── get_capabilities_packet_corpus │ │ │ └── validpacket │ │ ├── get_item_attributes_packet_corpus │ │ │ └── validpacket │ │ ├── get_play_status_packet_corpus │ │ │ └── validpacket │ │ ├── get_total_number_of_items_corpus │ │ │ └── validpacket │ │ ├── pass_through_packet_corpus │ │ │ └── validpacket │ │ ├── play_item_packet_corpus │ │ │ └── validpacket │ │ ├── register_notification_packet_corpus │ │ │ └── validpacket │ │ ├── set_absolute_volume_packet_corpus │ │ │ └── validpacket │ │ ├── set_addressed_player_packet_corpus │ │ │ └── validpacket │ │ ├── set_browsed_player_packet_corpus │ │ │ └── validpacket │ │ └── vendor_packet_corpus │ │ │ └── validpacket │ ├── get_capabilities_req_fuzzer.cc │ ├── get_capabilities_res_fuzzer.cc │ ├── get_element_attributes_req_packet_fuzzer.cc │ ├── get_element_attributes_res_packet_fuzzer.cc │ ├── get_folder_items_req_fuzzer.cc │ ├── get_folder_items_res_fuzzer.cc │ ├── get_item_attributes_req_fuzzer.cc │ ├── get_item_attributes_res_fuzzer.cc │ ├── get_play_status_req_fuzzer.cc │ ├── get_play_status_res_fuzzer.cc │ ├── get_total_number_of_items_req_fuzzer.cc │ ├── get_total_number_of_items_res_fuzzer.cc │ ├── pass_through_packet_fuzzer.cc │ ├── play_item_packet_fuzzer.cc │ ├── register_notification_packet_fuzzer.cc │ ├── reject_packet_fuzzer.cc │ ├── set_absolute_volume_packet_fuzzer.cc │ ├── set_addressed_player_packet_fuzzer.cc │ ├── set_browsed_player_req_fuzzer.cc │ ├── set_browsed_player_res_fuzzer.cc │ └── vendor_packet_fuzzer.cc │ ├── packet_test_helper.h │ └── test_packets.h ├── profile ├── avrcp │ ├── Android.bp │ ├── BUILD.gn │ ├── avrcp_config.h │ ├── avrcp_internal.h │ ├── avrcp_message_converter.h │ ├── connection_handler.cc │ ├── connection_handler.h │ ├── device.cc │ ├── device.h │ ├── media_id_map.h │ └── tests │ │ ├── avrcp_connection_handler_test.cc │ │ ├── avrcp_device_fuzz │ │ ├── avrcp_device_fuzz.cc │ │ └── corpus │ │ │ ├── change_path_error_response │ │ │ ├── change_path_request │ │ │ ├── change_path_response │ │ │ ├── change_path_up_request │ │ │ ├── changed_play_pos_notification │ │ │ ├── changed_volume_changed_notification │ │ │ ├── general_reject_invalid_command_packet │ │ │ ├── get_capabilities_request │ │ │ ├── get_capabilities_request_company_id │ │ │ ├── get_capabilities_request_unknown │ │ │ ├── get_capabilities_response_company_id │ │ │ ├── get_capabilities_response_events_supported │ │ │ ├── get_element_attributes_request_full │ │ │ ├── get_element_attributes_request_partial │ │ │ ├── get_elements_attributes_response_full │ │ │ ├── get_folder_items_error_response │ │ │ ├── get_folder_items_folder_response │ │ │ ├── get_folder_items_media_player_response │ │ │ ├── get_folder_items_request │ │ │ ├── get_folder_items_request_no_attrs │ │ │ ├── get_folder_items_request_now_playing │ │ │ ├── get_folder_items_request_title │ │ │ ├── get_folder_items_request_vfs │ │ │ ├── get_folder_items_song_response │ │ │ ├── get_item_attributes_request_all_attributes │ │ │ ├── get_item_attributes_request_all_attributes_invalid │ │ │ ├── get_item_attributes_song_response │ │ │ ├── get_play_status_request │ │ │ ├── get_play_status_response │ │ │ ├── get_total_number_of_items_request_media_players │ │ │ ├── get_total_number_of_items_request_now_playing │ │ │ ├── get_total_number_of_items_request_vfs │ │ │ ├── get_total_number_of_items_response │ │ │ ├── interim_addressed_player_notification │ │ │ ├── interim_available_players_notification │ │ │ ├── interim_now_playing_notification │ │ │ ├── interim_play_status_notification │ │ │ ├── interim_track_changed_notification │ │ │ ├── interim_uids_notificaiton │ │ │ ├── interim_volume_changed_notification │ │ │ ├── pass_through_command_play_pushed │ │ │ ├── pass_through_command_play_released │ │ │ ├── play_item_request │ │ │ ├── play_item_response │ │ │ ├── register_notification_invalid │ │ │ ├── register_play_status_notification │ │ │ ├── register_volume_changed_notification │ │ │ ├── reject_player_app_settings_response │ │ │ ├── rejected_volume_changed_notification │ │ │ ├── set_absolute_volume_request │ │ │ ├── set_absolute_volume_response │ │ │ ├── set_addressed_player_id_1_request │ │ │ ├── set_addressed_player_request │ │ │ ├── set_addressed_player_response │ │ │ ├── set_browsed_player_request │ │ │ ├── set_browsed_player_response │ │ │ ├── short_browse_packet │ │ │ ├── short_change_path_request │ │ │ ├── short_get_capabilities_request │ │ │ ├── short_get_element_attributes_request │ │ │ ├── short_get_folder_items_request │ │ │ ├── short_get_item_attributes_request │ │ │ ├── short_get_total_number_of_items_request │ │ │ ├── short_play_item_request │ │ │ ├── short_set_addressed_player_request │ │ │ └── short_vendor_packet │ │ ├── avrcp_device_test.cc │ │ └── avrcp_test_helper.h └── sdp │ ├── Android.bp │ ├── common │ ├── data_element_reader.cc │ ├── data_element_reader.h │ └── test │ │ └── data_element_reader_test.cc │ ├── sdp_common.h │ └── sdp_logging_helper.h ├── rustfmt.toml ├── service ├── Android.bp ├── BUILD.gn ├── a2dp_sink.cc ├── a2dp_sink.h ├── a2dp_source.cc ├── a2dp_source.h ├── adapter.cc ├── adapter.h ├── avrcp_control.cc ├── avrcp_control.h ├── avrcp_target.cc ├── avrcp_target.h ├── bluetooth_instance.h ├── bluetoothtbd.rc ├── client │ └── main.cc ├── common │ ├── Android.bp │ ├── BUILD.gn │ ├── README │ ├── android │ │ └── bluetooth │ │ │ ├── AdvertiseData.aidl │ │ │ ├── AdvertiseSettings.aidl │ │ │ ├── BluetoothA2dpCodecConfig.aidl │ │ │ ├── BluetoothAvrcpIntValue.aidl │ │ │ ├── BluetoothAvrcpMediaAttr.aidl │ │ │ ├── BluetoothAvrcpRegisterNotificationResponse.aidl │ │ │ ├── BluetoothAvrcpStringValue.aidl │ │ │ ├── BluetoothGattCharacteristic.aidl │ │ │ ├── BluetoothGattDescriptor.aidl │ │ │ ├── BluetoothGattIncludedService.aidl │ │ │ ├── BluetoothGattService.aidl │ │ │ ├── BluetoothRemoteDeviceProps.aidl │ │ │ ├── IBluetooth.aidl │ │ │ ├── IBluetoothA2dpSink.aidl │ │ │ ├── IBluetoothA2dpSinkCallback.aidl │ │ │ ├── IBluetoothA2dpSource.aidl │ │ │ ├── IBluetoothA2dpSourceCallback.aidl │ │ │ ├── IBluetoothAvrcpControl.aidl │ │ │ ├── IBluetoothAvrcpControlCallback.aidl │ │ │ ├── IBluetoothAvrcpTarget.aidl │ │ │ ├── IBluetoothAvrcpTargetCallback.aidl │ │ │ ├── IBluetoothCallback.aidl │ │ │ ├── IBluetoothGattClient.aidl │ │ │ ├── IBluetoothGattClientCallback.aidl │ │ │ ├── IBluetoothGattServer.aidl │ │ │ ├── IBluetoothGattServerCallback.aidl │ │ │ ├── IBluetoothLeAdvertiser.aidl │ │ │ ├── IBluetoothLeAdvertiserCallback.aidl │ │ │ ├── IBluetoothLeScanner.aidl │ │ │ ├── IBluetoothLeScannerCallback.aidl │ │ │ ├── IBluetoothLowEnergy.aidl │ │ │ ├── IBluetoothLowEnergyCallback.aidl │ │ │ ├── ScanFilter.aidl │ │ │ ├── ScanResult.aidl │ │ │ ├── ScanSettings.aidl │ │ │ ├── UUID.aidl │ │ │ ├── advertise_data.cc │ │ │ ├── advertise_data.h │ │ │ ├── advertise_settings.cc │ │ │ ├── advertise_settings.h │ │ │ ├── bluetooth_a2dp_codec_config.cc │ │ │ ├── bluetooth_a2dp_codec_config.h │ │ │ ├── bluetooth_avrcp_int_value.cc │ │ │ ├── bluetooth_avrcp_int_value.h │ │ │ ├── bluetooth_avrcp_media_attr.cc │ │ │ ├── bluetooth_avrcp_media_attr.h │ │ │ ├── bluetooth_avrcp_register_notification_response.cc │ │ │ ├── bluetooth_avrcp_register_notification_response.h │ │ │ ├── bluetooth_avrcp_string_value.cc │ │ │ ├── bluetooth_avrcp_string_value.h │ │ │ ├── bluetooth_gatt_characteristic.cc │ │ │ ├── bluetooth_gatt_characteristic.h │ │ │ ├── bluetooth_gatt_descriptor.cc │ │ │ ├── bluetooth_gatt_descriptor.h │ │ │ ├── bluetooth_gatt_included_service.cc │ │ │ ├── bluetooth_gatt_included_service.h │ │ │ ├── bluetooth_gatt_service.cc │ │ │ ├── bluetooth_gatt_service.h │ │ │ ├── bluetooth_remote_device_props.cc │ │ │ ├── bluetooth_remote_device_props.h │ │ │ ├── scan_filter.cc │ │ │ ├── scan_filter.h │ │ │ ├── scan_result.cc │ │ │ ├── scan_result.h │ │ │ ├── scan_settings.cc │ │ │ ├── scan_settings.h │ │ │ ├── uuid.cc │ │ │ └── uuid.h │ └── bluetooth │ │ ├── a2dp_codec_config.cc │ │ ├── a2dp_codec_config.h │ │ ├── adapter_state.cc │ │ ├── adapter_state.h │ │ ├── advertise_data.cc │ │ ├── advertise_data.h │ │ ├── advertise_settings.cc │ │ ├── advertise_settings.h │ │ ├── avrcp_int_value.cc │ │ ├── avrcp_int_value.h │ │ ├── avrcp_media_attr.cc │ │ ├── avrcp_media_attr.h │ │ ├── avrcp_register_notification_response.cc │ │ ├── avrcp_register_notification_response.h │ │ ├── avrcp_string_value.h │ │ ├── characteristic.cc │ │ ├── characteristic.h │ │ ├── descriptor.cc │ │ ├── descriptor.h │ │ ├── low_energy_constants.h │ │ ├── remote_device_props.cc │ │ ├── remote_device_props.h │ │ ├── scan_filter.cc │ │ ├── scan_filter.h │ │ ├── scan_result.cc │ │ ├── scan_result.h │ │ ├── scan_settings.cc │ │ ├── scan_settings.h │ │ ├── service.cc │ │ ├── service.h │ │ └── util │ │ ├── atomic_string.cc │ │ └── atomic_string.h ├── daemon.cc ├── daemon.h ├── doc │ ├── IBluetooth.txt │ ├── IBluetoothCallback.txt │ ├── IBluetoothGattClient.txt │ ├── IBluetoothGattClientCallback.txt │ ├── IBluetoothGattServer.txt │ ├── IBluetoothGattServerCallback.txt │ ├── IBluetoothLowEnergy.txt │ └── IBluetoothLowEnergyCallback.txt ├── example │ └── heart_rate │ │ ├── constants.h │ │ ├── heart_rate_server.cc │ │ ├── heart_rate_server.h │ │ └── server_main.cc ├── gatt_client.cc ├── gatt_client.h ├── gatt_server.cc ├── gatt_server.h ├── gatt_server_old.cc ├── gatt_server_old.h ├── hal │ ├── bluetooth_av_interface.cc │ ├── bluetooth_av_interface.h │ ├── bluetooth_avrcp_interface.cc │ ├── bluetooth_avrcp_interface.h │ ├── bluetooth_gatt_interface.cc │ ├── bluetooth_gatt_interface.h │ ├── bluetooth_interface.cc │ ├── bluetooth_interface.h │ ├── fake_bluetooth_av_interface.cc │ ├── fake_bluetooth_av_interface.h │ ├── fake_bluetooth_gatt_interface.cc │ ├── fake_bluetooth_gatt_interface.h │ ├── fake_bluetooth_interface.cc │ └── fake_bluetooth_interface.h ├── ipc │ ├── binder │ │ ├── bluetooth_a2dp_sink_binder_server.cc │ │ ├── bluetooth_a2dp_sink_binder_server.h │ │ ├── bluetooth_a2dp_source_binder_server.cc │ │ ├── bluetooth_a2dp_source_binder_server.h │ │ ├── bluetooth_avrcp_control_binder_server.cc │ │ ├── bluetooth_avrcp_control_binder_server.h │ │ ├── bluetooth_avrcp_target_binder_server.cc │ │ ├── bluetooth_avrcp_target_binder_server.h │ │ ├── bluetooth_binder_server.cc │ │ ├── bluetooth_binder_server.h │ │ ├── bluetooth_gatt_client_binder_server.cc │ │ ├── bluetooth_gatt_client_binder_server.h │ │ ├── bluetooth_gatt_server_binder_server.cc │ │ ├── bluetooth_gatt_server_binder_server.h │ │ ├── bluetooth_le_advertiser_binder_server.cc │ │ ├── bluetooth_le_advertiser_binder_server.h │ │ ├── bluetooth_le_scanner_binder_server.cc │ │ ├── bluetooth_le_scanner_binder_server.h │ │ ├── bluetooth_low_energy_binder_server.cc │ │ ├── bluetooth_low_energy_binder_server.h │ │ ├── interface_with_instances_base.cc │ │ ├── interface_with_instances_base.h │ │ ├── ipc_handler_binder.cc │ │ ├── ipc_handler_binder.h │ │ ├── remote_callback_list.h │ │ └── remote_callback_map.h │ ├── dbus │ │ ├── bluetooth_adapter.cc │ │ ├── bluetooth_adapter.h │ │ ├── ipc_handler_dbus.cc │ │ ├── ipc_handler_dbus.h │ │ └── org.fluoride.BluetoothAdapter.xml │ ├── ipc_handler.cc │ ├── ipc_handler.h │ ├── ipc_handler_linux.cc │ ├── ipc_handler_linux.h │ ├── ipc_manager.cc │ ├── ipc_manager.h │ ├── linux_ipc_host.cc │ └── linux_ipc_host.h ├── logging_helpers.cc ├── logging_helpers.h ├── low_energy_advertiser.cc ├── low_energy_advertiser.h ├── low_energy_client.cc ├── low_energy_client.h ├── low_energy_scanner.cc ├── low_energy_scanner.h ├── main.cc ├── settings.cc ├── settings.h ├── switches.h └── test │ ├── ParcelableTest.aidl │ ├── a2dp_sink_unittest.cc │ ├── a2dp_source_unittest.cc │ ├── adapter_unittest.cc │ ├── advertise_data_unittest.cc │ ├── fake_hal_util.cc │ ├── gatt_client_unittest.cc │ ├── gatt_server_unittest.cc │ ├── ipc_linux_unittest.cc │ ├── low_energy_advertiser_unittest.cc │ ├── low_energy_client_unittest.cc │ ├── low_energy_scanner_unittest.cc │ ├── main.cc │ ├── mock_adapter.h │ ├── mock_daemon.h │ ├── parcelable_unittest.cc │ ├── settings_unittest.cc │ └── stub_ipc_handler_binder.cc ├── stack ├── Android.bp ├── BUILD.gn ├── a2dp │ ├── a2dp_aac.cc │ ├── a2dp_aac_decoder.cc │ ├── a2dp_aac_encoder.cc │ ├── a2dp_api.cc │ ├── a2dp_codec_config.cc │ ├── a2dp_int.h │ ├── a2dp_sbc.cc │ ├── a2dp_sbc_decoder.cc │ ├── a2dp_sbc_encoder.cc │ ├── a2dp_sbc_up_sample.cc │ ├── a2dp_vendor.cc │ ├── a2dp_vendor_aptx.cc │ ├── a2dp_vendor_aptx_encoder.cc │ ├── a2dp_vendor_aptx_hd.cc │ ├── a2dp_vendor_aptx_hd_encoder.cc │ ├── a2dp_vendor_ldac.cc │ ├── a2dp_vendor_ldac_abr.cc │ ├── a2dp_vendor_ldac_decoder.cc │ └── a2dp_vendor_ldac_encoder.cc ├── acl │ ├── acl.cc │ ├── acl.h │ ├── ble_acl.cc │ ├── btm_acl.cc │ ├── btm_ble_connection_establishment.cc │ ├── btm_pm.cc │ └── peer_packet_types.h ├── avct │ ├── avct_api.cc │ ├── avct_bcb_act.cc │ ├── avct_ccb.cc │ ├── avct_defs.h │ ├── avct_int.h │ ├── avct_l2c.cc │ ├── avct_l2c_br.cc │ ├── avct_lcb.cc │ └── avct_lcb_act.cc ├── avdt │ ├── avdt_ad.cc │ ├── avdt_api.cc │ ├── avdt_ccb.cc │ ├── avdt_ccb_act.cc │ ├── avdt_defs.h │ ├── avdt_int.h │ ├── avdt_l2c.cc │ ├── avdt_msg.cc │ ├── avdt_scb.cc │ └── avdt_scb_act.cc ├── avrc │ ├── avrc_api.cc │ ├── avrc_bld_ct.cc │ ├── avrc_bld_tg.cc │ ├── avrc_int.h │ ├── avrc_opt.cc │ ├── avrc_pars_ct.cc │ ├── avrc_pars_tg.cc │ ├── avrc_sdp.cc │ └── avrc_utils.cc ├── bnep │ ├── bnep_api.cc │ ├── bnep_int.h │ ├── bnep_main.cc │ └── bnep_utils.cc ├── btm │ ├── ble_advertiser_hci_interface.cc │ ├── ble_advertiser_hci_interface.h │ ├── ble_scanner_hci_interface.cc │ ├── ble_scanner_hci_interface.h │ ├── btm_ble.cc │ ├── btm_ble_addr.cc │ ├── btm_ble_adv_filter.cc │ ├── btm_ble_batchscan.cc │ ├── btm_ble_bgconn.cc │ ├── btm_ble_bgconn.h │ ├── btm_ble_cont_energy.cc │ ├── btm_ble_gap.cc │ ├── btm_ble_int.h │ ├── btm_ble_int_types.h │ ├── btm_ble_multi_adv.cc │ ├── btm_ble_privacy.cc │ ├── btm_client_interface.cc │ ├── btm_dev.cc │ ├── btm_dev.h │ ├── btm_devctl.cc │ ├── btm_inq.cc │ ├── btm_int.h │ ├── btm_int_types.h │ ├── btm_iso.cc │ ├── btm_iso_impl.h │ ├── btm_main.cc │ ├── btm_scn.cc │ ├── btm_scn.h │ ├── btm_sco.cc │ ├── btm_sco.h │ ├── btm_sec.cc │ ├── btm_sec.h │ ├── neighbor_inquiry.h │ └── security_device_record.h ├── btu │ ├── btu_hcif.cc │ └── btu_task.cc ├── crypto_toolbox │ ├── aes.cc │ ├── aes.h │ ├── aes_cmac.cc │ ├── crypto_toolbox.cc │ └── crypto_toolbox.h ├── eatt │ ├── eatt.cc │ ├── eatt.h │ └── eatt_impl.h ├── gap │ ├── gap_ble.cc │ └── gap_conn.cc ├── gatt │ ├── att_protocol.cc │ ├── connection_manager.cc │ ├── connection_manager.h │ ├── gatt_api.cc │ ├── gatt_attr.cc │ ├── gatt_auth.cc │ ├── gatt_cl.cc │ ├── gatt_db.cc │ ├── gatt_int.h │ ├── gatt_main.cc │ ├── gatt_sr.cc │ ├── gatt_sr_hash.cc │ └── gatt_utils.cc ├── hcic │ ├── hciblecmds.cc │ └── hcicmds.cc ├── hid │ ├── hid_conn.h │ ├── hidd_api.cc │ ├── hidd_conn.cc │ ├── hidd_int.h │ ├── hidh_api.cc │ ├── hidh_conn.cc │ └── hidh_int.h ├── include │ ├── a2dp_aac.h │ ├── a2dp_aac_constants.h │ ├── a2dp_aac_decoder.h │ ├── a2dp_aac_encoder.h │ ├── a2dp_api.h │ ├── a2dp_codec_api.h │ ├── a2dp_constants.h │ ├── a2dp_error_codes.h │ ├── a2dp_sbc.h │ ├── a2dp_sbc_constants.h │ ├── a2dp_sbc_decoder.h │ ├── a2dp_sbc_encoder.h │ ├── a2dp_sbc_up_sample.h │ ├── a2dp_vendor.h │ ├── a2dp_vendor_aptx.h │ ├── a2dp_vendor_aptx_constants.h │ ├── a2dp_vendor_aptx_encoder.h │ ├── a2dp_vendor_aptx_hd.h │ ├── a2dp_vendor_aptx_hd_constants.h │ ├── a2dp_vendor_aptx_hd_encoder.h │ ├── a2dp_vendor_ldac.h │ ├── a2dp_vendor_ldac_abr.h │ ├── a2dp_vendor_ldac_constants.h │ ├── a2dp_vendor_ldac_decoder.h │ ├── a2dp_vendor_ldac_encoder.h │ ├── acl_api.h │ ├── acl_api_types.h │ ├── acl_client_callbacks.h │ ├── acl_hci_link_interface.h │ ├── advertise_data_parser.h │ ├── avct_api.h │ ├── avdt_api.h │ ├── avdtc_api.h │ ├── avrc_api.h │ ├── avrc_defs.h │ ├── ble_acl_interface.h │ ├── ble_advertiser.h │ ├── ble_hci_link_interface.h │ ├── bnep_api.h │ ├── bt_types.h │ ├── btm_api.h │ ├── btm_api_types.h │ ├── btm_ble_api.h │ ├── btm_ble_api_types.h │ ├── btm_client_interface.h │ ├── btm_iso_api.h │ ├── btm_iso_api_types.h │ ├── btm_log_history.h │ ├── btm_status.h │ ├── btu.h │ ├── dev_hci_link_interface.h │ ├── gap_api.h │ ├── gatt_api.h │ ├── gattdefs.h │ ├── hci_error_code.h │ ├── hci_evt_length.h │ ├── hcidefs.h │ ├── hcimsgs.h │ ├── hidd_api.h │ ├── hiddefs.h │ ├── hidh_api.h │ ├── inq_hci_link_interface.h │ ├── l2c_api.h │ ├── l2cap_acl_interface.h │ ├── l2cap_controller_interface.h │ ├── l2cap_hci_link_interface.h │ ├── l2cap_security_interface.h │ ├── l2cdefs.h │ ├── ldacBT_bco_for_fluoride.h │ ├── pan_api.h │ ├── port_api.h │ ├── port_ext.h │ ├── profiles_api.h │ ├── rfcdefs.h │ ├── sco_client_callbacks.h │ ├── sco_hci_link_interface.h │ ├── sdp_api.h │ ├── sdpdefs.h │ ├── sec_hci_link_interface.h │ ├── security_client_callbacks.h │ ├── smp_api.h │ ├── smp_api_types.h │ ├── srvc_api.h │ └── stack_metrics_logging.h ├── l2cap │ ├── l2c_api.cc │ ├── l2c_ble.cc │ ├── l2c_csm.cc │ ├── l2c_fcr.cc │ ├── l2c_int.h │ ├── l2c_link.cc │ ├── l2c_main.cc │ └── l2c_utils.cc ├── metrics │ └── stack_metrics_logging.cc ├── pan │ ├── pan_api.cc │ ├── pan_int.h │ ├── pan_main.cc │ └── pan_utils.cc ├── rfcomm │ ├── port_api.cc │ ├── port_int.h │ ├── port_rfc.cc │ ├── port_utils.cc │ ├── rfc_int.h │ ├── rfc_l2cap_if.cc │ ├── rfc_mx_fsm.cc │ ├── rfc_port_fsm.cc │ ├── rfc_port_if.cc │ ├── rfc_ts_frames.cc │ └── rfc_utils.cc ├── sdp │ ├── sdp_api.cc │ ├── sdp_db.cc │ ├── sdp_discovery.cc │ ├── sdp_main.cc │ ├── sdp_server.cc │ ├── sdp_utils.cc │ └── sdpint.h ├── smp │ ├── crypto_toolbox.h │ ├── p_256_curvepara.cc │ ├── p_256_ecc_pp.cc │ ├── p_256_ecc_pp.h │ ├── p_256_multprecision.cc │ ├── p_256_multprecision.h │ ├── smp_act.cc │ ├── smp_api.cc │ ├── smp_br_main.cc │ ├── smp_int.h │ ├── smp_keys.cc │ ├── smp_l2c.cc │ ├── smp_main.cc │ └── smp_utils.cc ├── srvc │ ├── srvc_dis.cc │ ├── srvc_dis_int.h │ ├── srvc_eng.cc │ └── srvc_eng_int.h └── test │ ├── a2dp │ ├── a2dp_vendor_ldac_decoder_test.cc │ └── misc_fake.cc │ ├── ad_parser_unittest.cc │ ├── ble_advertiser_test.cc │ ├── btm │ ├── peer_packet_types_test.cc │ └── stack_btm_test.cc │ ├── btm_iso_test.cc │ ├── common │ ├── mock_acl.cc │ ├── mock_bta_dm_act.cc │ ├── mock_bta_sys_conn.cc │ ├── mock_btif_dm.cc │ ├── mock_btif_storage.cc │ ├── mock_btif_storage.h │ ├── mock_btm_api_layer.cc │ ├── mock_btm_api_layer.h │ ├── mock_btm_layer.cc │ ├── mock_btm_layer.h │ ├── mock_btsnoop_module.cc │ ├── mock_btu_layer.cc │ ├── mock_controller.cc │ ├── mock_controller.h │ ├── mock_eatt.cc │ ├── mock_eatt.h │ ├── mock_gap_gap_ble.cc │ ├── mock_gatt_connection_manager.cc │ ├── mock_gatt_layer.cc │ ├── mock_gatt_layer.h │ ├── mock_gatt_main.cc │ ├── mock_hci_packet_parser.cc │ ├── mock_hcic_layer.cc │ ├── mock_hcic_layer.h │ ├── mock_l2cap_layer.cc │ ├── mock_l2cap_layer.h │ ├── mock_main_bte_main.cc │ ├── mock_main_shim.cc │ ├── mock_main_shim_btm_api.cc │ ├── mock_main_shim_controller.cc │ ├── mock_main_shim_l2c_api.cc │ ├── mock_main_shim_link_policy.cc │ ├── mock_smp_smp_act.cc │ ├── mock_smp_smp_api.cc │ ├── mock_stack_avdt_msg.cc │ ├── mock_stack_avdt_msg.h │ ├── mock_stack_l2cap_link.cc │ ├── stack_test_packet_utils.cc │ └── stack_test_packet_utils.h │ ├── crypto_toolbox_test.cc │ ├── eatt │ └── eatt_test.cc │ ├── fuzzers │ ├── Android.bp │ ├── a2dp │ │ ├── Android.bp │ │ ├── a2dpFuzzFunctions.h │ │ ├── a2dpFuzzHelpers.h │ │ ├── codec │ │ │ ├── Android.bp │ │ │ ├── a2dpCodecConfigFuzzFunctions.h │ │ │ ├── a2dpCodecConfigFuzzHelpers.h │ │ │ ├── a2dpCodecFuzzFunctions.h │ │ │ ├── a2dpCodecFuzzHelpers.h │ │ │ ├── a2dpCodecHelperFunctions.h │ │ │ ├── a2dpCodecInfoFuzzFunctions.h │ │ │ ├── a2dpCodecInfoFuzzHelpers.h │ │ │ ├── fuzz_a2dp_codec.cc │ │ │ ├── fuzz_a2dp_codec_config.cc │ │ │ └── fuzz_a2dp_codec_info.cc │ │ └── fuzz_a2dp.cc │ ├── common │ │ └── commonFuzzHelpers.h │ └── sdp │ │ ├── Android.bp │ │ ├── fuzz_sdp.cc │ │ ├── sdpFuzzFunctions.h │ │ └── sdpFuzzHelpers.h │ ├── gatt │ ├── gatt_sr_test.cc │ ├── mock_gatt_utils_ref.cc │ └── stack_gatt_test.cc │ ├── gatt_connection_manager_test.cc │ ├── hci │ └── stack_hci_test.cc │ ├── hid │ └── stack_hid_test.cc │ ├── rfcomm │ ├── stack_rfcomm_test.cc │ ├── stack_rfcomm_test_main.cc │ ├── stack_rfcomm_test_utils.cc │ ├── stack_rfcomm_test_utils.h │ └── stack_rfcomm_test_utils_test.cc │ ├── stack_a2dp_test.cc │ ├── stack_avdtp_test.cc │ ├── stack_avrcp_test.cc │ ├── stack_btu_test.cc │ ├── stack_gatt_sr_hash_test.cc │ └── stack_smp_test.cc ├── test ├── Android.bp ├── README.md ├── common │ ├── main_handler.cc │ └── main_handler.h ├── gen_coverage.py ├── headless │ ├── Android.bp │ ├── README.md │ ├── connect │ │ ├── connect.cc │ │ └── connect.h │ ├── dumpsys │ │ ├── dumpsys.cc │ │ └── dumpsys.h │ ├── get_options.cc │ ├── get_options.h │ ├── headless.cc │ ├── headless.h │ ├── interface.h │ ├── main.cc │ ├── nop │ │ ├── nop.cc │ │ └── nop.h │ ├── pairing │ │ ├── pairing.cc │ │ └── pairing.h │ ├── read │ │ ├── name.cc │ │ ├── name.h │ │ ├── read.cc │ │ └── read.h │ └── sdp │ │ ├── sdp.cc │ │ ├── sdp.h │ │ ├── sdp_db.cc │ │ └── sdp_db.h ├── mock │ ├── mock_a2dp_api.cc │ ├── mock_a2dp_codec_config.cc │ ├── mock_activity_attribution.cc │ ├── mock_android_hardware_audio.cc │ ├── mock_bta_ag_api.cc │ ├── mock_bta_ar.cc │ ├── mock_bta_av_api.cc │ ├── mock_bta_av_ci.cc │ ├── mock_bta_av_main.cc │ ├── mock_bta_dm_act.cc │ ├── mock_bta_dm_api.cc │ ├── mock_bta_gattc_api.cc │ ├── mock_bta_gatts_api.cc │ ├── mock_bta_hd_api.cc │ ├── mock_bta_hearing_aid.cc │ ├── mock_bta_hf_client_api.cc │ ├── mock_bta_hh_api.cc │ ├── mock_bta_jv_api.cc │ ├── mock_bta_pan_api.cc │ ├── mock_bta_pan_ci.cc │ ├── mock_bta_sdp_api.cc │ ├── mock_bta_sys_conn.cc │ ├── mock_bta_sys_main.cc │ ├── mock_bta_sys_utl.cc │ ├── mock_bta_vc.cc │ ├── mock_bta_vc_device.cc │ ├── mock_btcore_module.cc │ ├── mock_btif_bqr.cc │ ├── mock_btif_co_bta_dm_co.cc │ ├── mock_btif_co_bta_hh_co.cc │ ├── mock_btif_config.cc │ ├── mock_btif_config.h │ ├── mock_btif_core.cc │ ├── mock_btif_debug_conn.cc │ ├── mock_btif_dm.cc │ ├── mock_btif_stack_manager.cc │ ├── mock_btif_storage.cc │ ├── mock_common_address_obfuscator.cc │ ├── mock_common_message_loop_thread.cc │ ├── mock_common_metric_id_allocator.cc │ ├── mock_common_metrics.cc │ ├── mock_common_repeating_timer.cc │ ├── mock_common_stop_watch_legacy.cc │ ├── mock_common_time_util.cc │ ├── mock_device_controller.cc │ ├── mock_device_controller.h │ ├── mock_device_interop.cc │ ├── mock_frameworks_libaudio.cc │ ├── mock_hci_btsnoop_mem.cc │ ├── mock_hci_layer.cc │ ├── mock_hci_layer.h │ ├── mock_hci_packet_factory.cc │ ├── mock_hci_packet_parser.cc │ ├── mock_hcic_hciblecmds.cc │ ├── mock_hcic_hcicmds.cc │ ├── mock_hcic_hcicmds.h │ ├── mock_main_bte.cc │ ├── mock_main_bte.h │ ├── mock_main_shim.cc │ ├── mock_main_shim_BtifConfigInterface.cc │ ├── mock_main_shim_acl.cc │ ├── mock_main_shim_acl_api.cc │ ├── mock_main_shim_activity_attribution.cc │ ├── mock_main_shim_btm_api.cc │ ├── mock_main_shim_controller.cc │ ├── mock_main_shim_dumpsys.cc │ ├── mock_main_shim_entry.cc │ ├── mock_main_shim_entry.h │ ├── mock_main_shim_l2cap_api.cc │ ├── mock_main_shim_l2cap_api.h │ ├── mock_main_shim_le_advertising_manager.cc │ ├── mock_main_shim_le_scanning_manager.cc │ ├── mock_main_shim_link_policy.cc │ ├── mock_main_shim_link_policy.h │ ├── mock_main_shim_metric_id_api.cc │ ├── mock_main_shim_metrics_api.cc │ ├── mock_main_shim_metrics_api.h │ ├── mock_stack_a2dp_api.cc │ ├── mock_stack_a2dp_codec_config.cc │ ├── mock_stack_acl.cc │ ├── mock_stack_acl_ble.cc │ ├── mock_stack_acl_btm_ble_connection_establishment.cc │ ├── mock_stack_acl_btm_ble_connection_establishment.h │ ├── mock_stack_acl_btm_pm.cc │ ├── mock_stack_avct_api.cc │ ├── mock_stack_avdt_api.cc │ ├── mock_stack_avrc_api.cc │ ├── mock_stack_avrc_bld_ct.cc │ ├── mock_stack_avrc_bld_tg.cc │ ├── mock_stack_avrc_pars.ct.cc │ ├── mock_stack_avrc_pars_tg.cc │ ├── mock_stack_avrc_sdp.cc │ ├── mock_stack_bnep_api.cc │ ├── mock_stack_btm.cc │ ├── mock_stack_btm_ble.cc │ ├── mock_stack_btm_ble_addr.cc │ ├── mock_stack_btm_ble_addr.h │ ├── mock_stack_btm_ble_adv_filter.cc │ ├── mock_stack_btm_ble_advertiser_hci_interface.cc │ ├── mock_stack_btm_ble_advertiser_hci_interface.h │ ├── mock_stack_btm_ble_batchscan.cc │ ├── mock_stack_btm_ble_bgconn.cc │ ├── mock_stack_btm_ble_bgconn.h │ ├── mock_stack_btm_ble_gap.cc │ ├── mock_stack_btm_ble_multi_adv.cc │ ├── mock_stack_btm_ble_privacy.cc │ ├── mock_stack_btm_ble_privacy.h │ ├── mock_stack_btm_ble_scanner_hci_interface.cc │ ├── mock_stack_btm_ble_scanner_hci_interface.h │ ├── mock_stack_btm_dev.cc │ ├── mock_stack_btm_devctl.cc │ ├── mock_stack_btm_inq.cc │ ├── mock_stack_btm_iso.cc │ ├── mock_stack_btm_main.cc │ ├── mock_stack_btm_scn.cc │ ├── mock_stack_btm_sco.cc │ ├── mock_stack_btm_sec.cc │ ├── mock_stack_btu_hcif.cc │ ├── mock_stack_btu_task.cc │ ├── mock_stack_crypto_toolbox.cc │ ├── mock_stack_crypto_toolbox.h │ ├── mock_stack_crypto_toolbox_aes_cmac.cc │ ├── mock_stack_gap_ble.cc │ ├── mock_stack_gap_conn.cc │ ├── mock_stack_gatt.cc │ ├── mock_stack_gatt_attr.cc │ ├── mock_stack_gatt_auth.cc │ ├── mock_stack_gatt_connection_manager.cc │ ├── mock_stack_gatt_main.cc │ ├── mock_stack_hidd_api.cc │ ├── mock_stack_hidh.cc │ ├── mock_stack_l2cap_api.cc │ ├── mock_stack_l2cap_api.h │ ├── mock_stack_l2cap_ble.cc │ ├── mock_stack_l2cap_ble.h │ ├── mock_stack_l2cap_link.cc │ ├── mock_stack_l2cap_main.cc │ ├── mock_stack_l2cap_utils.cc │ ├── mock_stack_metrics_logging.cc │ ├── mock_stack_metrics_logging.h │ ├── mock_stack_pan_api.cc │ ├── mock_stack_rfcomm_port_api.cc │ ├── mock_stack_sdp.cc │ ├── mock_stack_sdp_db.cc │ ├── mock_stack_sdp_main.cc │ ├── mock_stack_smp_act.cc │ ├── mock_stack_smp_act.h │ ├── mock_stack_smp_api.cc │ ├── mock_stack_srvc_dis.cc │ ├── mock_system_libfmq_eventflag.cc │ └── mock_udrv_ulinux_uipc.cc ├── rootcanal │ ├── Android.bp │ ├── android.hardware.bluetooth@1.1-service.sim.rc │ ├── bluetooth_hci.cc │ ├── bluetooth_hci.h │ └── service.cc ├── run_benchmarks.sh ├── run_host_unit_tests.py ├── run_unit_tests.sh ├── stub │ ├── legacy_trace.cc │ └── osi.cc └── suite │ ├── Android.bp │ ├── BUILD.gn │ ├── adapter │ ├── adapter_unittest.cc │ ├── bluetooth_test.cc │ └── bluetooth_test.h │ ├── gatt │ ├── gatt_test.cc │ ├── gatt_test.h │ └── gatt_unittest.cc │ └── rfcomm │ ├── rfcomm_test.cc │ ├── rfcomm_test.h │ └── rfcomm_unittest.cc ├── tools ├── Android.mk.disabled ├── bdtool │ ├── Android.mk.disabled │ ├── adapter.c │ └── bdtool.c ├── hci │ ├── Android.mk.disabled │ └── main.c └── scripts │ ├── btsnoop_live.py │ ├── btsnooz.py │ ├── change_types.sh │ ├── dump_hearingaid_audio.py │ ├── dump_metrics_ascii.py │ ├── viewbtsnoop.sh │ └── yapf_checker.py ├── types ├── Android.bp ├── BUILD.gn ├── ble_address_with_type.h ├── bluetooth │ ├── uuid.cc │ └── uuid.h ├── bt_transport.h ├── class_of_device.cc ├── class_of_device.h ├── hci_role.h ├── raw_address.cc ├── raw_address.h └── test │ ├── bluetooth │ └── uuid_unittest.cc │ ├── class_of_device_unittest.cc │ └── raw_address_unittest.cc ├── udrv ├── Android.bp ├── BUILD.gn ├── include │ └── uipc.h └── ulinux │ └── uipc.cc ├── utils ├── Android.bp ├── BUILD.gn ├── include │ └── bt_utils.h └── src │ └── bt_utils.cc ├── vendor_libs ├── Android.bp ├── linux │ ├── Android.bp │ └── interface │ │ ├── Android.bp │ │ ├── android.hardware.bluetooth@1.1-service.btlinux.rc │ │ ├── async_fd_watcher.cc │ │ ├── async_fd_watcher.h │ │ ├── bluetooth_hci.cc │ │ ├── bluetooth_hci.h │ │ ├── h4_protocol.cc │ │ ├── h4_protocol.h │ │ ├── hci_internals.h │ │ ├── hci_packetizer.cc │ │ ├── hci_packetizer.h │ │ └── service.cc └── test_vendor_lib │ ├── Android.bp │ ├── data │ ├── Android.bp │ └── controller_properties.json │ ├── desktop │ ├── root_canal_main.cc │ ├── test_environment.cc │ └── test_environment.h │ ├── include │ ├── inquiry.h │ ├── le_advertisement.h │ ├── phy.h │ └── sco.h │ ├── model │ ├── controller │ │ ├── acl_connection.cc │ │ ├── acl_connection.h │ │ ├── acl_connection_handler.cc │ │ ├── acl_connection_handler.h │ │ ├── connected_isochronous_group.h │ │ ├── connected_isochronous_stream.h │ │ ├── dual_mode_controller.cc │ │ ├── dual_mode_controller.h │ │ ├── isochronous_connection_handler.cc │ │ ├── isochronous_connection_handler.h │ │ ├── le_advertiser.cc │ │ ├── le_advertiser.h │ │ ├── link_layer_controller.cc │ │ ├── link_layer_controller.h │ │ ├── security_manager.cc │ │ └── security_manager.h │ ├── devices │ │ ├── beacon.cc │ │ ├── beacon.h │ │ ├── beacon_swarm.cc │ │ ├── beacon_swarm.h │ │ ├── broken_adv.cc │ │ ├── broken_adv.h │ │ ├── car_kit.cc │ │ ├── car_kit.h │ │ ├── classic.cc │ │ ├── classic.h │ │ ├── device.cc │ │ ├── device.h │ │ ├── device_properties.cc │ │ ├── device_properties.h │ │ ├── h4_packetizer.cc │ │ ├── h4_packetizer.h │ │ ├── h4_parser.cc │ │ ├── h4_parser.h │ │ ├── hci_protocol.cc │ │ ├── hci_protocol.h │ │ ├── hci_socket_device.cc │ │ ├── hci_socket_device.h │ │ ├── keyboard.cc │ │ ├── keyboard.h │ │ ├── link_layer_socket_device.cc │ │ ├── link_layer_socket_device.h │ │ ├── loopback.cc │ │ ├── loopback.h │ │ ├── polled_socket.cc │ │ ├── polled_socket.h │ │ ├── remote_loopback_device.cc │ │ ├── remote_loopback_device.h │ │ ├── scripted_beacon.cc │ │ ├── scripted_beacon.h │ │ ├── scripted_beacon_ble_payload.proto │ │ ├── server_port_factory.cc │ │ ├── server_port_factory.h │ │ ├── sniffer.cc │ │ └── sniffer.h │ └── setup │ │ ├── async_manager.cc │ │ ├── async_manager.h │ │ ├── device_boutique.cc │ │ ├── device_boutique.h │ │ ├── phy_layer.h │ │ ├── phy_layer_factory.cc │ │ ├── phy_layer_factory.h │ │ ├── test_channel_transport.cc │ │ ├── test_channel_transport.h │ │ ├── test_command_handler.cc │ │ ├── test_command_handler.h │ │ ├── test_model.cc │ │ └── test_model.h │ ├── packets │ └── link_layer_packets.pdl │ ├── scripts │ ├── build_and_run.sh │ ├── hci_socket.py │ ├── link_layer_socket.py │ ├── scripted_beacon_test │ │ ├── Readme.txt │ │ ├── add_beacons │ │ ├── grant_permission.pb │ │ ├── no_permission.pb │ │ ├── run_test.sh │ │ ├── start_scan │ │ └── test_events.pb │ ├── send_simple_commands.py │ ├── simple_link_layer_socket.py │ ├── simple_stack.py │ └── test_channel.py │ ├── test │ ├── async_manager_unittest.cc │ ├── h4_parser_unittest.cc │ ├── iterator_test.cc │ ├── l2cap_sdu_test.cc │ ├── l2cap_test.cc │ ├── link_layer_socket_device_test.cc │ ├── packet_stream_unittest.cc │ ├── polled_socket_test.cc │ └── security_manager_unittest.cc │ └── types │ ├── Android.bp │ ├── BUILD.gn │ ├── bluetooth │ ├── uuid.cc │ └── uuid.h │ └── test │ └── bluetooth │ └── uuid_unittest.cc └── vnd ├── ble └── vendor_hcidefs.h └── include └── vendor_api.h /.clang-format: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2016 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | # 18 | # Below are some minor deviations from the default Google style to 19 | # accommodate for handling of the large legacy code base. 20 | # 21 | 22 | BasedOnStyle: Google 23 | CommentPragmas: NOLINT:.* 24 | DerivePointerAlignment: false 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | buildtools 2 | out 3 | third_party/ 4 | target/ 5 | Cargo.lock 6 | tags 7 | -------------------------------------------------------------------------------- /.style.yapf: -------------------------------------------------------------------------------- 1 | [style] 2 | # http://google.github.io/styleguide/pyguide.html 3 | based_on_style: google 4 | indent_width: 4 5 | column_limit: 120 6 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Google, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at: 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | [workspace] 17 | 18 | members = [ 19 | "gd/rust/shim", 20 | "gd/rust/topshim", 21 | "gd/rust/linux/mgmt", 22 | "gd/rust/linux/adapter", 23 | "gd/rust/linux/service", 24 | ] 25 | -------------------------------------------------------------------------------- /METADATA: -------------------------------------------------------------------------------- 1 | third_party { 2 | license_type: NOTICE 3 | } 4 | -------------------------------------------------------------------------------- /MODULE_LICENSE_APACHE2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LineageOS/android_system_bt/edc95ad08dc40d56a6ac00f4da98ca918ed04f9e/MODULE_LICENSE_APACHE2 -------------------------------------------------------------------------------- /OWNERS: -------------------------------------------------------------------------------- 1 | set noparent 2 | 3 | # Project owners 4 | zachoverflow@google.com 5 | cmanton@google.com 6 | cncn@google.com 7 | hsz@google.com 8 | jpawlowski@google.com 9 | mylesgw@google.com 10 | optedoblivion@google.com 11 | qasimj@google.com 12 | rahulsabnis@google.com 13 | siyuanh@google.com 14 | -------------------------------------------------------------------------------- /PREUPLOAD.cfg: -------------------------------------------------------------------------------- 1 | [Options] 2 | ignore_merged_commits = true 3 | 4 | [Builtin Hooks] 5 | clang_format = true 6 | rustfmt = true 7 | 8 | [Builtin Hooks Options] 9 | rustfmt = --config-path=rustfmt.toml 10 | 11 | [Hook Scripts] 12 | aosp_first = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} ".*$" 13 | yapf_hook = ./tools/scripts/yapf_checker.py 14 | -------------------------------------------------------------------------------- /apex/apex_manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.android.bluetooth.updatable", 3 | "version": 2 4 | } 5 | -------------------------------------------------------------------------------- /apex/com.android.bluetooth.updatable.avbpubkey: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LineageOS/android_system_bt/edc95ad08dc40d56a6ac00f4da98ca918ed04f9e/apex/com.android.bluetooth.updatable.avbpubkey -------------------------------------------------------------------------------- /apex/com.android.bluetooth.updatable.pk8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LineageOS/android_system_bt/edc95ad08dc40d56a6ac00f4da98ca918ed04f9e/apex/com.android.bluetooth.updatable.pk8 -------------------------------------------------------------------------------- /binder/android/bluetooth/BluetoothActivityEnergyInfo.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable BluetoothActivityEnergyInfo; 20 | -------------------------------------------------------------------------------- /binder/android/bluetooth/BluetoothAudioConfig.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable BluetoothAudioConfig; 20 | -------------------------------------------------------------------------------- /binder/android/bluetooth/BluetoothAvrcpPlayerSettings.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable BluetoothAvrcpPlayerSettings; 20 | -------------------------------------------------------------------------------- /binder/android/bluetooth/BluetoothClass.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017, The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable BluetoothClass; 20 | -------------------------------------------------------------------------------- /binder/android/bluetooth/BluetoothCodecConfig.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable BluetoothCodecConfig; 20 | -------------------------------------------------------------------------------- /binder/android/bluetooth/BluetoothCodecStatus.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable BluetoothCodecStatus; 20 | -------------------------------------------------------------------------------- /binder/android/bluetooth/BluetoothDevice.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable BluetoothDevice cpp_header "android/bluetooth/bluetooth_device.h"; 20 | -------------------------------------------------------------------------------- /binder/android/bluetooth/BluetoothGattCharacteristic.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable BluetoothGattCharacteristic; 20 | -------------------------------------------------------------------------------- /binder/android/bluetooth/BluetoothGattDescriptor.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable BluetoothGattDescriptor; 20 | -------------------------------------------------------------------------------- /binder/android/bluetooth/BluetoothGattIncludedService.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable BluetoothGattIncludedService; 20 | -------------------------------------------------------------------------------- /binder/android/bluetooth/BluetoothGattService.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable BluetoothGattService; 20 | -------------------------------------------------------------------------------- /binder/android/bluetooth/BluetoothHeadsetClientCall.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package android.bluetooth; 17 | 18 | parcelable BluetoothHeadsetClientCall; 19 | -------------------------------------------------------------------------------- /binder/android/bluetooth/BluetoothHidDeviceAppQosSettings.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2016, The Android Open Source Project 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable BluetoothHidDeviceAppQosSettings; 20 | -------------------------------------------------------------------------------- /binder/android/bluetooth/BluetoothHidDeviceAppSdpSettings.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2016, The Android Open Source Project 3 | ** 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); 5 | ** you may not use this file except in compliance with the License. 6 | ** You may obtain a copy of the License at 7 | ** 8 | ** http://www.apache.org/licenses/LICENSE-2.0 9 | ** 10 | ** Unless required by applicable law or agreed to in writing, software 11 | ** distributed under the License is distributed on an "AS IS" BASIS, 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ** See the License for the specific language governing permissions and 14 | ** limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable BluetoothHidDeviceAppSdpSettings; 20 | -------------------------------------------------------------------------------- /binder/android/bluetooth/BufferConstraints.aidl: -------------------------------------------------------------------------------- 1 | package android.bluetooth; 2 | 3 | parcelable BufferConstraints; 4 | -------------------------------------------------------------------------------- /binder/android/bluetooth/IBluetoothCallback.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009, The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | /** 20 | * System private API for Bluetooth service callbacks. 21 | * 22 | * {@hide} 23 | */ 24 | interface IBluetoothCallback 25 | { 26 | //void onRfcommChannelFound(int channel); 27 | void onBluetoothStateChange(int prevState, int newState); 28 | } 29 | -------------------------------------------------------------------------------- /binder/android/bluetooth/IBluetoothStateChangeCallback.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011, The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | /** 20 | * System private API for Bluetooth state change callback. 21 | * 22 | * {@hide} 23 | */ 24 | oneway interface IBluetoothStateChangeCallback 25 | { 26 | void onBluetoothStateChange(boolean on); 27 | } 28 | -------------------------------------------------------------------------------- /binder/android/bluetooth/OobData.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable OobData; 20 | -------------------------------------------------------------------------------- /binder/android/bluetooth/le/AdvertiseData.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth.le; 18 | 19 | parcelable AdvertiseData; 20 | -------------------------------------------------------------------------------- /binder/android/bluetooth/le/AdvertiseSettings.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth.le; 18 | 19 | parcelable AdvertiseSettings; -------------------------------------------------------------------------------- /binder/android/bluetooth/le/AdvertisingSetParameters.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth.le; 18 | 19 | parcelable AdvertisingSetParameters; 20 | -------------------------------------------------------------------------------- /binder/android/bluetooth/le/PeriodicAdvertisingParameters.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth.le; 18 | 19 | parcelable PeriodicAdvertisingParameters; 20 | -------------------------------------------------------------------------------- /binder/android/bluetooth/le/PeriodicAdvertisingReport.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth.le; 18 | 19 | parcelable PeriodicAdvertisingReport; 20 | -------------------------------------------------------------------------------- /binder/android/bluetooth/le/ResultStorageDescriptor.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth.le; 18 | 19 | /** 20 | * {@hide} 21 | */ 22 | 23 | parcelable ResultStorageDescriptor; 24 | -------------------------------------------------------------------------------- /binder/android/bluetooth/le/ScanFilter.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth.le; 18 | 19 | parcelable ScanFilter; 20 | -------------------------------------------------------------------------------- /binder/android/bluetooth/le/ScanResult.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth.le; 18 | 19 | parcelable ScanResult; -------------------------------------------------------------------------------- /binder/android/bluetooth/le/ScanSettings.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth.le; 18 | 19 | parcelable ScanSettings; 20 | -------------------------------------------------------------------------------- /bta/test/common/fake_osi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include "osi/include/alarm.h" 21 | 22 | struct fake_osi_alarm_set_on_mloop { 23 | uint64_t interval_ms{0}; 24 | alarm_callback_t cb{}; 25 | void* data{nullptr}; 26 | }; 27 | -------------------------------------------------------------------------------- /btcore/include/hal_util.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2015 Google, Inc. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at: 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | // Loads the Bluetooth library. This function looks explicitly for 22 | // libbluetooth.so and loads it. 23 | int hal_util_load_bt_library(const bt_interface_t** interface); 24 | -------------------------------------------------------------------------------- /btcore/include/osi_module.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright 2015 Google, Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | ******************************************************************************/ 18 | 19 | #pragma once 20 | 21 | static const char OSI_MODULE[] = "osi_module"; 22 | -------------------------------------------------------------------------------- /btif/include/btif_acl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | void BTIF_dm_report_inquiry_status_change(uint8_t busy_level_flags); 22 | -------------------------------------------------------------------------------- /btif/include/btif_activity_attribution.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | namespace bluetooth { 20 | namespace activity_attribution { 21 | 22 | ActivityAttributionInterface* get_activity_attribution_instance(); 23 | 24 | } 25 | } // namespace bluetooth 26 | -------------------------------------------------------------------------------- /btif/include/btif_config_transcode.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright 2014 Google, Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | ******************************************************************************/ 18 | 19 | #pragma once 20 | 21 | #include "osi/include/config.h" 22 | 23 | std::unique_ptr btif_config_transcode(const char* xml_filename); 24 | -------------------------------------------------------------------------------- /btif/include/btif_debug.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright 2015 Google Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | ******************************************************************************/ 18 | 19 | #pragma once 20 | 21 | #include 22 | 23 | // Debug API 24 | 25 | void btif_debug_init(void); 26 | -------------------------------------------------------------------------------- /btif/include/btif_keystore.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | namespace bluetooth { 20 | namespace bluetooth_keystore { 21 | 22 | BluetoothKeystoreInterface* getBluetoothKeystoreInterface(); 23 | 24 | } // namespace bluetooth_keystore 25 | } // namespace bluetooth -------------------------------------------------------------------------------- /btif/include/btif_sock_l2cap.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * L2CAP Socket Interface 3 | ******************************************************************************/ 4 | 5 | #ifndef BTIF_SOCK_L2CAP_H 6 | #define BTIF_SOCK_L2CAP_H 7 | 8 | #include "btif_uid.h" 9 | 10 | #include 11 | 12 | bt_status_t btsock_l2cap_init(int handle, uid_set_t* set); 13 | bt_status_t btsock_l2cap_cleanup(); 14 | bt_status_t btsock_l2cap_listen(const char* name, int channel, int* sock_fd, 15 | int flags, int app_uid); 16 | bt_status_t btsock_l2cap_connect(const RawAddress* bd_addr, int channel, 17 | int* sock_fd, int flags, int app_uid); 18 | void btsock_l2cap_signaled(int fd, int flags, uint32_t user_id); 19 | void on_l2cap_psm_assigned(int id, int psm); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /build/dpkg/README.txt: -------------------------------------------------------------------------------- 1 | This directory contains scripts to build Debian packages as dependencies for 2 | building Fluoride on Linux. 3 | 4 | To generate the Debian packages, you need: 5 | 6 | * Debian 10 (Buster) 7 | * gn, get binary from https://chrome-infra-packages.appspot.com/dl/gn/gn/linux-amd64/+/latest 8 | * apt-get install git debmake 9 | * Other build dependencies are package dependent, you will get error message 10 | mentioning the list of missing packages 11 | 12 | Steps to build debian packages (modp_b64 first): 13 | ``` 14 | $ cd build/dpkg/modp_b64 15 | $ ./gen-src-pkg /tmp/modp_b64 16 | ``` 17 | 18 | If the above succeeded, there will be a .deb file in /tmp/modp_b64. You can 19 | install this binary package locally like: 20 | ``` 21 | $ sudo dpkg -i /tmp/modp_b64/modp-b64_0.0.1-1_amd64.deb 22 | ``` 23 | 24 | After installing modp_b64, you can do the same steps with libchrome in 25 | build/dpkg/libchrome. 26 | -------------------------------------------------------------------------------- /build/dpkg/libchrome-822064/debian/README.Debian: -------------------------------------------------------------------------------- 1 | libchrome for Debian 2 | -------------------------------------------------------------------------------- /build/dpkg/libchrome-822064/debian/changelog: -------------------------------------------------------------------------------- 1 | libchrome (822064-1) buster; urgency=low 2 | 3 | * Initial release. 4 | 5 | -- Sonny Sasaka Fri, 30 Apr 2021 19:41:40 +0000 6 | -------------------------------------------------------------------------------- /build/dpkg/libchrome-822064/debian/compat: -------------------------------------------------------------------------------- 1 | 10 2 | -------------------------------------------------------------------------------- /build/dpkg/libchrome-822064/debian/control: -------------------------------------------------------------------------------- 1 | Source: libchrome 2 | Section: libs 3 | Priority: optional 4 | Maintainer: Sonny Sasaka 5 | Standards-Version: 4.1.4 6 | Homepage: https://chromium.googlesource.com/aosp/platform/external/libchrome/ 7 | Build-Depends: 8 | debhelper (>=11~), 9 | clang, 10 | python3, 11 | pkg-config, 12 | ninja-build, 13 | libglib2.0-dev, 14 | libevent-dev, 15 | libnss3-dev, 16 | libdbus-1-dev, 17 | libprotobuf-dev, 18 | googletest, 19 | libre2-dev, 20 | libdouble-conversion-dev, 21 | libssl-dev, 22 | libabsl-dev 23 | 24 | Package: libchrome 25 | Architecture: any 26 | Multi-Arch: foreign 27 | Depends: ${misc:Depends}, ${shlibs:Depends} 28 | Description: Chromium's base library 29 | -------------------------------------------------------------------------------- /build/dpkg/libchrome-822064/debian/libchrome.install: -------------------------------------------------------------------------------- 1 | out/Release/lib/libbase*.so /usr/lib 2 | out/Release/libbase*.a /usr/lib 3 | out/Release/obj/libchrome/libchrome*.pc /usr/lib/pkgconfig 4 | usr/include /usr 5 | -------------------------------------------------------------------------------- /build/dpkg/libchrome-822064/debian/patches/0001-Remove-absl-from-pkgconfig.patch: -------------------------------------------------------------------------------- 1 | From 9c93da57cc206ce3d301786b7ef733197ee92939 Mon Sep 17 00:00:00 2001 2 | From: Sonny Sasaka 3 | Date: Fri, 30 Apr 2021 17:49:14 -0700 4 | Subject: [PATCH] Remove absl from pkgconfig 5 | 6 | Change-Id: Ia54bb1c58056b1d7adab668e77ef98ffb15f41c6 7 | --- 8 | BUILD.gn | 2 -- 9 | 1 file changed, 2 deletions(-) 10 | 11 | diff --git a/libchrome/BUILD.gn b/libchrome/BUILD.gn 12 | index 402ed4c725..7778aa0163 100644 13 | --- a/libchrome/BUILD.gn 14 | +++ b/libchrome/BUILD.gn 15 | @@ -90,7 +90,6 @@ libbase_sublibs = [ 16 | "modp_b64", 17 | ] 18 | pkg_deps = [ 19 | - "absl", 20 | "glib-2.0", 21 | "libevent", 22 | ] 23 | @@ -460,7 +459,6 @@ if (use.dbus) { 24 | name = "base-dbus" 25 | deps = [ ":base-core" ] 26 | pkg_deps = [ 27 | - "absl", 28 | "dbus-1", 29 | ] 30 | if (use.fuzzer) { 31 | -- 32 | 2.31.0 33 | 34 | -------------------------------------------------------------------------------- /build/dpkg/libchrome-822064/debian/patches/series: -------------------------------------------------------------------------------- 1 | 0001-Add-missing-includes.patch 2 | 0001-rebase_path-for-write_args.patch 3 | 0001-Remove-absl-from-pkgconfig.patch 4 | -------------------------------------------------------------------------------- /build/dpkg/libchrome/debian/README.Debian: -------------------------------------------------------------------------------- 1 | libchrome for Debian 2 | -------------------------------------------------------------------------------- /build/dpkg/libchrome/debian/changelog: -------------------------------------------------------------------------------- 1 | libchrome (780652-1) buster; urgency=low 2 | 3 | * Initial release. 4 | 5 | -- Sonny Sasaka Fri, 19 Mar 2021 19:41:40 +0000 6 | -------------------------------------------------------------------------------- /build/dpkg/libchrome/debian/compat: -------------------------------------------------------------------------------- 1 | 10 2 | -------------------------------------------------------------------------------- /build/dpkg/libchrome/debian/control: -------------------------------------------------------------------------------- 1 | Source: libchrome 2 | Section: libs 3 | Priority: optional 4 | Maintainer: Sonny Sasaka 5 | Standards-Version: 4.1.4 6 | Homepage: https://chromium.googlesource.com/aosp/platform/external/libchrome/ 7 | Build-Depends: 8 | debhelper (>=11~), 9 | clang, 10 | python3, 11 | pkg-config, 12 | ninja-build, 13 | libglib2.0-dev, 14 | libevent-dev, 15 | libnss3-dev, 16 | libdbus-1-dev, 17 | libprotobuf-dev, 18 | googletest, 19 | libre2-dev, 20 | libdouble-conversion-dev, 21 | libssl-dev 22 | 23 | Package: libchrome 24 | Architecture: any 25 | Multi-Arch: foreign 26 | Depends: ${misc:Depends}, ${shlibs:Depends} 27 | Description: Chromium's base library 28 | -------------------------------------------------------------------------------- /build/dpkg/libchrome/debian/libchrome.install: -------------------------------------------------------------------------------- 1 | out/Release/lib/libbase*.so /usr/lib 2 | out/Release/libbase*.a /usr/lib 3 | out/Release/obj/libchrome/libchrome*.pc /usr/lib/pkgconfig 4 | usr/include /usr 5 | -------------------------------------------------------------------------------- /build/dpkg/libchrome/debian/patches/series: -------------------------------------------------------------------------------- 1 | 0001-common-mk-rebase_path-output-location-of-generate-pc.patch 2 | 0001-Add-missing-includes.patch 3 | 0001-rebase_path-for-write_args.patch 4 | -------------------------------------------------------------------------------- /build/dpkg/modp_b64/debian/README.Debian: -------------------------------------------------------------------------------- 1 | modp-b64 for Debian 2 | -------------------------------------------------------------------------------- /build/dpkg/modp_b64/debian/changelog: -------------------------------------------------------------------------------- 1 | modp-b64 (0.0.1-1) buster; urgency=low 2 | 3 | * Initial release. 4 | 5 | -- Sonny Sasaka Fri, 19 Mar 2021 19:41:40 +0000 6 | -------------------------------------------------------------------------------- /build/dpkg/modp_b64/debian/compat: -------------------------------------------------------------------------------- 1 | 10 2 | -------------------------------------------------------------------------------- /build/dpkg/modp_b64/debian/control: -------------------------------------------------------------------------------- 1 | Source: modp-b64 2 | Section: libs 3 | Priority: optional 4 | Maintainer: Sonny Sasaka 5 | Standards-Version: 4.1.4 6 | Homepage: https://chromium.googlesource.com/aosp/platform/external/modp_b64/ 7 | Build-Depends: 8 | debhelper (>=11~), 9 | clang, 10 | python3, 11 | pkg-config, 12 | ninja-build, 13 | 14 | Package: modp-b64 15 | Architecture: any 16 | Multi-Arch: foreign 17 | Depends: ${misc:Depends}, ${shlibs:Depends} 18 | Description: modp base64 decoder 19 | -------------------------------------------------------------------------------- /build/dpkg/modp_b64/debian/modp-b64.install: -------------------------------------------------------------------------------- 1 | modp_b64/modp_b64 /usr/include 2 | out/Release/libmodp_b64.a /usr/lib 3 | out/Release/obj/modp_b64/libmodp_b64.pc /usr/lib/pkgconfig 4 | -------------------------------------------------------------------------------- /build/dpkg/modp_b64/debian/patches/series: -------------------------------------------------------------------------------- 1 | 0001-common-mk-rebase_path-output-location-of-generate-pc.patch 2 | -------------------------------------------------------------------------------- /build/dpkg/modp_b64/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | # gn args 4 | defines = 5 | defines += pkg_config=\"pkg-config\" 6 | defines += platform2_root=\"$(shell pwd)/\" 7 | defines += platform_subdir=\"modp_b64\" 8 | defines += cxx=\"clang++\" 9 | defines += cc=\"clang\" 10 | defines += ar=\"ar\" 11 | defines += enable_werror=false 12 | defines += libdir=\"/usr/lib\" 13 | defines += use={mojo=false asan=false coverage=false crypto=true dbus=true fuzzer=false timers=true cros_host=false profiling=false tcmalloc=false} 14 | 15 | # handle parallel build options 16 | njobs=1 17 | ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) 18 | njobs=$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) 19 | endif 20 | 21 | %: 22 | dh $@ 23 | 24 | override_dh_auto_build-arch: 25 | gn gen out/Release --args="$(defines)" 26 | ninja -j$(njobs) -C out/Release 27 | 28 | override_dh_auto_clean: 29 | rm -rf out 30 | find . -name \*.pyc -execdir rm -f {} \; 31 | dh_auto_clean 32 | -------------------------------------------------------------------------------- /build/secondary/third_party/tinyxml2/BUILD.gn: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2015 Google, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at: 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | static_library("tinyxml2") { 18 | sources = [ 19 | "tinyxml2.cpp" 20 | ] 21 | 22 | include_dirs = [ "." ] 23 | } 24 | -------------------------------------------------------------------------------- /common/os_utils.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifdef OS_ANDROID 18 | #include 19 | #include 20 | #endif 21 | 22 | bool is_bluetooth_uid() { 23 | #ifdef OS_ANDROID 24 | return getuid() == AID_BLUETOOTH; 25 | #else 26 | return false; 27 | #endif 28 | } 29 | -------------------------------------------------------------------------------- /common/os_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | bool is_bluetooth_uid(); 18 | -------------------------------------------------------------------------------- /conf/Android.bp: -------------------------------------------------------------------------------- 1 | // Bluetooth bt_stack.conf config file 2 | // ======================================================== 3 | package { 4 | // See: http://go/android-license-faq 5 | // A large-scale-change added 'default_applicable_licenses' to import 6 | // all of the 'license_kinds' from "system_bt_license" 7 | // to get the below license kinds: 8 | // SPDX-license-identifier-Apache-2.0 9 | default_applicable_licenses: ["system_bt_license"], 10 | } 11 | 12 | prebuilt_etc { 13 | name: "bt_stack.conf", 14 | src: "bt_stack.conf", 15 | sub_dir: "bluetooth", 16 | } 17 | 18 | // Bluetooth bt_did.conf config file 19 | // ======================================================== 20 | prebuilt_etc { 21 | name: "bt_did.conf", 22 | src: "bt_did.conf", 23 | sub_dir: "bluetooth", 24 | } 25 | -------------------------------------------------------------------------------- /doc/btsnoop_net.md: -------------------------------------------------------------------------------- 1 | btsnoop_net 2 | ==== 3 | btsnoop_net exposes Bluetooth snoop logs over a local TCP socket which enables 4 | real-time debugging of HCI data with hcidump. 5 | 6 | This feature is enabled by enabling "Enable Bluetooth HCI snoop log" in the 7 | Developer options and setting BT_NET_DEBUG flag to TRUE in the btsnoop_net.cc. 8 | Once it has been enabled and the stack restarted, the stack will listen for 9 | incoming TCP connections on port 8872. 10 | 11 | To use this feature with btmon on a Linux host, you can run: 12 | 13 | ``` 14 | $ adb forward tcp:8872 tcp:8872 15 | $ nc localhost 8872 | btmon -P -r /dev/stdin 16 | ``` 17 | -------------------------------------------------------------------------------- /doc/network_ports.md: -------------------------------------------------------------------------------- 1 | Network Ports 2 | === 3 | This document lists all of the network ports used by the bluetooth stack. 4 | It should be used as a reference and as a mechanism to avoid port 5 | namespace conflicts. 6 | 7 | * TCP 8872 (hci/src/btsnoop_net.cc) - read live btsnoop logs 8 | * TCP 8873 (hci/src/hci_inject.cc) - inject HCI packets into HCI stream 9 | -------------------------------------------------------------------------------- /doc/properties.md: -------------------------------------------------------------------------------- 1 | Properties 2 | === 3 | This document describes all of the Android properties used by the Bluetooth 4 | stack. 5 | 6 | Please keep the following list in alphabetical order. 7 | 8 | * ``` bluetooth.enable_timeout_ms ``` 9 | Maximum amount of time Bluetooth can take to start-up, upload firmware etc. 10 | Used in hci/src/hci_layer.cc, default 8000. 11 | 12 | ### TODO: write descriptions of what each property means and how 13 | it's used. 14 | 15 | * ``` debug.sys.noschedgroups ``` 16 | * ``` persist.service.bdroid.bdaddr ``` 17 | * ``` ro.bluetooth.hfp.ver ``` 18 | * ``` ro.bt.bdaddr_path ``` 19 | * ``` ro.product.model ``` 20 | * ``` service.brcm.bt.oob ``` 21 | -------------------------------------------------------------------------------- /doc/supported_features.md: -------------------------------------------------------------------------------- 1 | # Fluoride 1.1 2 | 3 | Declaration ID: [D024527](https://www.bluetooth.org/tpg/QLI_viewQDL.cfm?qid=24527) 4 | Qualified Design ID: 83953 5 | 6 | Protocol / Profile | Version | Roles 7 | -------------------+---------+------- 8 | L2CAP | 4.2 | Initiator, Acceptor, LE Central, LE Peripheral 9 | SDP | 4.2 | Server, Client 10 | GAP | 4.2 | BR/EDR, LE Central, LE Periperhal, LE Observer, LE Broadcaster 11 | GATT | 4.2 | Client, Server; LE and BR/EDR 12 | ATT | 4.2 | Client, Server; LE and BR/EDR 13 | SM | 4.2 | Central (Initiator), Peripheral (Responder) 14 | AVCTP | 1.4 | Controller, Target 15 | AVDTP | 1.2 | Source, Initiator, Acceptor 16 | BNEP | 1.0 | 17 | GAVDP | 1.2 | Initiator, Acceptor 18 | RFCOMM | 1.2 | 19 | SPP | 1.2 | A, B 20 | -------------------------------------------------------------------------------- /embdrv/g722/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | // SPDX-license-identifier-BSD 8 | // legacy_unencumbered 9 | default_applicable_licenses: ["system_bt_license"], 10 | } 11 | 12 | cc_library_static { 13 | name: "libg722codec", 14 | defaults: ["fluoride_defaults"], 15 | cflags: [ 16 | "-DG722_SUPPORT_MALLOC", 17 | ], 18 | srcs: [ 19 | "g722_decode.cc", 20 | "g722_encode.cc", 21 | ], 22 | host_supported: true, 23 | } 24 | -------------------------------------------------------------------------------- /embdrv/g722/BUILD.gn: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2018 Google, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at: 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | static_library("g722") { 18 | sources = [ 19 | "g722_decode.cc", 20 | "g722_encode.cc", 21 | ] 22 | 23 | defines = [ "G722_SUPPORT_MALLOC" ] 24 | configs += [ "//bt:target_defaults" ] 25 | } 26 | -------------------------------------------------------------------------------- /embdrv/g722/fuzzer/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | cc_fuzz { 11 | name: "g722_enc_fuzzer", 12 | srcs: [ 13 | "g722_enc_fuzzer.cc", 14 | ], 15 | host_supported: false, 16 | static_libs: [ 17 | "libg722codec", 18 | ], 19 | fuzz_config: { 20 | cc: [ 21 | "hsz@google.com", 22 | ], 23 | }, 24 | } 25 | -------------------------------------------------------------------------------- /embdrv/sbc/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | subdirs = [ 11 | "decoder", 12 | "encoder", 13 | ] 14 | -------------------------------------------------------------------------------- /gd/.gitignore: -------------------------------------------------------------------------------- 1 | **/default.profraw 2 | **/__pycache__/ 3 | gd_cert_venv 4 | -------------------------------------------------------------------------------- /gd/README.md: -------------------------------------------------------------------------------- 1 | ### Why is gabeldorsche plural? 2 | 3 | Please see this [informative video we've prepared](https://www.youtube.com/watch?v=vLRyJ0dawjM). 4 | 5 | ### Architecture 6 | 7 | Guidelines for developing the Gabeldorsche (GD) stack 8 | 9 | * [Architecture](./docs/architecture/architecture.md) 10 | * [Style Guide](./docs/architecture/style_guide.md) 11 | 12 | ### Testing 13 | 14 | Gabeldorsche (GD) was built with test driven development in mind. Three types of 15 | tests are used in ensuring Gabeldorsche stack's stability, correctness and free 16 | from regression. 17 | 18 | If you are verifying something is glued or hooked up correctly inside the stack, 19 | use a unit test. 20 | 21 | * [GTest Unit Test](./docs/testing/gtest.md) 22 | 23 | If you are verifying correct behavior (especially interop problems) **DO NOT** 24 | write a unit test as this not a good use of your time. Write a [cert test](./cert_test.md) instead 25 | so it applies to any stack. 26 | 27 | * [GD Certification Tests](./docs/testing/cert_test.md) 28 | -------------------------------------------------------------------------------- /gd/att/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | filegroup { 11 | name: "BluetoothAttSources", 12 | srcs: [ 13 | "att_module.cc", 14 | ], 15 | } 16 | 17 | filegroup { 18 | name: "BluetoothAttTestSources", 19 | srcs: [ 20 | ], 21 | } 22 | -------------------------------------------------------------------------------- /gd/att/BUILD.gn: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Google, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at: 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | source_set("BluetoothAttSources") { 18 | sources = [ "att_module.cc" ] 19 | 20 | configs += [ "//bt/gd:gd_defaults" ] 21 | deps = [ "//bt/gd:gd_default_deps" ] 22 | } 23 | -------------------------------------------------------------------------------- /gd/benchmark.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | int main(int argc, char** argv) { 20 | ::benchmark::Initialize(&argc, argv); 21 | if (::benchmark::ReportUnrecognizedArguments(argc, argv)) { 22 | return 1; 23 | } 24 | ::benchmark::RunSpecifiedBenchmarks(); 25 | } 26 | -------------------------------------------------------------------------------- /gd/btaa/BUILD.gn: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Google, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at: 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | source_set("BluetoothBtaaSources_linux") { 18 | sources = [ "linux/activity_attribution.cc" ] 19 | 20 | configs += [ "//bt/gd:gd_defaults" ] 21 | deps = [ "//bt/gd:gd_default_deps" ] 22 | } 23 | -------------------------------------------------------------------------------- /gd/btaa/activity_attribution.fbs: -------------------------------------------------------------------------------- 1 | namespace bluetooth.activity_attribution; 2 | 3 | attribute "privacy"; 4 | 5 | table WakeupEntry { 6 | wakeup_time:string; 7 | activity:string; 8 | address:string; 9 | } 10 | 11 | table DeviceActivityAggregationEntry { 12 | address:string; 13 | activity:string; 14 | wakeup_count:int; 15 | byte_count:int; 16 | wakelock_duration_ms:int; 17 | creation_time:string; 18 | } 19 | 20 | table ActivityAttributionData { 21 | title_wakeup:string; 22 | num_wakeup:int; 23 | wakeup_attribution:[WakeupEntry]; 24 | title_activity:string; 25 | num_device_activity:int; 26 | device_activity_aggregation:[DeviceActivityAggregationEntry]; 27 | } 28 | 29 | root_type ActivityAttributionData; -------------------------------------------------------------------------------- /gd/cert/all_cert_testcases: -------------------------------------------------------------------------------- 1 | CertSelfTest 2 | SimpleHalTest 3 | DirectHciTest 4 | LeAdvertisingManagerTest 5 | LeScanningManagerTest 6 | LeScanningWithSecurityTest 7 | NeighborTest 8 | ControllerTest 9 | AclManagerTest 10 | LeAclManagerTest 11 | StackTest 12 | L2capTest 13 | LeL2capTest 14 | DualL2capTest 15 | LeSecurityTest 16 | L2capPerformanceTest 17 | SecurityTest 18 | ShimTest 19 | LeIsoTest 20 | -------------------------------------------------------------------------------- /gd/cert/change_waiter.py: -------------------------------------------------------------------------------- 1 | import pyinotify 2 | import sys 3 | 4 | wm = pyinotify.WatchManager() 5 | mask = pyinotify.IN_DELETE | pyinotify.IN_CREATE | pyinotify.IN_MODIFY 6 | 7 | 8 | class EventHandler(pyinotify.ProcessEvent): 9 | 10 | def process_default(self, event): 11 | quit() 12 | 13 | 14 | handler = EventHandler() 15 | notifier = pyinotify.Notifier(wm, handler) 16 | wdd = wm.add_watch(sys.argv[1], mask, rec=True) 17 | 18 | notifier.loop() 19 | -------------------------------------------------------------------------------- /gd/cert/gen_html_coverage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | pushd $ANDROID_BUILD_TOP 4 | 5 | llvm-cov show --format=html --summary-only --show-line-counts-or-regions --show-instantiation-summary --instr-profile=/tmp/logs/HostOnlyCert/latest/GdDevice_dut_backing_process_coverage.profdata --output-dir=/tmp/logs/HostOnlyCert/latest/GdDevice_dut_backing_process_coverage/ out/dist/bluetooth_venv/lib/python3.8/site-packages/bluetooth_stack_with_facade 6 | 7 | popd 8 | 9 | echo "point your browser to file:///tmp/logs/HostOnlyCert/latest/GdDevice_dut_backing_process_coverage/index.html" 10 | 11 | -------------------------------------------------------------------------------- /gd/cert/irun: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | # interactive version of run 3 | 4 | trap "exit;" SIGINT SIGTERM 5 | 6 | while true 7 | do 8 | ${ANDROID_BUILD_TOP}/system/bt/gd/cert/run "$@" 9 | python3 ${ANDROID_BUILD_TOP}/system/bt/gd/cert/change_waiter.py ${ANDROID_BUILD_TOP}/system/bt 10 | done 11 | -------------------------------------------------------------------------------- /gd/cert/pts_l2cap_testcase: -------------------------------------------------------------------------------- 1 | PTSL2capTest 2 | -------------------------------------------------------------------------------- /gd/cert/run_pts_l2cap.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | source $ANDROID_BUILD_TOP/system/bt/cert/run \ 4 | --test_config=$ANDROID_BUILD_TOP/system/bt/gd/cert/pts.json \ 5 | --test_file=$ANDROID_BUILD_TOP/system/bt/gd/cert/pts_l2cap_testcase -------------------------------------------------------------------------------- /gd/common/BUILD.gn: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Google, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at: 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | source_set("BluetoothCommonSources") { 18 | sources = [ 19 | "init_flags.cc", 20 | "metric_id_manager.cc", 21 | "stop_watch.cc", 22 | "strings.cc", 23 | ] 24 | 25 | configs += [ "//bt/gd:gd_defaults" ] 26 | deps = [ 27 | "//bt/gd:gd_default_deps", 28 | "//bt:libbt-platform-protos-lite", 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /gd/common/callback.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "base/callback.h" 20 | 21 | namespace bluetooth { 22 | namespace common { 23 | 24 | using base::Callback; 25 | using base::Closure; 26 | using base::OnceCallback; 27 | using base::OnceClosure; 28 | 29 | } // namespace common 30 | } // namespace bluetooth 31 | -------------------------------------------------------------------------------- /gd/common/init_flags.fbs: -------------------------------------------------------------------------------- 1 | namespace bluetooth.common; 2 | 3 | attribute "privacy"; 4 | 5 | table InitFlagsData { 6 | title:string; 7 | gd_advertising_enabled:bool; 8 | gd_scanning_enabled:bool; 9 | gd_security_enabled:bool; 10 | gd_acl_enabled:bool; 11 | gd_hci_enabled:bool; 12 | gd_controller_enabled:bool; 13 | gd_core_enabled:bool; 14 | btaa_hci_log_enabled:bool; 15 | } 16 | 17 | root_type InitFlagsData; 18 | -------------------------------------------------------------------------------- /gd/common/testing/bind_test_util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "base/test/bind_test_util.h" 20 | 21 | namespace bluetooth { 22 | namespace common { 23 | namespace testing { 24 | 25 | using base::BindLambdaForTesting; 26 | 27 | } // namespace testing 28 | } // namespace common 29 | } // namespace bluetooth 30 | -------------------------------------------------------------------------------- /gd/crypto_toolbox/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | // SPDX-license-identifier-BSD 8 | default_applicable_licenses: ["system_bt_license"], 9 | } 10 | 11 | filegroup { 12 | name: "BluetoothCryptoToolboxSources", 13 | srcs: [ 14 | "aes.cc", 15 | "aes_cmac.cc", 16 | "crypto_toolbox.cc", 17 | ] 18 | } 19 | 20 | filegroup { 21 | name: "BluetoothCryptoToolboxTestSources", 22 | srcs: [ 23 | "crypto_toolbox_test.cc", 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /gd/crypto_toolbox/BUILD.gn: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Google, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at: 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | source_set("BluetoothCryptoToolboxSources") { 17 | sources = [ 18 | "aes.cc", 19 | "aes_cmac.cc", 20 | "crypto_toolbox.cc", 21 | ] 22 | 23 | configs += [ "//bt/gd:gd_defaults" ] 24 | } 25 | -------------------------------------------------------------------------------- /gd/docs/architecture/data_flow_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LineageOS/android_system_bt/edc95ad08dc40d56a6ac00f4da98ca918ed04f9e/gd/docs/architecture/data_flow_diagram.png -------------------------------------------------------------------------------- /gd/docs/testing/cert_test_architecture_drawing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LineageOS/android_system_bt/edc95ad08dc40d56a6ac00f4da98ca918ed04f9e/gd/docs/testing/cert_test_architecture_drawing.png -------------------------------------------------------------------------------- /gd/dumpsys/bluetooth_flatbuffer_test.fbs: -------------------------------------------------------------------------------- 1 | // Bluetooth module test schema 2 | 3 | attribute "privacy"; 4 | 5 | table TestTable { 6 | string_private:string; // no privacy attribute implies private 7 | string_opaque:string (privacy:"Opaque"); 8 | string_anonymized:string (privacy:"Anonymized"); 9 | string_any:string (privacy:"Any"); 10 | 11 | int_private:int32 (privacy:"Private"); // Explicitly private 12 | int_opaque:int32 (privacy:"Opaque"); 13 | int_anonymized:int32 (privacy:"Anonymized"); 14 | int_any:int32 (privacy:"Any"); 15 | } 16 | 17 | root_type TestTable; 18 | -------------------------------------------------------------------------------- /gd/dumpsys/bundler/bundler.fbs: -------------------------------------------------------------------------------- 1 | // Bundled Schema 2 | // 3 | // Describes a collection of binary flatbuffer schema. 4 | // 5 | 6 | namespace bluetooth.dumpsys; 7 | 8 | table BundledSchemaMap { 9 | name:string; 10 | data:[ubyte]; 11 | } 12 | 13 | table BundledSchema { 14 | title:string; 15 | root_name:string; 16 | map:[BundledSchemaMap]; 17 | } 18 | 19 | root_type BundledSchema; 20 | -------------------------------------------------------------------------------- /gd/dumpsys/bundler/main.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "bundler.h" 17 | #include "bundler_generated.h" 18 | 19 | int main(int argc, char** argv) { 20 | ParseArgs(argc, argv); 21 | if (opts.read) { 22 | exit(ReadBundledSchema()); 23 | } 24 | if (opts.write) { 25 | exit(WriteBundledSchema()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /gd/dumpsys/bundler/test.bfbs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LineageOS/android_system_bt/edc95ad08dc40d56a6ac00f4da98ca918ed04f9e/gd/dumpsys/bundler/test.bfbs -------------------------------------------------------------------------------- /gd/dumpsys/internal/test_data/float.bfbs: -------------------------------------------------------------------------------- 1 | BFBS 0(4  ,testing.TestTableFloat     2 | test_float -------------------------------------------------------------------------------- /gd/dumpsys/internal/test_data/float.fbs: -------------------------------------------------------------------------------- 1 | namespace testing; 2 | 3 | table TestTableFloat { 4 | test_float:float; 5 | } 6 | 7 | root_type TestTableFloat; 8 | -------------------------------------------------------------------------------- /gd/dumpsys/internal/test_data/integer.bfbs: -------------------------------------------------------------------------------- 1 | BFBS 0(4  0testing.TestTableInteger    test_int -------------------------------------------------------------------------------- /gd/dumpsys/internal/test_data/integer.fbs: -------------------------------------------------------------------------------- 1 | namespace testing; 2 | 3 | table TestTableInteger { 4 | test_int:int; 5 | } 6 | 7 | root_type TestTableInteger; 8 | -------------------------------------------------------------------------------- /gd/dumpsys/internal/test_data/mkfiles: -------------------------------------------------------------------------------- 1 | ../../../../../out/host/linux-x86/bin/flatc -b --schema --cpp string.fbs 2 | xxd -i string.bfbs > string_bfbs.h 3 | ../../../../../out/host/linux-x86/bin/flatc -b --schema --cpp integer.fbs 4 | xxd -i integer.bfbs > integer_bfbs.h 5 | ../../../../../out/host/linux-x86/bin/flatc -b --schema --cpp float.fbs 6 | xxd -i float.bfbs > float_bfbs.h 7 | ../../../../../out/host/linux-x86/bin/flatc -b --schema --cpp struct.fbs 8 | xxd -i struct.bfbs > struct_bfbs.h 9 | 10 | -------------------------------------------------------------------------------- /gd/dumpsys/internal/test_data/root.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #pragma once 4 | 5 | #include "flatbuffers/flatbuffers.h" 6 | #include "root_generated.h" 7 | 8 | using TableAddFunction = std::function; 9 | 10 | namespace testing { 11 | 12 | struct DumpsysTestDataClass { 13 | virtual TableAddFunction GetTable(flatbuffers::FlatBufferBuilder& builder) = 0; 14 | virtual ~DumpsysTestDataClass() = default; 15 | }; 16 | 17 | } // namespace testing 18 | -------------------------------------------------------------------------------- /gd/dumpsys/internal/test_data/string.bfbs: -------------------------------------------------------------------------------- 1 | BFBS 0(4  ,testing.TestTableString     test_string -------------------------------------------------------------------------------- /gd/dumpsys/internal/test_data/string.fbs: -------------------------------------------------------------------------------- 1 | namespace testing; 2 | 3 | table TestTableString { 4 | test_string:string; 5 | } 6 | 7 | root_type TestTableString; 8 | -------------------------------------------------------------------------------- /gd/dumpsys/internal/test_data/struct.bfbs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LineageOS/android_system_bt/edc95ad08dc40d56a6ac00f4da98ca918ed04f9e/gd/dumpsys/internal/test_data/struct.bfbs -------------------------------------------------------------------------------- /gd/dumpsys/internal/test_data/struct.fbs: -------------------------------------------------------------------------------- 1 | namespace testing; 2 | 3 | table TestSubTable { 4 | placeholder:int; 5 | } 6 | 7 | table TestTableStruct{ 8 | sub_table:TestSubTable; 9 | } 10 | 11 | root_type TestTableStruct; 12 | -------------------------------------------------------------------------------- /gd/dumpsys/test_data/bar.fbs: -------------------------------------------------------------------------------- 1 | namespace testing; 2 | 3 | attribute "privacy"; 4 | 5 | table BarTestSchema { 6 | bar_x:int; 7 | bar_y:int; 8 | another_field:string (privacy:"Any"); 9 | } 10 | 11 | root_type BarTestSchema; 12 | 13 | -------------------------------------------------------------------------------- /gd/dumpsys/test_data/bar.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | **/ 4 | #include "bar_generated.h" 5 | #include "root.h" 6 | #include "root_generated.h" 7 | 8 | namespace testing { 9 | 10 | class BarTestDataClass : public DumpsysTestDataClass { 11 | public: 12 | TableAddFunction GetTable(flatbuffers::FlatBufferBuilder& fb_builder) override { 13 | return [](DumpsysTestDataRootBuilder* builder) {}; 14 | } 15 | }; 16 | 17 | } // namespace testing 18 | -------------------------------------------------------------------------------- /gd/dumpsys/test_data/foo.fbs: -------------------------------------------------------------------------------- 1 | namespace testing; 2 | 3 | attribute "privacy"; 4 | 5 | table FooTestSchema { 6 | foo_int_private:int; 7 | foo_int_opaque:int (privacy:"Opaque"); 8 | foo_int_anonymized:int (privacy:"Anonymized"); 9 | foo_int_any:int (privacy:"Any"); 10 | foo_int_string:string (privacy:"Any"); 11 | 12 | foo_float_private:float; 13 | foo_float_opaque:float (privacy:"Opaque"); 14 | foo_float_anonymized:float (privacy:"Anonymized"); 15 | foo_float_any:float (privacy:"Any"); 16 | foo_float_string:string (privacy:"Any"); 17 | 18 | foo_bool_private:bool (privacy:"Private"); 19 | foo_bool_opaque:bool (privacy:"Opaque"); 20 | foo_bool_anonymized:bool (privacy:"Anonymized"); 21 | foo_bool_any:bool (privacy:"Any"); 22 | foo_bool_string:string (privacy:"Any"); 23 | } 24 | 25 | root_type FooTestSchema; 26 | -------------------------------------------------------------------------------- /gd/dumpsys/test_data/qux.fbs: -------------------------------------------------------------------------------- 1 | namespace testing; 2 | 3 | attribute "privacy"; 4 | 5 | table QuxTestSchema { 6 | qux_int_private:int; 7 | qux_int_opaque:int (privacy:"Opaque"); 8 | qux_int_anonymized:int (privacy:"Anonymized"); 9 | qux_int_any:int (privacy:"Any"); 10 | qux_string_name:string (privacy:"Any"); 11 | } 12 | 13 | root_type QuxTestSchema; 14 | -------------------------------------------------------------------------------- /gd/dumpsys/test_data/qux.h: -------------------------------------------------------------------------------- 1 | 2 | #include "qux_generated.h" 3 | #include "root.h" 4 | #include "root_generated.h" 5 | 6 | namespace testing { 7 | 8 | class QuxTestDataClass : public DumpsysTestDataClass { 9 | public: 10 | TableAddFunction GetTable(flatbuffers::FlatBufferBuilder& fb_builder) override { 11 | auto name = fb_builder.CreateString("Qux Module String"); 12 | 13 | QuxTestSchemaBuilder builder(fb_builder); 14 | builder.add_qux_int_private(123); 15 | builder.add_qux_int_opaque(456); 16 | builder.add_qux_int_anonymized(789); 17 | builder.add_qux_int_any(0xabc); 18 | builder.add_qux_string_name(name); 19 | 20 | auto qux_table = builder.Finish(); 21 | 22 | return [qux_table](DumpsysTestDataRootBuilder* builder) { builder->add_qux_module_data(qux_table); }; 23 | } 24 | }; 25 | 26 | } // namespace testing 27 | -------------------------------------------------------------------------------- /gd/dumpsys/test_data/root.fbs: -------------------------------------------------------------------------------- 1 | include "foo.fbs"; 2 | include "bar.fbs"; 3 | include "baz.fbs"; 4 | include "qux.fbs"; 5 | 6 | namespace testing; 7 | 8 | attribute "privacy"; 9 | 10 | table DumpsysTestDataRoot { 11 | string_private:string; 12 | string_opaque:string (privacy:"Opaque"); 13 | string_anonymized:string (privacy:"Anonymized"); 14 | string_any:string (privacy:"Any"); 15 | 16 | int_private:int32 (privacy:"Private"); 17 | int_opaque:int32 (privacy:"Opaque"); 18 | int_anonymized:int32 (privacy:"Anonymized"); 19 | int_any:int32 (privacy:"Any"); 20 | 21 | foo_module_data:FooTestSchema (privacy:"Any"); 22 | bar_module_data:BarTestSchema (privacy:"Any"); 23 | baz_module_data:BazTestSchema (privacy:"Any"); 24 | qux_module_data:QuxTestSchema (privacy:"Any"); 25 | } 26 | 27 | root_type DumpsysTestDataRoot; 28 | -------------------------------------------------------------------------------- /gd/dumpsys/test_data/root.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #pragma once 4 | 5 | #include "flatbuffers/flatbuffers.h" 6 | #include "root_generated.h" 7 | 8 | using TableAddFunction = std::function; 9 | 10 | namespace testing { 11 | 12 | struct DumpsysTestDataClass { 13 | virtual TableAddFunction GetTable(flatbuffers::FlatBufferBuilder& fb_builder) = 0; 14 | virtual ~DumpsysTestDataClass() = default; 15 | }; 16 | 17 | } // namespace testing 18 | -------------------------------------------------------------------------------- /gd/facade/common.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package bluetooth.facade; 4 | 5 | message Data { 6 | bytes payload = 1; 7 | } 8 | 9 | message BluetoothAddress { 10 | bytes address = 1; 11 | } 12 | 13 | enum BluetoothAddressTypeEnum { 14 | PUBLIC_DEVICE_ADDRESS = 0x0; 15 | RANDOM_DEVICE_ADDRESS = 0x1; 16 | PUBLIC_IDENTITY_ADDRESS = 0x2; 17 | RANDOM_IDENTITY_ADDRESS = 0x3; 18 | } 19 | 20 | enum BluetoothOwnAddressTypeEnum { 21 | USE_PUBLIC_DEVICE_ADDRESS = 0x0; 22 | USE_RANDOM_DEVICE_ADDRESS = 0x1; 23 | RESOLVABLE_OR_PUBLIC_ADDRESS = 0x2; 24 | RESOLVABLE_OR_RANDOM_ADDRESS = 0x3; 25 | } 26 | 27 | message BluetoothAddressWithType { 28 | BluetoothAddress address = 1; 29 | BluetoothAddressTypeEnum type = 2; 30 | } 31 | 32 | enum BluetoothPeerAddressTypeEnum { 33 | PUBLIC_DEVICE_OR_IDENTITY_ADDRESS = 0x0; 34 | RANDOM_DEVICE_OR_IDENTITY_ADDRESS = 0x1; 35 | } 36 | -------------------------------------------------------------------------------- /gd/facade/rootservice.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package bluetooth.facade; 4 | 5 | import "google/protobuf/empty.proto"; 6 | import "facade/common.proto"; 7 | 8 | service RootFacade { 9 | rpc StartStack(StartStackRequest) returns (StartStackResponse) {} 10 | rpc StopStack(StopStackRequest) returns (StopStackResponse) {} 11 | } 12 | 13 | enum BluetoothModule { 14 | HAL = 0; 15 | HCI = 1; 16 | HCI_INTERFACES = 2; 17 | L2CAP = 3; 18 | SECURITY = 4; 19 | SHIM = 5; 20 | } 21 | 22 | message StartStackRequest { 23 | BluetoothModule module_under_test = 1; 24 | } 25 | 26 | message StartStackResponse {} 27 | 28 | message StopStackRequest {} 29 | 30 | message StopStackResponse {} 31 | 32 | service ReadOnlyProperty { 33 | rpc ReadLocalAddress(google.protobuf.Empty) returns (facade.BluetoothAddress) {} 34 | } 35 | -------------------------------------------------------------------------------- /gd/fuzz/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | filegroup { 11 | name: "BluetoothFuzzHelperSources", 12 | srcs: [ 13 | "helpers.cc", 14 | ], 15 | } 16 | -------------------------------------------------------------------------------- /gd/fuzz/run: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | if [[ -z "${ANDROID_BUILD_TOP}" ]]; then 4 | echo "ANDROID_BUILD_TOP is not set" 5 | fi 6 | 7 | if [[ -z "${ANDROID_HOST_OUT}" ]]; then 8 | echo "ANDROID_HOST_OUT is not set for host run" 9 | fi 10 | 11 | HOST=false 12 | POSITIONAL=() 13 | while [[ $# -gt 0 ]] 14 | do 15 | key="$1" 16 | case $key in 17 | --host) 18 | HOST=true 19 | shift # past argument 20 | ;; 21 | *) # unknown option 22 | POSITIONAL+=("$1") # save it in an array for later 23 | shift # past argument 24 | ;; 25 | esac 26 | done 27 | set -- "${POSITIONAL[@]}" # restore positional parameters 28 | 29 | TEST_NAME=bluetooth_gd_${1}_fuzz_test 30 | 31 | if [ "$HOST" == true ] ; then 32 | HOST_ARCH=$($ANDROID_BUILD_TOP/build/soong/soong_ui.bash --dumpvar-mode HOST_ARCH) 33 | SANITIZE_HOST=address $ANDROID_BUILD_TOP/build/soong/soong_ui.bash --build-mode --"all-modules" --dir="$(pwd)" $TEST_NAME && ${ANDROID_HOST_OUT}/fuzz/$HOST_ARCH/$TEST_NAME/$TEST_NAME $2 34 | fi 35 | -------------------------------------------------------------------------------- /gd/hal/BUILD.gn: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Google, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at: 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | source_set("BluetoothHalSources") { 18 | sources = [ "snoop_logger.cc" ] 19 | 20 | configs += [ "//bt/gd:gd_defaults" ] 21 | deps = [ "//bt/gd:gd_default_deps" ] 22 | } 23 | 24 | source_set("BluetoothHalSources_hci_host") { 25 | sources = [ "hci_hal_host.cc" ] 26 | 27 | configs += [ "//bt/gd:gd_defaults" ] 28 | deps = [ "//bt/gd:gd_default_deps" ] 29 | } 30 | -------------------------------------------------------------------------------- /gd/hal/hal_facade.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package bluetooth.hal; 4 | 5 | import "google/protobuf/empty.proto"; 6 | import "facade/common.proto"; 7 | 8 | service HciHalFacade { 9 | rpc SendCommand(facade.Data) returns (google.protobuf.Empty) {} 10 | rpc StreamEvents(google.protobuf.Empty) returns (stream facade.Data) {} 11 | 12 | rpc SendAcl(facade.Data) returns (google.protobuf.Empty) {} 13 | rpc StreamAcl(google.protobuf.Empty) returns (stream facade.Data) {} 14 | 15 | rpc SendSco(facade.Data) returns (google.protobuf.Empty) {} 16 | rpc StreamSco(google.protobuf.Empty) returns (stream facade.Data) {} 17 | 18 | rpc SendIso(facade.Data) returns (google.protobuf.Empty) {} 19 | rpc StreamIso(google.protobuf.Empty) returns (stream facade.Data) {} 20 | } 21 | -------------------------------------------------------------------------------- /gd/hci/acl_manager/acl_connection.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "hci/acl_manager/acl_connection.h" 18 | 19 | namespace bluetooth { 20 | namespace hci { 21 | namespace acl_manager { 22 | 23 | AclConnection::QueueUpEnd* AclConnection::GetAclQueueEnd() const { 24 | return queue_up_end_; 25 | } 26 | 27 | } // namespace acl_manager 28 | } // namespace hci 29 | } // namespace bluetooth 30 | -------------------------------------------------------------------------------- /gd/hci/facade/controller_facade.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package bluetooth.hci; 4 | 5 | import "google/protobuf/empty.proto"; 6 | 7 | service ControllerFacade { 8 | rpc GetMacAddress(google.protobuf.Empty) returns (AddressMsg) {} 9 | rpc WriteLocalName(NameMsg) returns (google.protobuf.Empty) {} 10 | rpc GetLocalName(google.protobuf.Empty) returns (NameMsg) {} 11 | } 12 | 13 | message AddressMsg { 14 | bytes address = 1; 15 | } 16 | 17 | message NameMsg { 18 | bytes name = 1; 19 | } 20 | -------------------------------------------------------------------------------- /gd/hci/facade/hci_facade.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package bluetooth.hci; 4 | 5 | import "google/protobuf/empty.proto"; 6 | import "facade/common.proto"; 7 | 8 | service HciFacade { 9 | rpc SendCommand(facade.Data) returns (google.protobuf.Empty) {} 10 | 11 | rpc RequestEvent(EventRequest) returns (google.protobuf.Empty) {} 12 | rpc StreamEvents(google.protobuf.Empty) returns (stream facade.Data) {} 13 | 14 | rpc RequestLeSubevent(EventRequest) returns (google.protobuf.Empty) {} 15 | rpc StreamLeSubevents(google.protobuf.Empty) returns (stream facade.Data) {} 16 | 17 | rpc SendAcl(facade.Data) returns (google.protobuf.Empty) {} 18 | rpc StreamAcl(google.protobuf.Empty) returns (stream facade.Data) {} 19 | } 20 | 21 | message EventRequest { 22 | uint32 code = 1; 23 | } 24 | -------------------------------------------------------------------------------- /gd/hci/facade/le_initiator_address_facade.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package bluetooth.hci; 4 | 5 | import "google/protobuf/empty.proto"; 6 | import "facade/common.proto"; 7 | 8 | service LeInitiatorAddressFacade { 9 | rpc SetPrivacyPolicyForInitiatorAddress(PrivacyPolicy) returns (google.protobuf.Empty) {} 10 | rpc GetCurrentInitiatorAddress(google.protobuf.Empty) returns (bluetooth.facade.BluetoothAddressWithType) {} 11 | rpc GetAnotherAddress(google.protobuf.Empty) returns (bluetooth.facade.BluetoothAddressWithType) {} 12 | } 13 | 14 | enum AddressPolicy { 15 | POLICY_NOT_SET = 0x00; 16 | USE_PUBLIC_ADDRESS = 0x01; 17 | USE_STATIC_ADDRESS = 0x02; 18 | USE_NON_RESOLVABLE_ADDRESS = 0x03; 19 | USE_RESOLVABLE_ADDRESS = 0x04; 20 | } 21 | 22 | message PrivacyPolicy { 23 | AddressPolicy address_policy = 1; 24 | facade.BluetoothAddressWithType address_with_type = 2; 25 | bytes rotation_irk = 3; 26 | uint64 minimum_rotation_time = 4; 27 | uint64 maximum_rotation_time = 5; 28 | } 29 | -------------------------------------------------------------------------------- /gd/hci/facade/le_scanning_manager_facade.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package bluetooth.hci.facade; 4 | 5 | import "google/protobuf/empty.proto"; 6 | 7 | service LeScanningManagerFacade { 8 | rpc StartScan(google.protobuf.Empty) returns (stream LeReportMsg) {} 9 | rpc StopScan(google.protobuf.Empty) returns (ScanStoppedMsg) {} 10 | } 11 | 12 | message LeReportMsg { 13 | bytes event = 1; 14 | } 15 | 16 | message ScanStoppedMsg {} 17 | -------------------------------------------------------------------------------- /gd/hci/fuzz/status_vs_complete_commands.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "hci/hci_packets.h" 20 | 21 | namespace bluetooth { 22 | namespace hci { 23 | namespace fuzz { 24 | 25 | bool uses_command_status(hci::OpCode code); 26 | 27 | } 28 | } // namespace hci 29 | } // namespace bluetooth 30 | -------------------------------------------------------------------------------- /gd/hci/hci_acl_manager.fbs: -------------------------------------------------------------------------------- 1 | namespace bluetooth.hci; 2 | 3 | attribute "privacy"; 4 | 5 | table AclManagerData { 6 | title:string (privacy:"Any"); 7 | } 8 | 9 | root_type AclManagerData; 10 | -------------------------------------------------------------------------------- /gd/hci/link_key.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "hci/link_key.h" 18 | 19 | namespace bluetooth { 20 | namespace hci { 21 | 22 | const LinkKey kExampleLinkKey{ 23 | {0x4C, 0x68, 0x38, 0x41, 0x39, 0xf5, 0x74, 0xd8, 0x36, 0xbc, 0xf3, 0x4e, 0x9d, 0xfb, 0x01, 0xbf}}; 24 | } 25 | } // namespace bluetooth -------------------------------------------------------------------------------- /gd/iso/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | filegroup { 11 | name: "BluetoothIsoSources", 12 | srcs: [ 13 | "iso_manager.cc", 14 | "iso_module.cc", 15 | "internal/iso_manager_impl.cc", 16 | ], 17 | } 18 | 19 | filegroup { 20 | name: "BluetoothIsoTestSources", 21 | srcs: [ 22 | ], 23 | } 24 | 25 | filegroup { 26 | name: "BluetoothFacade_iso_layer", 27 | srcs: [ 28 | "facade.cc", 29 | ], 30 | } 31 | -------------------------------------------------------------------------------- /gd/l2cap/classic/dynamic_channel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "l2cap/dynamic_channel.h" 20 | 21 | namespace bluetooth { 22 | namespace l2cap { 23 | namespace classic { 24 | 25 | using DynamicChannel = l2cap::DynamicChannel; 26 | 27 | } // namespace classic 28 | } // namespace l2cap 29 | } // namespace bluetooth 30 | -------------------------------------------------------------------------------- /gd/l2cap/classic/l2cap_classic_module.fbs: -------------------------------------------------------------------------------- 1 | namespace bluetooth.l2cap.classic; 2 | 3 | attribute "privacy"; 4 | 5 | table ChannelData { 6 | cid:int; 7 | } 8 | 9 | table LinkData { 10 | address:string; 11 | dynamic_channels:[ChannelData]; 12 | fixed_channels:[ChannelData]; 13 | } 14 | 15 | table L2capClassicModuleData { 16 | title:string (privacy:"Any"); 17 | active_links:[LinkData] (privacy:"Any"); 18 | } 19 | 20 | root_type L2capClassicModuleData; 21 | -------------------------------------------------------------------------------- /gd/l2cap/mtu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | #include 19 | 20 | namespace bluetooth { 21 | namespace l2cap { 22 | 23 | using Mtu = uint16_t; 24 | 25 | constexpr Mtu kMinimumClassicMtu = 48; 26 | constexpr Mtu kMinimumLeMtu = 23; 27 | constexpr Mtu kDefaultClassicMtu = 672; 28 | 29 | } // namespace l2cap 30 | } // namespace bluetooth 31 | -------------------------------------------------------------------------------- /gd/module_unittest.fbs: -------------------------------------------------------------------------------- 1 | // module_unittest 2 | namespace bluetooth; 3 | 4 | attribute "privacy"; 5 | 6 | table ModuleUnitTestData { 7 | title:string (privacy:"Any"); 8 | } 9 | 10 | root_type ModuleUnitTestData; 11 | -------------------------------------------------------------------------------- /gd/neighbor/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | filegroup { 11 | name: "BluetoothNeighborSources", 12 | srcs: [ 13 | "connectability.cc", 14 | "discoverability.cc", 15 | "inquiry.cc", 16 | "name.cc", 17 | "name_db.cc", 18 | "page.cc", 19 | "scan.cc", 20 | ], 21 | } 22 | 23 | filegroup { 24 | name: "BluetoothNeighborTestSources", 25 | srcs: [ 26 | "inquiry_test.cc", 27 | ], 28 | } 29 | 30 | filegroup { 31 | name: "BluetoothFacade_neighbor", 32 | srcs: [ 33 | "facade/facade.cc", 34 | ], 35 | } 36 | -------------------------------------------------------------------------------- /gd/neighbor/BUILD.gn: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Google, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at: 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | source_set("BluetoothNeighborSources") { 17 | sources = [ 18 | "connectability.cc", 19 | "discoverability.cc", 20 | "inquiry.cc", 21 | "name.cc", 22 | "name_db.cc", 23 | "page.cc", 24 | "scan.cc", 25 | ] 26 | 27 | deps = [ "//bt/gd:gd_default_deps" ] 28 | 29 | configs += [ "//bt/gd:gd_defaults" ] 30 | } 31 | -------------------------------------------------------------------------------- /gd/os/wakelock_manager.fbs: -------------------------------------------------------------------------------- 1 | 2 | namespace bluetooth.os; 3 | 4 | attribute "privacy"; 5 | 6 | table WakelockManagerData { 7 | title:string; 8 | is_acquired:bool; 9 | is_native:bool; 10 | acquired_count:int; 11 | released_count:int; 12 | acquired_error_count:int; 13 | released_error_count:int; 14 | last_acquire_error_code:int; 15 | last_release_error_code:int; 16 | last_acquired_timestamp_millis:int64; 17 | last_released_timestamp_millis:int64; 18 | last_interval_millis:int64; 19 | max_interval_millis:int64; 20 | min_interval_millis:int64; 21 | avg_interval_millis:int64; 22 | total_interval_millis:int64; 23 | total_time_since_reset_millis:int64; 24 | } 25 | 26 | root_type WakelockManagerData; 27 | -------------------------------------------------------------------------------- /gd/packet/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | filegroup { 11 | name: "BluetoothPacketSources", 12 | srcs: [ 13 | "bit_inserter.cc", 14 | "byte_inserter.cc", 15 | "byte_observer.cc", 16 | "iterator.cc", 17 | "fragmenting_inserter.cc", 18 | "packet_view.cc", 19 | "raw_builder.cc", 20 | "view.cc", 21 | ], 22 | } 23 | 24 | filegroup { 25 | name: "BluetoothPacketTestSources", 26 | srcs: [ 27 | "bit_inserter_unittest.cc", 28 | "fragmenting_inserter_unittest.cc", 29 | "packet_builder_unittest.cc", 30 | "packet_view_unittest.cc", 31 | "raw_builder_unittest.cc", 32 | ], 33 | } 34 | -------------------------------------------------------------------------------- /gd/packet/BUILD.gn: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Google 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at: 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | source_set("BluetoothPacketSources") { 18 | sources = [ 19 | "bit_inserter.cc", 20 | "byte_inserter.cc", 21 | "byte_observer.cc", 22 | "fragmenting_inserter.cc", 23 | "iterator.cc", 24 | "packet_view.cc", 25 | "raw_builder.cc", 26 | "view.cc", 27 | ] 28 | 29 | include_dirs = [ "//bt/gd" ] 30 | 31 | configs += [ "//bt:target_defaults" ] 32 | } 33 | -------------------------------------------------------------------------------- /gd/packet/parser/parse_location.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | class ParseLocation { 20 | public: 21 | ParseLocation() : line_(-1) {} 22 | 23 | ParseLocation(int line) : line_(line) {} 24 | 25 | int GetLine() { 26 | return line_; 27 | } 28 | 29 | private: 30 | int line_; 31 | }; 32 | -------------------------------------------------------------------------------- /gd/proto/BUILD.gn: -------------------------------------------------------------------------------- 1 | import("//common-mk/proto_library.gni") 2 | 3 | proto_library("libbt-protos-lite") { 4 | sources = [ 5 | "bluetooth/metrics/bluetooth.proto", 6 | ] 7 | 8 | proto_in_dir = "./bluetooth/metrics" 9 | proto_out_dir = "include/bluetooth/metrics" 10 | } 11 | -------------------------------------------------------------------------------- /gd/rust/README.md: -------------------------------------------------------------------------------- 1 | Rust build 2 | ====== 3 | 4 | Currently, the Rust components are built differently on Android vs Linux. We are 5 | missing Rust support in our GN toolchain so we currently build the Rust 6 | libraries as a staticlib and link in C++. This may change in the future once we 7 | have better support. 8 | 9 | For now, you can build all of the Rust code using Cargo. 10 | 11 | There are some dependencies: 12 | * You must have the protobuf-compiler package installed 13 | * You must have a recent version of Cargo + Rust 14 | 15 | You should use `build.py` at the root to do your Rust builds so that it 16 | correctly points your dependencies towards the vendored crates and sets your 17 | $CARGO_HOME to the correct location. 18 | -------------------------------------------------------------------------------- /gd/rust/common/src/asserts.rs: -------------------------------------------------------------------------------- 1 | /// Assertion check for X is is within Y of Z 2 | #[macro_export] 3 | macro_rules! assert_near { 4 | ($thing:expr, $expected:expr, $error:expr) => { 5 | match (&$thing, &$expected, &$error) { 6 | (thing_val, expected_val, error_val) => { 7 | if thing_val < &(expected_val - error_val) || thing_val > &(expected_val + error_val) { 8 | panic!( 9 | "assertion failed: {:?} is not within {:?} of {:?}", 10 | &*thing_val, &*error_val, &*expected_val 11 | ) 12 | } 13 | } 14 | } 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /gd/rust/common/src/ffi/sys_prop.cc: -------------------------------------------------------------------------------- 1 | #include "sys_prop.h" 2 | #include 3 | 4 | namespace bluetooth { 5 | namespace common { 6 | namespace sys_prop { 7 | 8 | rust::String get(rust::Str property) { 9 | auto name = std::string(property.data(), property.length()); 10 | std::array value_array{0}; 11 | auto value_len = property_get(name.c_str(), value_array.data(), nullptr); 12 | if (value_len <= 0) { 13 | value_len = 0; 14 | } 15 | return rust::String(value_array.data(), value_len); 16 | } 17 | 18 | } // namespace sys_prop 19 | } // namespace common 20 | } // namespace bluetooth 21 | -------------------------------------------------------------------------------- /gd/rust/common/src/ffi/sys_prop.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include "rust/cxx.h" 3 | 4 | namespace bluetooth { 5 | namespace common { 6 | namespace sys_prop { 7 | 8 | rust::String get(rust::Str property); 9 | 10 | } 11 | } // namespace common 12 | } // namespace bluetooth 13 | -------------------------------------------------------------------------------- /gd/rust/common/src/ready.rs: -------------------------------------------------------------------------------- 1 | /// Simplifies polling futures 2 | #[macro_export] 3 | macro_rules! ready { 4 | ($e:expr $(,)?) => { 5 | match $e { 6 | std::task::Poll::Ready(t) => t, 7 | std::task::Poll::Pending => return std::task::Poll::Pending, 8 | } 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /gd/rust/facade/BUILD.gn: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Google, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at: 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | rust_library("libbt_facade_helpers") { 17 | crate_name = "bt_facade_helpers" 18 | sources = [ 19 | "helpers/lib.rs", 20 | ] 21 | 22 | configs = [ 23 | "//bt/gd/rust/shim:rust_libs", 24 | "//bt/gd:rust_defaults", 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /gd/rust/facade_proto/src/common.rs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 Google, Inc. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at: 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | // We are not directly including due to bugs with inner and outer attributes. 17 | //include!(concat!(env!("OUT_DIR"), "/common.rs")); 18 | 19 | #[path = concat!(env!("OUT_DIR", "/common.rs"))] 20 | pub mod common; 21 | -------------------------------------------------------------------------------- /gd/rust/gddi/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | rust_library { 11 | name: "libgddi", 12 | defaults: ["gd_rust_defaults"], 13 | crate_name: "gddi", 14 | srcs: ["src/lib.rs"], 15 | edition: "2018", 16 | proc_macros: ["libgddi_macros"], 17 | rustlibs: ["libtokio"], 18 | } 19 | 20 | rust_proc_macro { 21 | name: "libgddi_macros", 22 | crate_name: "gddi_macros", 23 | srcs: ["macros/lib.rs"], 24 | edition: "2018", 25 | rustlibs: [ 26 | "libproc_macro2", 27 | "libquote", 28 | "libsyn", 29 | ], 30 | } 31 | -------------------------------------------------------------------------------- /gd/rust/gddi/Cargo.toml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Google, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at: 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | [package] 17 | name = "gddi" 18 | version = "0.0.1" 19 | edition = "2018" 20 | 21 | [dependencies] 22 | gddi_macros = { path = "macros" } 23 | 24 | tokio = { version = "*", features = ['bytes', 'net', 'sync'] } 25 | quote = "*" 26 | syn = { version = "*", features = ['default', 'full'] } 27 | 28 | [lib] 29 | path = "src/lib.rs" 30 | crate-type = ["rlib"] 31 | 32 | -------------------------------------------------------------------------------- /gd/rust/gddi/macros/Cargo.toml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Google, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at: 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | [package] 17 | name = "gddi_macros" 18 | version = "0.0.1" 19 | edition = "2018" 20 | 21 | [dependencies] 22 | proc-macro2 = "*" 23 | quote = "*" 24 | syn = "*" 25 | 26 | [lib] 27 | proc-macro = true 28 | path = "lib.rs" 29 | -------------------------------------------------------------------------------- /gd/rust/hal/BUILD.gn: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Google, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at: 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | rust_library("libbt_hal") { 17 | crate_name = "bt_hal" 18 | 19 | sources = [ 20 | "src/lib.rs" 21 | ] 22 | 23 | configs = [ 24 | "//bt/gd/rust/shim:rust_libs", 25 | "//bt/gd:rust_defaults", 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /gd/rust/hal/src/ffi/hidl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "src/hidl_hal.rs.h" 3 | 4 | namespace bluetooth { 5 | namespace hal { 6 | 7 | void start_hal(); 8 | void stop_hal(); 9 | void send_command(rust::Slice data); 10 | void send_acl(rust::Slice data); 11 | void send_sco(rust::Slice data); 12 | void send_iso(rust::Slice data); 13 | 14 | } // namespace hal 15 | } // namespace bluetooth 16 | -------------------------------------------------------------------------------- /gd/rust/hci/BUILD.gn: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Google, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at: 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | rust_library("libbt_hci") { 17 | crate_name = "bt_hci" 18 | 19 | sources = [ 20 | "src/lib.rs" 21 | ] 22 | 23 | configs = [ 24 | "//bt/gd/rust/shim:rust_libs", 25 | "//bt/gd:rust_defaults", 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /gd/rust/hci/custom_types/Cargo.toml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Google, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at: 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | [package] 17 | name = "bt_hci_custom_types" 18 | version = "0.0.1" 19 | edition = "2018" 20 | 21 | [lib] 22 | crate-type = ["rlib"] 23 | path = "lib.rs" 24 | -------------------------------------------------------------------------------- /gd/rust/hci/src/error.rs: -------------------------------------------------------------------------------- 1 | //! Defines the Result type and HCI errors 2 | 3 | use futures::channel::oneshot; 4 | use std::fmt::Debug; 5 | use thiserror::Error; 6 | use tokio::sync::mpsc::error::SendError; 7 | use tokio::sync::oneshot::error::RecvError; 8 | 9 | /// Result type 10 | pub type Result = std::result::Result>; 11 | 12 | /// HCI errors 13 | #[derive(Error, Debug)] 14 | pub enum HciError { 15 | /// Error when sending on a bounded channel 16 | #[error("Error sending: {0}")] 17 | BoundedSendError(#[from] SendError), 18 | /// Error when sending on a oneshot channel 19 | #[error("Error sending: {0}")] 20 | OneshotSendError(#[from] oneshot::Canceled), 21 | /// Error receiving from a channel 22 | #[error("Error receiving: {0}")] 23 | ChannelRecvError(#[from] RecvError), 24 | } 25 | -------------------------------------------------------------------------------- /gd/rust/link/src/acl/mod.rs: -------------------------------------------------------------------------------- 1 | //! ACL management 2 | 3 | /// Exposes classic ACL functionality 4 | pub mod classic; 5 | mod core; 6 | mod fragment; 7 | 8 | use gddi::module; 9 | 10 | module! { 11 | acl_module, 12 | submodules { 13 | classic::classic_acl_module, 14 | core::core_module, 15 | }, 16 | } 17 | -------------------------------------------------------------------------------- /gd/rust/link/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! link management 2 | 3 | /// Exposes ACL functionality 4 | pub mod acl; 5 | 6 | use gddi::module; 7 | 8 | module! { 9 | link_module, 10 | submodules { 11 | acl::acl_module, 12 | }, 13 | } 14 | -------------------------------------------------------------------------------- /gd/rust/linux/dbus_projection/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "dbus_projection" 3 | version = "0.1.0" 4 | edition = "2018" 5 | 6 | [dependencies] 7 | dbus = "0.9.2" 8 | -------------------------------------------------------------------------------- /gd/rust/linux/dbus_projection/dbus_macros/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "dbus_macros" 3 | version = "0.1.0" 4 | edition = "2018" 5 | 6 | [lib] 7 | proc-macro = true 8 | 9 | [dependencies] 10 | syn = "1.0" 11 | quote = "1.0" 12 | proc-macro2 = "1.0" 13 | -------------------------------------------------------------------------------- /gd/rust/linux/mgmt/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "manager_service" 3 | version = "0.0.1" 4 | edition = "2018" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | 10 | # bt deps 11 | bt_common = { path = "../../common" } 12 | 13 | # external deps 14 | dbus = "0.9.2" 15 | dbus-tokio = "0.7.3" 16 | dbus-crossroads = "0.3.0" 17 | inotify = "*" 18 | nix = "*" 19 | tokio = { version = "1.0", features = ["fs", "macros", "rt-multi-thread", "sync"] } 20 | 21 | [[bin]] 22 | name = "btmanagerd" 23 | -------------------------------------------------------------------------------- /gd/rust/linux/service/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "btserv" 3 | version = "0.1.0" 4 | edition = "2018" 5 | 6 | [dependencies] 7 | bt_topshim = { path = "../../topshim" } 8 | bt_shim = { path = "../../shim" } 9 | btstack = { path = "../stack" } 10 | dbus_projection = { path = "../dbus_projection" } 11 | dbus_macros = { path = "../dbus_projection/dbus_macros" } 12 | 13 | dbus = "0.9.2" 14 | dbus-crossroads = "0.3.0" 15 | dbus-tokio = "0.7.3" 16 | futures = "0.3.13" 17 | num-traits = "*" 18 | tokio = { version = "1", features = ['bytes', 'fs', 'io-util', 'libc', 'macros', 'memchr', 'mio', 'net', 'num_cpus', 'rt', 'rt-multi-thread', 'sync', 'time', 'tokio-macros'] } 19 | 20 | [build-dependencies] 21 | pkg-config = "0.3.19" 22 | 23 | [[bin]] 24 | name = "btserv" 25 | path = "src/main.rs" 26 | build = "build.rs" 27 | -------------------------------------------------------------------------------- /gd/rust/linux/service/src/dbus_arg.rs: -------------------------------------------------------------------------------- 1 | use dbus_macros::generate_dbus_arg; 2 | 3 | generate_dbus_arg!(); 4 | -------------------------------------------------------------------------------- /gd/rust/linux/stack/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "btstack" 3 | version = "0.1.0" 4 | edition = "2018" 5 | 6 | [dependencies] 7 | bt_topshim = { path = "../../topshim" } 8 | bt_shim = { path = "../../shim" } 9 | 10 | btif_macros = { path = "btif_macros" } 11 | 12 | dbus = "0.9.2" 13 | 14 | num-traits = "*" 15 | num-derive = "*" 16 | 17 | tokio = { version = "1", features = ['bytes', 'fs', 'io-util', 'libc', 'macros', 'memchr', 'mio', 'net', 'num_cpus', 'rt', 'rt-multi-thread', 'sync', 'time', 'tokio-macros'] } 18 | 19 | [lib] 20 | path = "src/lib.rs" 21 | -------------------------------------------------------------------------------- /gd/rust/linux/stack/btif_macros/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "btif_macros" 3 | version = "0.1.0" 4 | edition = "2018" 5 | 6 | [lib] 7 | proc-macro = true 8 | 9 | [dependencies] 10 | syn = "1.0" 11 | quote = "1.0" 12 | proc-macro2 = "1.0" 13 | -------------------------------------------------------------------------------- /gd/rust/main/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | rust_library { 11 | name: "libbt_main", 12 | defaults: ["gd_rust_defaults"], 13 | crate_name: "bt_main", 14 | srcs: ["src/lib.rs"], 15 | edition: "2018", 16 | rustlibs: [ 17 | "libbt_hal", 18 | "libbt_hci", 19 | "libtokio", 20 | "libgddi", 21 | "libbt_common", 22 | "libgrpcio", 23 | ], 24 | } 25 | -------------------------------------------------------------------------------- /gd/rust/packets/Cargo.toml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 Google, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at: 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | [package] 17 | name = "bt_packets" 18 | version = "0.0.1" 19 | edition = "2018" 20 | build = "build.rs" 21 | 22 | [dependencies] 23 | bt_hci_custom_types = { path = "../hci/custom_types" } 24 | 25 | bindgen = "*" 26 | bytes = "*" 27 | num-derive = "*" 28 | num-traits = "*" 29 | thiserror = "*" 30 | walkdir = "*" 31 | 32 | [lib] 33 | path = "lib.rs" 34 | crate-types = ["rlib"] 35 | -------------------------------------------------------------------------------- /gd/rust/packets/lib.rs: -------------------------------------------------------------------------------- 1 | //! reimport of generated packets (to go away once rust_genrule exists) 2 | 3 | #![allow(clippy::all)] 4 | #![allow(unused)] 5 | #![allow(missing_docs)] 6 | 7 | pub mod hci { 8 | use bt_hci_custom_types::*; 9 | 10 | include!(concat!(env!("OUT_DIR"), "/hci_packets.rs")); 11 | } 12 | -------------------------------------------------------------------------------- /gd/rust/shim/callbacks/callbacks.cc: -------------------------------------------------------------------------------- 1 | #include "callbacks/callbacks.h" 2 | -------------------------------------------------------------------------------- /gd/rust/shim/src/init_flags.rs: -------------------------------------------------------------------------------- 1 | #[cxx::bridge(namespace = bluetooth::common::init_flags)] 2 | mod ffi { 3 | extern "Rust" { 4 | fn load(flags: Vec); 5 | fn set_all_for_testing(); 6 | 7 | fn gd_core_is_enabled() -> bool; 8 | fn gd_security_is_enabled() -> bool; 9 | fn gd_advertising_is_enabled() -> bool; 10 | fn gd_scanning_is_enabled() -> bool; 11 | fn gd_acl_is_enabled() -> bool; 12 | fn gd_l2cap_is_enabled() -> bool; 13 | fn gd_hci_is_enabled() -> bool; 14 | fn gd_controller_is_enabled() -> bool; 15 | fn gatt_robust_caching_is_enabled() -> bool; 16 | fn btaa_hci_is_enabled() -> bool; 17 | fn gd_rust_is_enabled() -> bool; 18 | fn gd_link_policy_is_enabled() -> bool; 19 | } 20 | } 21 | 22 | use bt_common::init_flags::*; 23 | -------------------------------------------------------------------------------- /gd/rust/shim/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! The main entry point for the legacy C++ code 2 | #[macro_use] 3 | extern crate lazy_static; 4 | 5 | mod bridge; 6 | mod controller; 7 | mod hci; 8 | mod init_flags; 9 | mod message_loop_thread; 10 | mod stack; 11 | -------------------------------------------------------------------------------- /gd/rust/topshim/bindings/wrapper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "include/hardware/bluetooth.h" 4 | -------------------------------------------------------------------------------- /gd/rust/topshim/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! The main entry point for Rust to C++. 2 | #[macro_use] 3 | extern crate lazy_static; 4 | #[macro_use] 5 | extern crate num_derive; 6 | 7 | pub mod btif; 8 | pub mod topstack; 9 | -------------------------------------------------------------------------------- /gd/rust/topshim/src/topstack.rs: -------------------------------------------------------------------------------- 1 | //! Stack on top of the Bluetooth interface shim 2 | //! 3 | //! Helpers for dealing with the stack on top of the Bluetooth interface. 4 | 5 | use std::sync::Arc; 6 | use tokio::runtime::{Builder, Runtime}; 7 | 8 | lazy_static! { 9 | // Shared runtime for topshim handlers. All async tasks will get run by this 10 | // runtime and this will properly serialize all spawned tasks. 11 | pub static ref RUNTIME: Arc = Arc::new( 12 | Builder::new_multi_thread() 13 | .worker_threads(1) 14 | .max_blocking_threads(1) 15 | .enable_all() 16 | .build() 17 | .unwrap() 18 | ); 19 | } 20 | 21 | pub fn get_runtime() -> Arc { 22 | RUNTIME.clone() 23 | } 24 | -------------------------------------------------------------------------------- /gd/security/channel/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | filegroup { 11 | name: "BluetoothSecurityChannelSources", 12 | srcs: [ 13 | "security_manager_channel.cc", 14 | ] 15 | } 16 | 17 | filegroup { 18 | name: "BluetoothSecurityChannelTestSources", 19 | srcs: [ 20 | "security_manager_channel_unittest.cc", 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /gd/security/pairing/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | filegroup { 11 | name: "BluetoothSecurityPairingSources", 12 | srcs: [ 13 | "classic_pairing_handler.cc", 14 | ] 15 | } 16 | 17 | filegroup { 18 | name: "BluetoothSecurityPairingTestSources", 19 | srcs: [ 20 | "classic_pairing_handler_unittest.cc", 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /gd/security/record/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | filegroup { 11 | name: "BluetoothSecurityRecordSources", 12 | srcs: [ 13 | "security_record_storage.cc" 14 | ], 15 | } 16 | 17 | filegroup { 18 | name: "BluetoothSecurityRecordTestSources", 19 | srcs: [ 20 | "security_record_storage_test.cc" 21 | ], 22 | } 23 | -------------------------------------------------------------------------------- /gd/shim/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | filegroup { 11 | name: "BluetoothShimSources", 12 | srcs: [ 13 | "dumpsys.cc", 14 | "dumpsys_args.cc", 15 | ] 16 | } 17 | 18 | filegroup { 19 | name: "BluetoothShimTestSources", 20 | srcs: [ 21 | "dumpsys_test.cc", 22 | "dumpsys_args_test.cc", 23 | ], 24 | } 25 | 26 | filegroup { 27 | name: "BluetoothFacade_shim_layer", 28 | srcs: [ 29 | "facade/facade.cc", 30 | ], 31 | } 32 | -------------------------------------------------------------------------------- /gd/shim/cert/stack_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # 3 | # Copyright 2020 - The Android Open Source Project 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | import os 18 | import sys 19 | 20 | from cert.gd_base_test import GdBaseTestClass 21 | 22 | 23 | class StackTest(GdBaseTestClass): 24 | 25 | def setup_class(self): 26 | super().setup_class(dut_module='SHIM', cert_module='SHIM') 27 | 28 | def test_test(self): 29 | return True 30 | -------------------------------------------------------------------------------- /gd/shim/dumpsys.fbs: -------------------------------------------------------------------------------- 1 | // shim::dumpsys data 2 | namespace bluetooth.shim; 3 | 4 | attribute "privacy"; 5 | 6 | table ExamplePiecemealTable { 7 | example_string:string (privacy:"Any"); 8 | example_int:int (privacy:"Any"); 9 | example_float:float (privacy:"Any"); 10 | } 11 | 12 | table ExampleInstantTable { 13 | example_string:string (privacy:"Any"); 14 | example_int:int (privacy:"Any"); 15 | example_float:float (privacy:"Any"); 16 | } 17 | 18 | table DumpsysModuleData { 19 | title:string (privacy:"Any"); 20 | number_of_bundled_schemas:int (privacy:"Any"); 21 | example_piecemeal_table:ExamplePiecemealTable (privacy:"Any"); 22 | example_instant_table:ExampleInstantTable (privacy:"Any"); 23 | } 24 | 25 | root_type DumpsysModuleData; 26 | -------------------------------------------------------------------------------- /gd/shim/dumpsys_args.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | namespace bluetooth { 20 | namespace shim { 21 | 22 | class ParsedDumpsysArgs { 23 | public: 24 | ParsedDumpsysArgs(const char** args); 25 | bool IsDeveloper() const; 26 | 27 | private: 28 | unsigned num_args_{0}; 29 | bool dev_arg_{false}; 30 | }; 31 | 32 | } // namespace shim 33 | } // namespace bluetooth 34 | -------------------------------------------------------------------------------- /gd/shim/facade/facade.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package bluetooth.shim.facade; 4 | 5 | import "google/protobuf/empty.proto"; 6 | 7 | service ShimFacade { 8 | rpc Dump(google.protobuf.Empty) returns (stream DumpsysMsg) {} 9 | } 10 | 11 | message DumpsysMsg { 12 | bytes data = 1; 13 | } 14 | -------------------------------------------------------------------------------- /gd/shim/test_data/dumpsys_data.bfbs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LineageOS/android_system_bt/edc95ad08dc40d56a6ac00f4da98ca918ed04f9e/gd/shim/test_data/dumpsys_data.bfbs -------------------------------------------------------------------------------- /gd/shim/test_data/dumpsys_test_data_bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LineageOS/android_system_bt/edc95ad08dc40d56a6ac00f4da98ca918ed04f9e/gd/shim/test_data/dumpsys_test_data_bin -------------------------------------------------------------------------------- /hci/include/buffer_allocator.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright 2014 Google, Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | ******************************************************************************/ 18 | 19 | #pragma once 20 | 21 | #include "osi/include/allocator.h" 22 | 23 | const allocator_t* buffer_allocator_get_interface(); 24 | -------------------------------------------------------------------------------- /include/array_utils.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 Google, Inc. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at: 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | #pragma once 17 | 18 | #ifndef ARRAY_SIZE 19 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) 20 | #endif 21 | -------------------------------------------------------------------------------- /internal_include/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | cc_library_headers { 11 | name: "internal_include_headers", 12 | export_include_dirs: ["./"], 13 | vendor_available: true, 14 | host_supported: true, 15 | } 16 | -------------------------------------------------------------------------------- /internal_include/bt_common.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright 2015 Google, Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | ******************************************************************************/ 18 | 19 | #pragma once 20 | 21 | #include "bt_target.h" 22 | #include "bt_types.h" 23 | #include "osi/include/allocator.h" 24 | #include "osi/include/compat.h" 25 | -------------------------------------------------------------------------------- /main/shim/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | filegroup { 11 | name: "LibBluetoothShimSources", 12 | srcs: [ 13 | "acl.cc", 14 | "acl_api.cc", 15 | "acl_legacy_interface.cc", 16 | "activity_attribution.cc", 17 | "btm.cc", 18 | "btm_api.cc", 19 | "config.cc", 20 | "controller.cc", 21 | "dumpsys.cc", 22 | "entry.cc", 23 | "hci_layer.cc", 24 | "l2c_api.cc", 25 | "le_advertising_manager.cc", 26 | "le_scanning_manager.cc", 27 | "link_policy.cc", 28 | "metric_id_api.cc", 29 | "metrics_api.cc", 30 | "shim.cc", 31 | "stack.cc", 32 | "utils.cc", 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /main/shim/controller.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "device/include/controller.h" 20 | 21 | static const char GD_CONTROLLER_MODULE[] = "gd_controller_module"; 22 | 23 | namespace bluetooth { 24 | namespace shim { 25 | 26 | const controller_t* controller_get_interface(); 27 | 28 | } // namespace shim 29 | } // namespace bluetooth 30 | -------------------------------------------------------------------------------- /main/shim/le_scanning_manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Gd shim layer to legacy le scanner 19 | */ 20 | #pragma once 21 | 22 | #include "include/hardware/ble_scanner.h" 23 | 24 | namespace bluetooth { 25 | namespace shim { 26 | 27 | BleScannerInterface* get_ble_scanner_instance(); 28 | void init_scanning_manager(); 29 | 30 | } // namespace shim 31 | } // namespace bluetooth -------------------------------------------------------------------------------- /osi/include/log.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright 2014 Google, Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | ******************************************************************************/ 18 | 19 | #pragma once 20 | 21 | #include "gd/common/init_flags.h" 22 | 23 | #ifndef OSI_INCLUDE_LOG_H 24 | #define OSI_INCLUDE_LOG_H 25 | #endif 26 | 27 | #include "gd/os/log.h" 28 | 29 | #undef OSI_INCLUDE_LOG_H -------------------------------------------------------------------------------- /osi/include/mutex.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright 2015 Google, Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | ******************************************************************************/ 18 | 19 | #pragma once 20 | 21 | #include 22 | 23 | // Lock the global mutex 24 | void mutex_global_lock(void); 25 | 26 | // Unlock the global mutex 27 | void mutex_global_unlock(void); 28 | -------------------------------------------------------------------------------- /osi/test/fuzzers/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | cc_defaults { 11 | name: "libosi_fuzz_defaults", 12 | defaults: ["fluoride_osi_defaults"], 13 | host_supported: true, 14 | static_libs: [ 15 | "libosi", 16 | ], 17 | } 18 | -------------------------------------------------------------------------------- /osi/test/fuzzers/alarm/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | cc_fuzz { 11 | name: "libosi_fuzz_alarm", 12 | defaults: ["libosi_fuzz_defaults"], 13 | host_supported: false, 14 | srcs: [ 15 | "fuzz_alarm.cc", 16 | ], 17 | shared_libs: [ 18 | "liblog", 19 | "libprotobuf-cpp-lite", 20 | "libcutils", 21 | "libcrypto", 22 | ], 23 | static_libs: [ 24 | "libbt-common", 25 | "libbt-protos-lite", 26 | "libgmock", 27 | "libosi", 28 | ], 29 | cflags: [ "-Wno-unused-function" ], 30 | } 31 | -------------------------------------------------------------------------------- /osi/test/fuzzers/allocation_tracker/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | cc_fuzz { 11 | name: "libosi_fuzz_allocation_tracker", 12 | defaults: ["libosi_fuzz_defaults"], 13 | host_supported: true, 14 | srcs: [ 15 | "fuzz_allocation_tracker.cc", 16 | ], 17 | shared_libs: [ 18 | "liblog", 19 | ], 20 | static_libs: [ 21 | "libosi", 22 | ], 23 | corpus: [ 24 | "corpus/checkfail-regression-156805580", 25 | ], 26 | } 27 | -------------------------------------------------------------------------------- /osi/test/fuzzers/allocation_tracker/corpus/checkfail-regression-156805580: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LineageOS/android_system_bt/edc95ad08dc40d56a6ac00f4da98ca918ed04f9e/osi/test/fuzzers/allocation_tracker/corpus/checkfail-regression-156805580 -------------------------------------------------------------------------------- /osi/test/fuzzers/allocator/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | cc_fuzz { 11 | name: "libosi_fuzz_allocator", 12 | defaults: ["libosi_fuzz_defaults"], 13 | host_supported: true, 14 | srcs: [ 15 | "fuzz_allocator.cc", 16 | ], 17 | static_libs: [ 18 | "libosi", 19 | "liblog", 20 | ], 21 | } 22 | -------------------------------------------------------------------------------- /osi/test/fuzzers/array/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | cc_fuzz { 11 | name: "libosi_fuzz_array", 12 | defaults: ["libosi_fuzz_defaults"], 13 | host_supported: true, 14 | srcs: [ 15 | "fuzz_array.cc", 16 | ], 17 | shared_libs: [ 18 | "liblog", 19 | ], 20 | static_libs: [ 21 | "libosi", 22 | ], 23 | } 24 | -------------------------------------------------------------------------------- /osi/test/fuzzers/buffer/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | cc_fuzz { 11 | name: "libosi_fuzz_buffer", 12 | defaults: ["libosi_fuzz_defaults"], 13 | host_supported: true, 14 | srcs: [ 15 | "fuzz_buffer.cc", 16 | ], 17 | shared_libs: [ 18 | "liblog", 19 | ], 20 | static_libs: [ 21 | "libosi", 22 | ], 23 | } 24 | -------------------------------------------------------------------------------- /osi/test/fuzzers/compat/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | cc_fuzz { 11 | name: "libosi_fuzz_compat", 12 | defaults: ["libosi_fuzz_defaults"], 13 | host_supported: true, 14 | srcs: [ 15 | "fuzz_compat.cc", 16 | ], 17 | shared_libs: [ 18 | "liblog", 19 | "libcutils", 20 | ], 21 | static_libs: [ 22 | "libosi", 23 | ], 24 | } 25 | -------------------------------------------------------------------------------- /osi/test/fuzzers/fixed_queue/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | cc_fuzz { 11 | name: "libosi_fuzz_fixed_queue", 12 | defaults: ["libosi_fuzz_defaults"], 13 | host_supported: true, 14 | srcs: [ 15 | "fuzz_fixed_queue.cc", 16 | ], 17 | shared_libs: [ 18 | "liblog", 19 | "libcutils", 20 | ], 21 | static_libs: [ 22 | "libosi", 23 | ], 24 | } 25 | -------------------------------------------------------------------------------- /osi/test/fuzzers/future/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | cc_fuzz { 11 | name: "libosi_fuzz_future", 12 | defaults: ["libosi_fuzz_defaults"], 13 | host_supported: true, 14 | srcs: [ 15 | "fuzz_future.cc", 16 | ], 17 | shared_libs: [ 18 | "liblog", 19 | "libcutils", 20 | ], 21 | static_libs: [ 22 | "libosi", 23 | ], 24 | } 25 | -------------------------------------------------------------------------------- /osi/test/fuzzers/list/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | cc_fuzz { 11 | name: "libosi_fuzz_list", 12 | defaults: ["libosi_fuzz_defaults"], 13 | host_supported: true, 14 | srcs: [ 15 | "fuzz_list.cc", 16 | ], 17 | static_libs: [ 18 | "libosi", 19 | "liblog", 20 | ], 21 | } 22 | -------------------------------------------------------------------------------- /osi/test/fuzzers/ringbuffer/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | cc_fuzz { 11 | name: "libosi_fuzz_ringbuffer", 12 | defaults: ["libosi_fuzz_defaults"], 13 | host_supported: true, 14 | srcs: [ 15 | "fuzz_ringbuffer.cc", 16 | ], 17 | static_libs: [ 18 | "libosi", 19 | "liblog", 20 | ], 21 | } 22 | -------------------------------------------------------------------------------- /osi/test/rand_test.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "AllocationTestHarness.h" 4 | 5 | #include "osi/include/osi.h" 6 | 7 | class RandTest : public AllocationTestHarness {}; 8 | 9 | TEST_F(RandTest, test_rand) { 10 | // We can't guarantee any distribution 11 | // We'd like it to not crash though. 12 | for (int i = 0; i < 10; i++) { 13 | int x; 14 | x = osi_rand(); 15 | EXPECT_TRUE(x >= 0); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packet/base/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | cc_library_static { 11 | name: "lib-bt-packets-base", 12 | defaults: ["libchrome_support_defaults"], 13 | export_include_dirs: ["./"], 14 | host_supported: true, 15 | srcs: [ 16 | "packet.cc", 17 | "iterator.cc", 18 | "packet_builder.cc", 19 | ], 20 | apex_available: [ 21 | "//apex_available:platform", 22 | "com.android.bluetooth.updatable", 23 | ], 24 | } 25 | -------------------------------------------------------------------------------- /packet/include/packet.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "base/iterator.h" 20 | #include "base/packet.h" 21 | #include "base/packet_builder.h" -------------------------------------------------------------------------------- /packet/tests/fuzzers/corpus/avrcp_browse_packet_corpus/validpacket: -------------------------------------------------------------------------------- 1 | q,, 2 | ,,,,,,,,,, -------------------------------------------------------------------------------- /packet/tests/fuzzers/corpus/avrcp_packet_corpus/validpacket: -------------------------------------------------------------------------------- 1 | HX -------------------------------------------------------------------------------- /packet/tests/fuzzers/corpus/avrcp_test_packets_corpus/validpacket: -------------------------------------------------------------------------------- 1 | r  -------------------------------------------------------------------------------- /packet/tests/fuzzers/corpus/change_path_packet_corpus/validpacket: -------------------------------------------------------------------------------- 1 | r  -------------------------------------------------------------------------------- /packet/tests/fuzzers/corpus/get_capabilities_packet_corpus/validpacket: -------------------------------------------------------------------------------- 1 | r  -------------------------------------------------------------------------------- /packet/tests/fuzzers/corpus/get_item_attributes_packet_corpus/validpacket: -------------------------------------------------------------------------------- 1 | s( -------------------------------------------------------------------------------- /packet/tests/fuzzers/corpus/get_play_status_packet_corpus/validpacket: -------------------------------------------------------------------------------- 1 | HX0 -------------------------------------------------------------------------------- /packet/tests/fuzzers/corpus/get_total_number_of_items_corpus/validpacket: -------------------------------------------------------------------------------- 1 | u -------------------------------------------------------------------------------- /packet/tests/fuzzers/corpus/pass_through_packet_corpus/validpacket: -------------------------------------------------------------------------------- 1 | H|D -------------------------------------------------------------------------------- /packet/tests/fuzzers/corpus/play_item_packet_corpus/validpacket: -------------------------------------------------------------------------------- 1 | HXt  -------------------------------------------------------------------------------- /packet/tests/fuzzers/corpus/register_notification_packet_corpus/validpacket: -------------------------------------------------------------------------------- 1 | HX1 -------------------------------------------------------------------------------- /packet/tests/fuzzers/corpus/set_absolute_volume_packet_corpus/validpacket: -------------------------------------------------------------------------------- 1 | HXPH -------------------------------------------------------------------------------- /packet/tests/fuzzers/corpus/set_addressed_player_packet_corpus/validpacket: -------------------------------------------------------------------------------- 1 | HX` -------------------------------------------------------------------------------- /packet/tests/fuzzers/corpus/set_browsed_player_packet_corpus/validpacket: -------------------------------------------------------------------------------- 1 | p -------------------------------------------------------------------------------- /packet/tests/fuzzers/corpus/vendor_packet_corpus/validpacket: -------------------------------------------------------------------------------- 1 | HX -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/change_path_error_response: -------------------------------------------------------------------------------- 1 | r -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/change_path_request: -------------------------------------------------------------------------------- 1 | r  -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/change_path_response: -------------------------------------------------------------------------------- 1 | r -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/change_path_up_request: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LineageOS/android_system_bt/edc95ad08dc40d56a6ac00f4da98ca918ed04f9e/profile/avrcp/tests/avrcp_device_fuzz/corpus/change_path_up_request -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/changed_play_pos_notification: -------------------------------------------------------------------------------- 1 | HX1 -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/changed_volume_changed_notification: -------------------------------------------------------------------------------- 1 | HX1 G -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/general_reject_invalid_command_packet: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LineageOS/android_system_bt/edc95ad08dc40d56a6ac00f4da98ca918ed04f9e/profile/avrcp/tests/avrcp_device_fuzz/corpus/general_reject_invalid_command_packet -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_capabilities_request: -------------------------------------------------------------------------------- 1 | HX -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_capabilities_request_company_id: -------------------------------------------------------------------------------- 1 | HX -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_capabilities_request_unknown: -------------------------------------------------------------------------------- 1 | HX -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_capabilities_response_company_id: -------------------------------------------------------------------------------- 1 | HXX#E -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_capabilities_response_events_supported: -------------------------------------------------------------------------------- 1 | HX -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_element_attributes_request_full: -------------------------------------------------------------------------------- 1 | HX % -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_element_attributes_request_partial: -------------------------------------------------------------------------------- 1 | HX  -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_elements_attributes_response_full: -------------------------------------------------------------------------------- 1 | HX gj Test Songj Test Artistj 2 | Test Albumj1j2j 3 | Test Genrej1000 -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_folder_items_error_response: -------------------------------------------------------------------------------- 1 | q -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_folder_items_folder_response: -------------------------------------------------------------------------------- 1 | q!j Test Folder -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_folder_items_media_player_response: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LineageOS/android_system_bt/edc95ad08dc40d56a6ac00f4da98ca918ed04f9e/profile/avrcp/tests/avrcp_device_fuzz/corpus/get_folder_items_media_player_response -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_folder_items_request: -------------------------------------------------------------------------------- 1 | q 2 |  -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_folder_items_request_no_attrs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LineageOS/android_system_bt/edc95ad08dc40d56a6ac00f4da98ca918ed04f9e/profile/avrcp/tests/avrcp_device_fuzz/corpus/get_folder_items_request_no_attrs -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_folder_items_request_now_playing: -------------------------------------------------------------------------------- 1 | q 2 |  -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_folder_items_request_title: -------------------------------------------------------------------------------- 1 | q  -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_folder_items_request_vfs: -------------------------------------------------------------------------------- 1 | q -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_folder_items_song_response: -------------------------------------------------------------------------------- 1 | q2*j 2 | Test Titlej 3 | Test Title -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_item_attributes_request_all_attributes: -------------------------------------------------------------------------------- 1 | s( -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_item_attributes_request_all_attributes_invalid: -------------------------------------------------------------------------------- 1 | s( -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_item_attributes_song_response: -------------------------------------------------------------------------------- 1 | s8j Test Songj Test Artistj 2 | Test Album -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_play_status_request: -------------------------------------------------------------------------------- 1 | HX0 -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_play_status_response: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LineageOS/android_system_bt/edc95ad08dc40d56a6ac00f4da98ca918ed04f9e/profile/avrcp/tests/avrcp_device_fuzz/corpus/get_play_status_response -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_total_number_of_items_request_media_players: -------------------------------------------------------------------------------- 1 | u -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_total_number_of_items_request_now_playing: -------------------------------------------------------------------------------- 1 | u -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_total_number_of_items_request_vfs: -------------------------------------------------------------------------------- 1 | u -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/get_total_number_of_items_response: -------------------------------------------------------------------------------- 1 | u -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/interim_addressed_player_notification: -------------------------------------------------------------------------------- 1 | HX1  -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/interim_available_players_notification: -------------------------------------------------------------------------------- 1 | HX1 2 | -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/interim_now_playing_notification: -------------------------------------------------------------------------------- 1 | HX1 -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/interim_play_status_notification: -------------------------------------------------------------------------------- 1 | HX1 -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/interim_track_changed_notification: -------------------------------------------------------------------------------- 1 | HX1  -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/interim_uids_notificaiton: -------------------------------------------------------------------------------- 1 | HX1 -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/interim_volume_changed_notification: -------------------------------------------------------------------------------- 1 | HX1 G -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/pass_through_command_play_pushed: -------------------------------------------------------------------------------- 1 | H|D -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/pass_through_command_play_released: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LineageOS/android_system_bt/edc95ad08dc40d56a6ac00f4da98ca918ed04f9e/profile/avrcp/tests/avrcp_device_fuzz/corpus/pass_through_command_play_released -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/play_item_request: -------------------------------------------------------------------------------- 1 | HXt  -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/play_item_response: -------------------------------------------------------------------------------- 1 | HXt -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/register_notification_invalid: -------------------------------------------------------------------------------- 1 | HX1 -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/register_play_status_notification: -------------------------------------------------------------------------------- 1 | HX1 -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/register_volume_changed_notification: -------------------------------------------------------------------------------- 1 | HX1 -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/reject_player_app_settings_response: -------------------------------------------------------------------------------- 1 | 2 | HX -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/rejected_volume_changed_notification: -------------------------------------------------------------------------------- 1 | 2 | HX1 -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/set_absolute_volume_request: -------------------------------------------------------------------------------- 1 | HXPH -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/set_absolute_volume_response: -------------------------------------------------------------------------------- 1 | HXPC -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/set_addressed_player_id_1_request: -------------------------------------------------------------------------------- 1 | HX` -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/set_addressed_player_request: -------------------------------------------------------------------------------- 1 | HX` -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/set_addressed_player_response: -------------------------------------------------------------------------------- 1 | HX` -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/set_browsed_player_request: -------------------------------------------------------------------------------- 1 | p -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/set_browsed_player_response: -------------------------------------------------------------------------------- 1 | p 2 | j -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/short_browse_packet: -------------------------------------------------------------------------------- 1 | q 2 | -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/short_change_path_request: -------------------------------------------------------------------------------- 1 | r -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/short_get_capabilities_request: -------------------------------------------------------------------------------- 1 | HX -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/short_get_element_attributes_request: -------------------------------------------------------------------------------- 1 | HX -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/short_get_folder_items_request: -------------------------------------------------------------------------------- 1 | q -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/short_get_item_attributes_request: -------------------------------------------------------------------------------- 1 | s -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/short_get_total_number_of_items_request: -------------------------------------------------------------------------------- 1 | u -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/short_play_item_request: -------------------------------------------------------------------------------- 1 | HXt -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/short_set_addressed_player_request: -------------------------------------------------------------------------------- 1 | HX` -------------------------------------------------------------------------------- /profile/avrcp/tests/avrcp_device_fuzz/corpus/short_vendor_packet: -------------------------------------------------------------------------------- 1 | HX -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | ../../build/soong/scripts/rustfmt.toml 2 | -------------------------------------------------------------------------------- /service/bluetoothtbd.rc: -------------------------------------------------------------------------------- 1 | service bluetoothtbd /system/bin/bluetoothtbd 2 | class main 3 | user bluetooth 4 | group wakelock net_bt_admin bluetooth net_admin 5 | -------------------------------------------------------------------------------- /service/common/README: -------------------------------------------------------------------------------- 1 | This directory contains all the "common" sources between the bluetooth daemon 2 | and our client library. All source files here are under the "bluetooth" 3 | subdirectory, which is the exported root path for the client static library. 4 | Only common files should go here. All headers that go into common/bluetooth must 5 | only include other headers from common/bluetooth and must use "bluetooth" as the 6 | root path, e.g.: 7 | 8 | #include 9 | 10 | This is so that client applications that link against the client library have 11 | one common include path exported to them, and our headers can find eachother 12 | within that. 13 | -------------------------------------------------------------------------------- /service/common/android/bluetooth/AdvertiseData.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable AdvertiseData cpp_header "android/bluetooth/advertise_data.h"; 20 | -------------------------------------------------------------------------------- /service/common/android/bluetooth/AdvertiseSettings.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable AdvertiseSettings cpp_header "android/bluetooth/advertise_settings.h"; 20 | -------------------------------------------------------------------------------- /service/common/android/bluetooth/BluetoothA2dpCodecConfig.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable BluetoothA2dpCodecConfig cpp_header "android/bluetooth/bluetooth_a2dp_codec_config.h"; 20 | -------------------------------------------------------------------------------- /service/common/android/bluetooth/BluetoothAvrcpIntValue.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable BluetoothAvrcpIntValue cpp_header "android/bluetooth/bluetooth_avrcp_int_value.h"; 20 | -------------------------------------------------------------------------------- /service/common/android/bluetooth/BluetoothAvrcpMediaAttr.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable BluetoothAvrcpMediaAttr cpp_header "android/bluetooth/bluetooth_avrcp_media_attr.h"; 20 | -------------------------------------------------------------------------------- /service/common/android/bluetooth/BluetoothAvrcpRegisterNotificationResponse.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable BluetoothAvrcpRegisterNotificationResponse cpp_header "android/bluetooth/bluetooth_avrcp_register_notification_response.h"; 20 | -------------------------------------------------------------------------------- /service/common/android/bluetooth/BluetoothAvrcpStringValue.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable BluetoothAvrcpStringValue cpp_header "android/bluetooth/bluetooth_avrcp_string_value.h"; 20 | -------------------------------------------------------------------------------- /service/common/android/bluetooth/BluetoothGattCharacteristic.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable BluetoothGattCharacteristic cpp_header "android/bluetooth/bluetooth_gatt_characteristic.h"; 20 | -------------------------------------------------------------------------------- /service/common/android/bluetooth/BluetoothGattDescriptor.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable BluetoothGattDescriptor cpp_header "android/bluetooth/bluetooth_gatt_descriptor.h"; 20 | -------------------------------------------------------------------------------- /service/common/android/bluetooth/BluetoothGattIncludedService.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable BluetoothGattIncludedService cpp_header "android/bluetooth/bluetooth_gatt_included_service.h"; 20 | -------------------------------------------------------------------------------- /service/common/android/bluetooth/BluetoothGattService.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable BluetoothGattService cpp_header "android/bluetooth/bluetooth_gatt_service.h"; 20 | -------------------------------------------------------------------------------- /service/common/android/bluetooth/BluetoothRemoteDeviceProps.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable BluetoothRemoteDeviceProps cpp_header "android/bluetooth/bluetooth_remote_device_props.h"; 20 | -------------------------------------------------------------------------------- /service/common/android/bluetooth/IBluetoothGattClient.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | import android.bluetooth.IBluetoothGattClientCallback; 20 | 21 | interface IBluetoothGattClient { 22 | 23 | boolean RegisterClient(in IBluetoothGattClientCallback callback); 24 | void UnregisterClient(int client_id); 25 | void UnregisterAll(); 26 | } 27 | -------------------------------------------------------------------------------- /service/common/android/bluetooth/IBluetoothGattClientCallback.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | oneway interface IBluetoothGattClientCallback { 20 | void OnClientRegistered(int status, int client_id); 21 | } 22 | -------------------------------------------------------------------------------- /service/common/android/bluetooth/IBluetoothLeAdvertiserCallback.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | import android.bluetooth.AdvertiseSettings; 20 | 21 | oneway interface IBluetoothLeAdvertiserCallback { 22 | void OnAdvertiserRegistered(int status, int advertiser_id); 23 | void OnMultiAdvertiseCallback(int status, boolean is_start, in AdvertiseSettings settings); 24 | } -------------------------------------------------------------------------------- /service/common/android/bluetooth/IBluetoothLeScannerCallback.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | import android.bluetooth.ScanResult; 20 | 21 | oneway interface IBluetoothLeScannerCallback { 22 | void OnScannerRegistered(int status, int client_id); 23 | void OnScanResult(in ScanResult scan_result); 24 | } -------------------------------------------------------------------------------- /service/common/android/bluetooth/ScanFilter.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable ScanFilter cpp_header "android/bluetooth/scan_filter.h"; 20 | -------------------------------------------------------------------------------- /service/common/android/bluetooth/ScanResult.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable ScanResult cpp_header "android/bluetooth/scan_result.h"; 20 | -------------------------------------------------------------------------------- /service/common/android/bluetooth/ScanSettings.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable ScanSettings cpp_header "android/bluetooth/scan_settings.h"; 20 | -------------------------------------------------------------------------------- /service/common/android/bluetooth/UUID.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package android.bluetooth; 18 | 19 | parcelable UUID cpp_header "android/bluetooth/uuid.h"; 20 | -------------------------------------------------------------------------------- /service/ipc/dbus/org.fluoride.BluetoothAdapter.xml: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | 13 | 14 | 19 | 20 | 21 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /stack/btm/btm_int.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LineageOS/android_system_bt/edc95ad08dc40d56a6ac00f4da98ca918ed04f9e/stack/btm/btm_int.h -------------------------------------------------------------------------------- /stack/btm/btm_scn.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | bool BTM_FreeSCN(uint8_t scn); 22 | bool BTM_TryAllocateSCN(uint8_t scn); 23 | bool BTM_TryAllocateSCN(uint8_t scn); 24 | -------------------------------------------------------------------------------- /stack/include/sco_client_callbacks.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "stack/include/btm_api_types.h" 20 | 21 | struct sco_client_callback_s { 22 | tBTM_SCO_CB on_connected; 23 | tBTM_SCO_CB on_disconnected; 24 | tBTM_ESCO_CBACK on_sco_event; 25 | }; 26 | -------------------------------------------------------------------------------- /stack/test/common/mock_btu_layer.cc: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright 2018 The Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at: 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | ******************************************************************************/ 18 | 19 | #include "common/message_loop_thread.h" 20 | 21 | bluetooth::common::MessageLoopThread* get_main_thread() { return nullptr; } 22 | -------------------------------------------------------------------------------- /stack/test/fuzzers/a2dp/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | cc_fuzz { 11 | name: "a2dp_fuzz", 12 | defaults: ["libbt-stack_fuzz_defaults"], 13 | srcs: [ 14 | "fuzz_a2dp.cc", 15 | ], 16 | } 17 | -------------------------------------------------------------------------------- /stack/test/fuzzers/sdp/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | cc_fuzz { 11 | name: "sdp_fuzz", 12 | defaults: ["libbt-stack_fuzz_defaults"], 13 | srcs: [ 14 | "fuzz_sdp.cc", 15 | ], 16 | } 17 | -------------------------------------------------------------------------------- /test/headless/README.md: -------------------------------------------------------------------------------- 1 | ## 2 | ## bluetooth headless 3 | ## 4 | ## A device-side executable that consists of a binary executable 5 | ## driving the Android libbluetooth libraries. 6 | ## 7 | 8 | Requirements: 9 | 1. Android installation, 10 | 2. Root access to adb connected Android device. 11 | 12 | Build: Source, lunch and build as typical Android target for selected device and architecture. 13 | cd $ANDROID_BUILD_TOP 14 | . build/envsetup.sh && lunch 15 | make bt_headless 16 | 17 | Install: Push the binary to an executable area on target device. 18 | adb push out/target/product//bt_headless/bt_headless /data/data/. 19 | 20 | Prepare: Ensure the system is queisced to prevent resource conflicts from the bluetooth process. 21 | adb shell stop 22 | 23 | Run: Script or directly execute the target file. 24 | adb shell /data/data/bt_headless --flags=INIT_logging_debug_enabled_for_all=true,INIT_gd_acl=true nop 25 | -------------------------------------------------------------------------------- /test/headless/interface.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #pragma once 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include "include/hardware/bluetooth.h" 10 | 11 | using acl_state_changed_params_t = struct { 12 | bt_status_t status; 13 | RawAddress* remote_bd_addr; 14 | bt_acl_state_t state; 15 | bt_hci_error_code_t hci_reason; 16 | }; 17 | 18 | using callback_params_t = union { 19 | acl_state_changed_params_t acl_state_changed; 20 | }; 21 | 22 | using interface_data_t = struct { 23 | std::string name; 24 | callback_params_t params; 25 | }; 26 | 27 | using callback_function_t = void (*)(interface_data_t); 28 | using interface_callback_t = struct { 29 | std::string name; 30 | callback_function_t function; 31 | }; 32 | 33 | void headless_add_callback(const std::string interface_name, 34 | callback_function_t function); 35 | void headless_remove_callback(const std::string interface_name, 36 | callback_function_t function); 37 | -------------------------------------------------------------------------------- /test/headless/pairing/pairing.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "test/headless/get_options.h" 5 | #include "test/headless/headless.h" 6 | 7 | namespace bluetooth { 8 | namespace test { 9 | namespace headless { 10 | 11 | class Pairing : public HeadlessTest { 12 | public: 13 | Pairing(const bluetooth::test::headless::GetOpt& options) 14 | : HeadlessTest(options) {} 15 | int Run() override; 16 | }; 17 | 18 | } // namespace headless 19 | } // namespace test 20 | } // namespace bluetooth 21 | -------------------------------------------------------------------------------- /test/mock/mock_btif_stack_manager.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * Generated mock file from original source file 19 | */ 20 | 21 | #include "osi/include/future.h" 22 | 23 | static future_t* hack_future; 24 | 25 | future_t* stack_manager_get_hack_future() { return hack_future; } 26 | -------------------------------------------------------------------------------- /test/mock/mock_main_shim_entry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | namespace bluetooth { 18 | namespace hci { 19 | namespace testing { 20 | 21 | extern MockAclManager* mock_acl_manager_; 22 | extern MockController* mock_controller_; 23 | 24 | } // namespace testing 25 | } // namespace hci 26 | } // namespace bluetooth 27 | -------------------------------------------------------------------------------- /test/rootcanal/android.hardware.bluetooth@1.1-service.sim.rc: -------------------------------------------------------------------------------- 1 | service vendor.bluetooth-1-1 /vendor/bin/hw/android.hardware.bluetooth@1.1-service.sim 2 | class hal 3 | user bluetooth 4 | group bluetooth 5 | -------------------------------------------------------------------------------- /tools/Android.mk.disabled: -------------------------------------------------------------------------------- 1 | include $(call all-subdir-makefiles) 2 | -------------------------------------------------------------------------------- /udrv/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | cc_library_static { 11 | name: "libudrv-uipc", 12 | defaults: ["fluoride_defaults"], 13 | srcs: [ 14 | "ulinux/uipc.cc", 15 | ], 16 | include_dirs: [ 17 | "system/bt", 18 | "system/bt/internal_include", 19 | "system/bt/utils/include", 20 | "system/bt/stack/include", 21 | ], 22 | local_include_dirs: [ 23 | "include", 24 | ], 25 | host_supported: true, 26 | } 27 | -------------------------------------------------------------------------------- /udrv/BUILD.gn: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2015 Google, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at: 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | source_set("udrv") { 18 | sources = [ 19 | "ulinux/uipc.cc", 20 | ] 21 | 22 | include_dirs = [ 23 | "include", 24 | "uipc", 25 | "//bt/", 26 | "//bt/internal_include", 27 | "//bt/stack/include", 28 | "//bt/utils/include", 29 | ] 30 | 31 | configs += [ 32 | "//bt:target_defaults" 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /utils/Android.bp: -------------------------------------------------------------------------------- 1 | // Utils static library for target 2 | // ======================================================== 3 | package { 4 | // See: http://go/android-license-faq 5 | // A large-scale-change added 'default_applicable_licenses' to import 6 | // all of the 'license_kinds' from "system_bt_license" 7 | // to get the below license kinds: 8 | // SPDX-license-identifier-Apache-2.0 9 | default_applicable_licenses: ["system_bt_license"], 10 | } 11 | 12 | cc_library_static { 13 | name: "libbt-utils", 14 | defaults: ["fluoride_defaults"], 15 | local_include_dirs: [ 16 | "include", 17 | ], 18 | include_dirs: [ 19 | "system/bt", 20 | "system/bt/btcore/include", 21 | "system/bt/stack/include", 22 | ], 23 | srcs: ["src/bt_utils.cc"], 24 | shared_libs: [ 25 | "libprocessgroup", 26 | ], 27 | host_supported: true, 28 | } 29 | -------------------------------------------------------------------------------- /utils/BUILD.gn: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2015 Google, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at: 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | static_library("utils") { 18 | sources = [ 19 | "src/bt_utils.cc", 20 | ] 21 | 22 | include_dirs = [ 23 | "include", 24 | "//bt/", 25 | "//bt/stack/include", 26 | ] 27 | 28 | configs += [ 29 | "//bt:target_defaults", 30 | ] 31 | 32 | deps = [ 33 | "//bt/gd/rust/shim:init_flags_bridge_header", 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /vendor_libs/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | subdirs = [ 11 | "test_vendor_lib", 12 | "linux", 13 | ] 14 | -------------------------------------------------------------------------------- /vendor_libs/linux/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | subdirs = [ 11 | "interface", 12 | ] 13 | -------------------------------------------------------------------------------- /vendor_libs/linux/interface/android.hardware.bluetooth@1.1-service.btlinux.rc: -------------------------------------------------------------------------------- 1 | service btlinux-1.1 /vendor/bin/hw/android.hardware.bluetooth@1.1-service.btlinux 2 | class hal 3 | user bluetooth 4 | group bluetooth net_admin net_bt_admin 5 | capabilities NET_ADMIN 6 | -------------------------------------------------------------------------------- /vendor_libs/test_vendor_lib/data/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | // A large-scale-change added 'default_applicable_licenses' to import 4 | // all of the 'license_kinds' from "system_bt_license" 5 | // to get the below license kinds: 6 | // SPDX-license-identifier-Apache-2.0 7 | default_applicable_licenses: ["system_bt_license"], 8 | } 9 | 10 | prebuilt_etc_host { 11 | name: "controller_properties.json", 12 | src: "controller_properties.json", 13 | sub_dir: "rootcanal/data", 14 | } 15 | -------------------------------------------------------------------------------- /vendor_libs/test_vendor_lib/data/controller_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "AclDataPacketSize": "1024", 3 | "EncryptionKeySize": "10", 4 | "ScoDataPacketSize": "255", 5 | "NumAclDataPackets": "10", 6 | "NumScoDataPackets": "10", 7 | "Version": "4", 8 | "Revision": "0", 9 | "LmpPalVersion": "0", 10 | "ManufacturerName": "0", 11 | "LmpPalSubversion": "0", 12 | "MaximumPageNumber": "0", 13 | "BdAddress": "123456" 14 | } 15 | -------------------------------------------------------------------------------- /vendor_libs/test_vendor_lib/include/phy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | namespace test_vendor_lib { 20 | 21 | class Phy { 22 | public: 23 | enum class Type { 24 | LOW_ENERGY, 25 | BR_EDR, 26 | }; 27 | }; 28 | } // namespace test_vendor_lib 29 | -------------------------------------------------------------------------------- /vendor_libs/test_vendor_lib/model/devices/scripted_beacon_ble_payload.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package android.bluetooth.test_vendor_lib.model.devices.ScriptedBeaconBleAdProto; 4 | 5 | option optimize_for = LITE_RUNTIME; 6 | 7 | message BleAdvertisement { 8 | optional bytes payload = 1; 9 | optional bytes mac_address = 2; 10 | optional uint32 delay_before_send_ms = 3; 11 | } 12 | 13 | message BleAdvertisementList { 14 | repeated BleAdvertisement advertisements = 1; 15 | } 16 | 17 | message PlaybackEvent { 18 | // These events should occur in order, starting from INITIALIZED 19 | enum PlaybackEventType { 20 | UNKNOWN = 0; 21 | INITIALIZED = 1; 22 | SCANNED_ONCE = 2; 23 | WAITING_FOR_FILE = 3; 24 | WAITING_FOR_FILE_TO_BE_READABLE = 4; 25 | PARSING_FILE = 5; 26 | PLAYBACK_STARTED = 6; 27 | PLAYBACK_ENDED = 7; 28 | // Error conditions 29 | FILE_PARSING_FAILED = 8; 30 | } 31 | optional PlaybackEventType type = 1; 32 | optional uint64 secs_since_epoch = 2; 33 | } 34 | -------------------------------------------------------------------------------- /vendor_libs/test_vendor_lib/scripts/scripted_beacon_test/Readme.txt: -------------------------------------------------------------------------------- 1 | This test: 2 | 3 | - Starts RootCanal 4 | - Adds scripted beacons 5 | - Sets the permissions for some of the files 6 | - Dumps the proto output for manual verification 7 | 8 | 9 | cd $ANDROID_BUILD_TOP/system/bt/vendor_libs/test_vendor_lib 10 | . scripts/scripted_beacon_test/run_test.sh 11 | 12 | -------------------------------------------------------------------------------- /vendor_libs/test_vendor_lib/scripts/scripted_beacon_test/add_beacons: -------------------------------------------------------------------------------- 1 | wait 1 2 | add scripted_beacon be:ac:01:55:00:01 scripts/scripted_beacon_test/test_events.pb /tmp/logs/scripted_beacon_test/beacon.pb 3 | add_device_to_phy 1 1 4 | add scripted_beacon be:ac:01:55:00:02 scripts/scripted_beacon_test/no_permission.pb /tmp/logs/scripted_beacon_test/no_permission.pb 5 | add_device_to_phy 2 1 6 | add scripted_beacon be:ac:01:55:00:02 scripts/scripted_beacon_test/grant_permission.pb /tmp/logs/scripted_beacon_test/grant_permission.pb 7 | add_device_to_phy 3 1 8 | list 9 | wait 10 10 | quit 11 | -------------------------------------------------------------------------------- /vendor_libs/test_vendor_lib/scripts/scripted_beacon_test/grant_permission.pb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LineageOS/android_system_bt/edc95ad08dc40d56a6ac00f4da98ca918ed04f9e/vendor_libs/test_vendor_lib/scripts/scripted_beacon_test/grant_permission.pb -------------------------------------------------------------------------------- /vendor_libs/test_vendor_lib/scripts/scripted_beacon_test/no_permission.pb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LineageOS/android_system_bt/edc95ad08dc40d56a6ac00f4da98ca918ed04f9e/vendor_libs/test_vendor_lib/scripts/scripted_beacon_test/no_permission.pb -------------------------------------------------------------------------------- /vendor_libs/test_vendor_lib/scripts/scripted_beacon_test/run_test.sh: -------------------------------------------------------------------------------- 1 | 2 | mkdir -p /tmp/logs/scripted_beacon_test/ 3 | chmod 200 scripts/scripted_beacon_test/no_permission.pb 4 | chmod 200 scripts/scripted_beacon_test/grant_permission.pb 5 | # ls -l scripts/scripted_beacon_test/*.pb 6 | $ANDROID_BUILD_TOP/out/host/linux-x86/bin/root-canal 2> /tmp/logs/scripted_beacon_test/root_canal.log & 7 | sleep 1 8 | python3 scripts/test_channel.py 6401 < scripts/scripted_beacon_test/add_beacons > /tmp/logs/scripted_beacon_test/test_channel.log & 9 | python3 scripts/hci_socket.py 6402 < scripts/scripted_beacon_test/start_scan > /tmp/logs/scripted_beacon_test/hci_device.log & 10 | sleep 5 11 | chmod 640 scripts/scripted_beacon_test/grant_permission.pb 12 | # ls -l scripts/scripted_beacon_test/*.pb 13 | sleep 15 14 | echo "Done" 15 | chmod 640 scripts/scripted_beacon_test/no_permission.pb 16 | # ls -l scripts/scripted_beacon_test/*.pb 17 | gqui /tmp/logs/scripted_beacon_test/*.pb 18 | -------------------------------------------------------------------------------- /vendor_libs/test_vendor_lib/scripts/scripted_beacon_test/start_scan: -------------------------------------------------------------------------------- 1 | le_scan 1 2 | wait 10 3 | quit 4 | -------------------------------------------------------------------------------- /vendor_libs/test_vendor_lib/scripts/scripted_beacon_test/test_events.pb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LineageOS/android_system_bt/edc95ad08dc40d56a6ac00f4da98ca918ed04f9e/vendor_libs/test_vendor_lib/scripts/scripted_beacon_test/test_events.pb -------------------------------------------------------------------------------- /vnd/include/vendor_api.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * Name: vendor_api.h 4 | * 5 | * Description: Vendor specific BTE API function external definitions. 6 | * 7 | * Copyright (c) 2009-2011, BROADCOM Inc., All Rights Reserved. 8 | * Broadcom Bluetooth Core. Proprietary and confidential. 9 | * 10 | *****************************************************************************/ 11 | #ifndef VENDOR_API_H 12 | #define VENDOR_API_H 13 | 14 | #include "bt_types.h" 15 | #include "btm_api.h" 16 | 17 | /**************************************************************************** 18 | * Resolvable private address offload VSC specific definitions 19 | *****************************************************************************/ 20 | 21 | enum { BTM_BLE_PRIVACY_ENABLE, BTM_BLE_PRIVACY_DISABLE }; 22 | 23 | #endif 24 | --------------------------------------------------------------------------------