summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Abhishek Pandit-Subedi <abhishekpandit@google.com> 2021-01-08 19:53:23 -0800
committer Abhishek Pandit-Subedi <abhishekpandit@google.com> 2021-02-01 22:58:03 +0000
commitc86d26f3548b9ec3fc25495c09b4905387431ae6 (patch)
tree535841c5db8e49088c53ea173e878f1ddfee73a1
parentd4d9f0617bf1b8ffd8abdb779bc3f46e7589282b (diff)
Fix up files to compile on Linux
Fix up all the .gn files so that they will compile on Linux. In order to compile with GN, there is a new dependency on common-mk (currently part of chromiumos/platform2) and most third-party libraries now use pkg-config to include and link. As a result, all build paths are prefixed with //bt now. In addition, also disable building non standard codecs temporarily (i.e. ldac, aptx, aac). We will add a way to enable them via build flags later but we're disabling them entirely for now. Bug: 176847216 Bug: 176846220 Tag: #refactor Test: run --host bluetooth_test_gd Test: run --host bluetooth_test_common Change-Id: I85e5f8bd64c9ad074537cdd1393d373d5644aca0
-rw-r--r--BUILD.gn141
-rw-r--r--system/bta/BUILD.gn65
-rw-r--r--system/btcore/BUILD.gn25
-rw-r--r--system/btif/BUILD.gn62
-rw-r--r--system/btif/avrcp/avrcp_service.h1
-rw-r--r--system/common/BUILD.gn32
-rw-r--r--system/device/BUILD.gn33
-rw-r--r--system/embdrv/sbc/BUILD.gn8
-rw-r--r--system/gd/proto/BUILD.gn10
-rw-r--r--system/gd/rust/shim/BUILD.gn (renamed from .gn)19
-rw-r--r--system/hci/BUILD.gn46
-rw-r--r--system/include/array_utils.h20
-rw-r--r--system/include/hardware/ble_scanner.h3
-rw-r--r--system/main/BUILD.gn91
-rw-r--r--system/osi/BUILD.gn33
-rw-r--r--system/packet/BUILD.gn13
-rw-r--r--system/packet/base/packet.h3
-rw-r--r--system/profile/avrcp/BUILD.gn14
-rw-r--r--system/service/BUILD.gn45
-rw-r--r--system/service/avrcp_target.cc3
-rw-r--r--system/service/ipc/dbus/bluetooth_adapter.cc2
-rw-r--r--system/service/test/ipc_linux_unittest.cc5
-rw-r--r--system/service/test/settings_unittest.cc17
-rw-r--r--system/stack/BUILD.gn220
-rw-r--r--system/stack/a2dp/a2dp_aac_decoder.cc4
-rw-r--r--system/stack/a2dp/a2dp_aac_encoder.cc4
-rw-r--r--system/stack/btm/security_device_record.h1
-rw-r--r--system/stack/hcic/hciblecmds.cc2
-rw-r--r--system/stack/include/bt_types.h4
-rw-r--r--system/test/suite/BUILD.gn23
-rw-r--r--system/types/BUILD.gn18
-rw-r--r--system/types/bluetooth/uuid.cc3
-rw-r--r--system/udrv/BUILD.gn13
-rw-r--r--system/utils/BUILD.gn15
-rw-r--r--system/vendor_libs/test_vendor_lib/types/BUILD.gn17
35 files changed, 652 insertions, 363 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 456fbeb8fe..a477b2a068 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -20,11 +20,17 @@
# you add a new build file, there must be some path of dependencies from this
# file to your new one or GN won't know about it.
+group("all") {
+ deps = [
+ ":bluetooth",
+ ]
+}
+
# This pulls in main/BUILD.gn and all of its dependencies.
group("bluetooth") {
deps = [
- "//main:bluetooth",
- "//service:bluetoothtbd",
+ "//bt/main:bluetooth",
+ "//bt/service:bluetoothtbd",
]
}
@@ -32,10 +38,131 @@ group("bluetooth_tests") {
testonly = true
deps = [
- "//test/suite:net_test_bluetooth",
- "//btcore:net_test_btcore",
- "//hci:net_test_hci",
- "//osi:net_test_osi",
- "//device:net_test_device",
+ "//bt/test/suite:net_test_bluetooth",
+ "//bt/btcore:net_test_btcore",
+ "//bt/hci:net_test_hci",
+ "//bt/osi:net_test_osi",
+ "//bt/device:net_test_device",
+ ]
+}
+
+config("target_defaults") {
+ include_dirs = [
+ "//bt/linux_include",
+ "//bt/types",
+ "//bt/include",
+ ]
+
+ cflags = [
+ "-DEXPORT_SYMBOL=__attribute__((visibility(\"default\")))",
+ "-DFALLTHROUGH_INTENDED=[[clang::fallthrough]]",
+ "-fPIC",
+ "-Wno-non-c-typedef-for-linkage",
+ "-Wno-unreachable-code-return",
+ "-Wno-defaulted-function-deleted",
+ "-Wno-gnu-variable-sized-type-not-at-end",
+ "-Wno-format-nonliteral",
+ "-Wno-inconsistent-missing-override",
+ "-Wno-unreachable-code",
+ "-Wno-range-loop-construct",
+ "-Wno-reorder-init-list",
+ "-Wno-unused-function",
+ "-Wno-unused-result",
+ "-Wno-unused-variable",
+ "-Wno-unused-const-variable",
+ ]
+
+ cflags_cc = [
+ "-std=c++17",
+ ]
+
+ defines = [
+ "HAS_NO_BDROID_BUILDCFG",
+ "OS_GENERIC",
+ ]
+
+ configs = [
+ ":external_libchrome",
+ ]
+}
+
+# Configurations to use as dependencies for GN build
+config("external_gtest") {
+ configs = [
+ ":pkg_gtest",
+ ":pkg_gmock",
]
}
+
+config("external_gtest_main") {
+ configs = [ ":pkg_gtest_main" ]
+}
+
+config("external_gmock_main") {
+ configs = [ ":pkg_gmock_main" ]
+}
+
+config("external_libchrome") {
+ configs = [ ":pkg_libchrome" ]
+}
+
+config("external_modp_b64") {
+ configs = [ ":pkg_modp_b64" ]
+}
+
+config("external_tinyxml2") {
+ configs = [ ":pkg_tinyxml2" ]
+}
+
+# Package configurations to extract dependencies from env
+pkg_config("pkg_gtest") {
+ pkg_deps = [ "gtest" ]
+}
+
+pkg_config("pkg_gtest_main") {
+ pkg_deps = [ "gtest_main" ]
+}
+
+pkg_config("pkg_gmock") {
+ pkg_deps = [ "gmock" ]
+}
+
+pkg_config("pkg_gmock_main") {
+ pkg_deps = [ "gmock_main" ]
+}
+
+pkg_config("pkg_libchrome") {
+ pkg_deps = [ "libchrome" ]
+}
+
+pkg_config("pkg_modp_b64") {
+ pkg_deps = [ "libmodp_b64" ]
+}
+
+pkg_config("pkg_tinyxml2") {
+ pkg_deps = [ "tinyxml2" ]
+}
+
+# Uncomment if building nonstandard codecs
+# config("external_aac") {
+# configs = [ ":pkg_aac" ]
+# }
+#
+# pkg_config("pkg_aac") {
+# pkg_deps = [ "fdk-aac" ]
+# }
+#
+# config("external_libldac") {
+# configs = [
+# ":pkg_libldacBT_enc",
+# ":pkg_libldacBT_abr",
+# ]
+# }
+#
+# pkg_config("pkg_libldacBT_enc") {
+# pkg_deps = [ "ldacBT-enc", ]
+# }
+#
+# pkg_config("pkg_libldacBT_abr") {
+# pkg_deps = [ "ldacBT-abr", ]
+# }
diff --git a/system/bta/BUILD.gn b/system/bta/BUILD.gn
index 6632c24d7a..da4fe80b6e 100644
--- a/system/bta/BUILD.gn
+++ b/system/bta/BUILD.gn
@@ -92,28 +92,32 @@ static_library("bta") {
"hd",
"include",
"sys",
- "//",
- "//linux_include",
- "//bta",
- "//internal_include",
- "//btcore/include",
- "//hci/include",
- "//internal_include",
- "//stack/include",
- "//stack/btm",
- "//udrv/include",
- "//utils/include",
- "//vnd/include",
- "//btif/include",
- "//btif/avrcp",
- "//include/hardware/avrcp",
- "//profile/avrcp",
- "//packet/avrcp",
- "//packet/base",
+ "//bt/",
+ "//bt/linux_include",
+ "//bt/bta",
+ "//bt/internal_include",
+ "//bt/btcore/include",
+ "//bt/hci/include",
+ "//bt/internal_include",
+ "//bt/stack/include",
+ "//bt/stack/btm",
+ "//bt/udrv/include",
+ "//bt/utils/include",
+ "//bt/vnd/include",
+ "//bt/btif/include",
+ "//bt/btif/avrcp",
+ "//bt/include/hardware/avrcp",
+ "//bt/profile/avrcp",
+ "//bt/packet/avrcp",
+ "//bt/packet/base",
+ ]
+
+ configs += [
+ "//bt:target_defaults"
]
deps = [
- "//third_party/libchrome:base"
+ "//bt/gd/rust/shim:init_flags_bridge_header",
]
}
@@ -128,18 +132,21 @@ executable("net_test_bta") {
include_dirs = [
"include",
- "//",
- "//bta",
- "//btcore/include",
- "//hci/include",
- "//internal_include",
- "//stack/btm",
+ "//bt/",
+ "//bt/bta",
+ "//bt/btcore/include",
+ "//bt/hci/include",
+ "//bt/internal_include",
+ "//bt/stack/btm",
]
deps = [
- "//bta",
- "//types",
- "//third_party/googletest:gmock_main",
- "//third_party/libchrome:base",
+ "//bt/bta",
+ "//bt/types",
+ ]
+
+ configs += [
+ "//bt:external_gmock_main",
+ "//bt:target_defaults",
]
}
diff --git a/system/btcore/BUILD.gn b/system/btcore/BUILD.gn
index 01b9cf7e33..3aef8f6a78 100644
--- a/system/btcore/BUILD.gn
+++ b/system/btcore/BUILD.gn
@@ -25,11 +25,15 @@ static_library("btcore") {
include_dirs = [
"include",
- "//",
+ "//bt",
+ ]
+
+ configs += [
+ "//bt:target_defaults",
]
deps = [
- "//third_party/libchrome:base",
+ "//bt/gd/rust/shim:init_flags_bridge_header",
]
}
@@ -38,20 +42,23 @@ executable("net_test_btcore") {
sources = [
"test/device_class_test.cc",
"test/property_test.cc",
- "//osi/test/AllocationTestHarness.cc",
+ "//bt/osi/test/AllocationTestHarness.cc",
]
include_dirs = [
"include",
- "//",
+ "//bt",
]
deps = [
- "//btcore",
- "//osi",
- "//types",
- "//third_party/googletest:gtest_main",
- "//third_party/libchrome:base",
+ "//bt/btcore",
+ "//bt/osi",
+ "//bt/types",
+ ]
+
+ configs += [
+ "//bt:external_gtest_main",
+ "//bt:target_defaults",
]
libs = [
diff --git a/system/btif/BUILD.gn b/system/btif/BUILD.gn
index 0efd55a611..b6c4ad8995 100644
--- a/system/btif/BUILD.gn
+++ b/system/btif/BUILD.gn
@@ -16,13 +16,13 @@
static_library("btif") {
sources = [
- "//audio_a2dp_hw/src/audio_a2dp_hw_utils.cc",
- "//audio_hearing_aid_hw/src/audio_hearing_aid_hw_utils.cc",
+ "//bt/audio_a2dp_hw/src/audio_a2dp_hw_utils.cc",
+ "//bt/audio_hearing_aid_hw/src/audio_hearing_aid_hw_utils.cc",
"src/btif_a2dp.cc",
"src/btif_a2dp_audio_interface_linux.cc",
"src/btif_a2dp_control.cc",
"src/btif_a2dp_sink.cc",
- "src/btif_a2dp_source.cc",
+ # "src/btif_a2dp_source.cc",
"src/btif_av.cc",
"avrcp/avrcp_service.cc",
@@ -31,7 +31,7 @@ static_library("btif") {
"src/btif_avrcp_audio_track_linux.cc",
"src/btif_ble_advertiser.cc",
"src/btif_ble_scanner.cc",
- "src/btif_config.cc",
+ # "src/btif_config.cc",
"src/btif_config_transcode.cc",
"src/btif_core.cc",
"src/btif_debug.cc",
@@ -77,32 +77,38 @@ static_library("btif") {
include_dirs = [
"include",
- "//",
- "//linux_include",
- "//audio_a2dp_hw/include",
- "//audio_hearing_aid_hw/include",
- "//bta/include",
- "//bta/sys",
- "//btcore/include",
- "//device/include",
- "//embdrv/sbc/encoder/include",
- "//embdrv/sbc/decoder/include",
- "//hci/include",
- "//stack/a2dp",
- "//stack/btm",
- "//stack/l2cap",
- "//stack/include",
- "//third_party/tinyxml2",
- "//internal_include",
- "//udrv/include",
- "//utils/include",
- "//vnd/include",
- "//profile/avrcp",
+ "//bt/",
+ "//bt/bta/dm",
+ "//bt/linux_include",
+ "//bt/audio_a2dp_hw/include",
+ "//bt/audio_hearing_aid_hw/include",
+ "//bt/bta/include",
+ "//bt/bta/sys",
+ "//bt/btcore/include",
+ "//bt/device/include",
+ "//bt/embdrv/sbc/encoder/include",
+ "//bt/embdrv/sbc/decoder/include",
+ "//bt/hci/include",
+ "//bt/stack/a2dp",
+ "//bt/stack/btm",
+ "//bt/stack/l2cap",
+ "//bt/stack/include",
+ "//bt/internal_include",
+ "//bt/udrv/include",
+ "//bt/utils/include",
+ "//bt/vnd/include",
+ "//bt/profile/avrcp",
]
deps = [
- "//common",
- "//third_party/libchrome:base",
- "//profile/avrcp:profile_avrcp"
+ "//bt/common",
+ "//bt/gd/rust/shim:init_flags_bridge_header",
+ "//bt/profile/avrcp:profile_avrcp",
+ "//bt/third_party/proto_logging/stats:libbt-platform-protos",
+ ]
+
+ configs += [
+ "//bt:target_defaults",
+ "//bt:external_tinyxml2",
]
}
diff --git a/system/btif/avrcp/avrcp_service.h b/system/btif/avrcp/avrcp_service.h
index b60700f33e..067631ecd6 100644
--- a/system/btif/avrcp/avrcp_service.h
+++ b/system/btif/avrcp/avrcp_service.h
@@ -18,6 +18,7 @@
#include <map>
#include <memory>
+#include <mutex>
#include "hardware/avrcp/avrcp.h"
#include "osi/include/properties.h"
diff --git a/system/common/BUILD.gn b/system/common/BUILD.gn
index 76d70f8fbf..f491cde323 100644
--- a/system/common/BUILD.gn
+++ b/system/common/BUILD.gn
@@ -19,18 +19,22 @@ static_library("common") {
"message_loop_thread.cc",
"metrics_linux.cc",
"time_util.cc",
- "timer.cc",
]
include_dirs = [
- "//",
- "//stack/include",
- "//linux_include",
- "//internal_include",
+ "//bt/",
+ "//bt/stack/include",
+ "//bt/linux_include",
+ "//bt/internal_include",
]
deps = [
- "//third_party/libchrome:base",
+ "//bt/gd/rust/shim:init_flags_bridge_header",
+ "//bt/third_party/proto_logging/stats:libbt-platform-protos",
+ ]
+
+ configs += [
+ "//bt:target_defaults",
]
}
@@ -40,19 +44,21 @@ executable("bt_test_common") {
"leaky_bonded_queue_unittest.cc",
"state_machine_unittest.cc",
"time_util_unittest.cc",
- "timer_unittest.cc"
]
include_dirs = [
- "//",
- "//common",
+ "//bt/",
+ "//bt/common",
]
deps = [
- "//common",
- "//third_party/googletest:gtest_main",
- "//third_party/googletest:gmock_main",
- "//third_party/libchrome:base",
+ "//bt/common",
+ ]
+
+ configs += [
+ "//bt:external_gtest_main",
+ "//bt:external_gmock_main",
+ "//bt:target_defaults",
]
libs = [
diff --git a/system/device/BUILD.gn b/system/device/BUILD.gn
index 5de439d306..cf016dc4e3 100644
--- a/system/device/BUILD.gn
+++ b/system/device/BUILD.gn
@@ -22,32 +22,39 @@ static_library("device") {
]
include_dirs = [
- "//",
- "//btcore/include",
- "//hci/include",
- "//internal_include",
- "//stack/include",
+ "//bt/",
+ "//bt/btcore/include",
+ "//bt/hci/include",
+ "//bt/internal_include",
+ "//bt/stack/include",
+ ]
+
+ configs += [
+ "//bt:target_defaults",
]
deps = [
- "//third_party/libchrome:base",
+ "//bt/gd/rust/shim:init_flags_bridge_header",
]
}
executable("net_test_device") {
testonly = true
sources = [
- "//osi/test/AllocationTestHarness.cc",
+ "//bt/osi/test/AllocationTestHarness.cc",
]
- include_dirs = [ "//" ]
+ include_dirs = [ "//bt" ]
deps = [
- "//device",
- "//btcore",
- "//osi",
- "//third_party/googletest:gtest_main",
- "//third_party/libchrome:base",
+ "//bt/device",
+ "//bt/btcore",
+ "//bt/osi",
+ ]
+
+ configs += [
+ "//bt:external_gtest_main",
+ "//bt:target_defaults",
]
libs = [
diff --git a/system/embdrv/sbc/BUILD.gn b/system/embdrv/sbc/BUILD.gn
index 696080a07b..ce85245823 100644
--- a/system/embdrv/sbc/BUILD.gn
+++ b/system/embdrv/sbc/BUILD.gn
@@ -33,6 +33,8 @@ source_set("sbc_decoder") {
]
include_dirs = [ "decoder/include" ]
+
+ configs += [ "//bt:target_defaults" ]
}
source_set("sbc_encoder") {
@@ -49,9 +51,11 @@ source_set("sbc_encoder") {
include_dirs = [
"encoder/include",
- "//internal_include",
- "//stack/include",
+ "//bt/internal_include",
+ "//bt/stack/include",
]
+
+ configs += [ "//bt:target_defaults" ]
}
static_library("sbc") {
diff --git a/system/gd/proto/BUILD.gn b/system/gd/proto/BUILD.gn
new file mode 100644
index 0000000000..ba5cd4eaaf
--- /dev/null
+++ b/system/gd/proto/BUILD.gn
@@ -0,0 +1,10 @@
+import("//common-mk/proto_library.gni")
+
+proto_library("libbt-protos-lite") {
+ sources = [
+ "bluetooth/metrics/bluetooth.proto",
+ ]
+
+ proto_in_dir = "./bluetooth/metrics"
+ proto_out_dir = "include/bluetooth/metrics"
+}
diff --git a/.gn b/system/gd/rust/shim/BUILD.gn
index 1c2396dfc7..8843c934ad 100644
--- a/.gn
+++ b/system/gd/rust/shim/BUILD.gn
@@ -1,5 +1,5 @@
#
-# Copyright 2015 Google, Inc.
+# Copyright 2020 Google
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,9 +14,16 @@
# limitations under the License.
#
-# This file is used by the GN meta build system to find the root of the source
-# tree and to set startup options. For documentation on the values set in this
-# file, run "gn help dotfile" at the command line.
+import("//common-mk/cxxbridge.gni")
-buildconfig = "//build/config/BUILDCONFIG.gn"
-secondary_source = "//build/secondary/"
+cxxbridge_header("shim_bridge_header") {
+ sources = [ "src/stack.rs" ]
+}
+
+cxxbridge_header("init_flags_bridge_header") {
+ sources = [ "src/init_flags.rs" ]
+}
+
+cxxbridge_header("hci_bridge_header") {
+ sources = [ "src/hci.rs" ]
+}
diff --git a/system/hci/BUILD.gn b/system/hci/BUILD.gn
index e29e2569ed..28f8fe2a2c 100644
--- a/system/hci/BUILD.gn
+++ b/system/hci/BUILD.gn
@@ -30,42 +30,48 @@ static_library("hci") {
include_dirs = [
"include",
- "//",
- "//internal_include",
- "//bta/include",
- "//btcore/include",
- "//stack/include",
+ "//bt/",
+ "//bt/internal_include",
+ "//bt/bta/include",
+ "//bt/btcore/include",
+ "//bt/stack/include",
]
deps = [
- "//common",
- "//third_party/libchrome:base",
+ "//bt/common",
+ ]
+
+ configs += [
+ "//bt:target_defaults",
]
}
executable("net_test_hci") {
testonly = true
sources = [
- "//osi/test/AllocationTestHarness.cc",
- "//osi/test/AlarmTestHarness.cc",
+ "//bt/osi/test/AllocationTestHarness.cc",
+ "//bt/osi/test/AlarmTestHarness.cc",
"test/packet_fragmenter_test.cc",
]
include_dirs = [
- "//",
- "//internal_include",
- "//btcore/include",
- "//hci/include",
- "//osi/test",
- "//stack/include",
+ "//bt/",
+ "//bt/internal_include",
+ "//bt/btcore/include",
+ "//bt/hci/include",
+ "//bt/osi/test",
+ "//bt/stack/include",
]
deps = [
- "//hci",
- "//osi",
- "//btcore",
- "//third_party/googletest:gtest_main",
- "//third_party/libchrome:base",
+ "//bt/hci",
+ "//bt/osi",
+ "//bt/btcore",
+ ]
+
+ configs += [
+ "//bt:target_defaults",
+ "//bt:external_gtest_main",
]
libs = [
diff --git a/system/include/array_utils.h b/system/include/array_utils.h
new file mode 100644
index 0000000000..d669d0aba0
--- /dev/null
+++ b/system/include/array_utils.h
@@ -0,0 +1,20 @@
+//
+// Copyright 2021 Google, Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#pragma once
+
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
+#endif
diff --git a/system/include/hardware/ble_scanner.h b/system/include/hardware/ble_scanner.h
index 1588085e87..302a123435 100644
--- a/system/include/hardware/ble_scanner.h
+++ b/system/include/hardware/ble_scanner.h
@@ -19,6 +19,7 @@
#include <bluetooth/uuid.h>
#include <stdint.h>
+#include <memory>
#include <vector>
#include "bt_common_types.h"
#include "bt_gatt_client.h"
@@ -156,4 +157,4 @@ class BleScannerInterface {
virtual void RegisterCallbacks(ScanningCallbacks* callbacks) = 0;
};
-#endif /* ANDROID_INCLUDE_BLE_SCANNER_H */ \ No newline at end of file
+#endif /* ANDROID_INCLUDE_BLE_SCANNER_H */
diff --git a/system/main/BUILD.gn b/system/main/BUILD.gn
index c340cd7b7c..77950ea4db 100644
--- a/system/main/BUILD.gn
+++ b/system/main/BUILD.gn
@@ -24,7 +24,7 @@ shared_library("bluetooth") {
# HAL layer
sources = [
- "//btif/src/bluetooth.cc",
+ "//bt/btif/src/bluetooth.cc",
]
# platform specific
@@ -39,58 +39,61 @@ shared_library("bluetooth") {
public_configs = [ ":libbluetooth_config" ]
include_dirs = [
- "//",
- "//bta/include",
- "//bta/sys",
- "//bta/dm",
- "//btcore/include",
- "//internal_include",
- "//stack/include",
- "//stack/l2cap",
- "//stack/a2dp",
- "//stack/btm",
- "//stack/avdt",
- "//hci",
- "//hci/include",
- "//udrv/include",
- "//btif/include",
- "//btif/co",
- "//hci/includ",
- "//vnd/include",
- "//brcm/include",
- "//embdrv/sbc/encoder/include",
- "//embdrv/sbc/decoder/include",
- "//utils/include",
- "//test/suite",
+ "//bt/",
+ "//bt/bta/include",
+ "//bt/bta/sys",
+ "//bt/bta/dm",
+ "//bt/btcore/include",
+ "//bt/internal_include",
+ "//bt/stack/include",
+ "//bt/stack/l2cap",
+ "//bt/stack/a2dp",
+ "//bt/stack/btm",
+ "//bt/stack/avdt",
+ "//bt/hci",
+ "//bt/hci/include",
+ "//bt/udrv/include",
+ "//bt/btif/include",
+ "//bt/btif/co",
+ "//bt/hci/includ",
+ "//bt/vnd/include",
+ "//bt/brcm/include",
+ "//bt/embdrv/sbc/encoder/include",
+ "//bt/embdrv/sbc/decoder/include",
+ "//bt/utils/include",
+ "//bt/test/suite",
]
deps = [
- "//bta",
- "//btcore",
- "//btif",
- "//device",
- "//embdrv/g722",
- "//embdrv/sbc",
- "//hci",
- "//osi",
- "//packet",
- "//stack",
- "//third_party/libchrome:base",
- "//third_party/tinyxml2",
- "//udrv",
- "//utils",
+ "//bt/bta",
+ "//bt/btcore",
+ "//bt/btif",
+ "//bt/device",
+ "//bt/embdrv/g722",
+ "//bt/embdrv/sbc",
+ "//bt/hci",
+ "//bt/osi",
+ "//bt/packet",
+ "//bt/stack",
+ "//bt/udrv",
+ "//bt/utils",
+ ]
+
+ configs += [
+ "//bt:target_defaults",
+ "//bt:external_tinyxml2",
]
cflags_c = [
"-Lobj/osi",
"-losi",
]
+
libs = [
- "-ldl",
- "-lpthread",
- "-lresolv",
- "-lrt",
- "-lz",
- "-latomic",
+ "dl",
+ "pthread",
+ "resolv",
+ "rt",
+ "z",
]
}
diff --git a/system/osi/BUILD.gn b/system/osi/BUILD.gn
index c4fb0cb10f..dc5399c556 100644
--- a/system/osi/BUILD.gn
+++ b/system/osi/BUILD.gn
@@ -44,16 +44,20 @@ static_library("osi") {
]
include_dirs = [
- "//",
- "//linux_include",
- "//internal_include",
- "//utils/include",
- "//stack/include",
+ "//bt/",
+ "//bt/linux_include",
+ "//bt/internal_include",
+ "//bt/utils/include",
+ "//bt/stack/include",
]
deps = [
- "//common",
- "//third_party/libchrome:base",
+ "//bt/common",
+ "//bt/gd/rust/shim:init_flags_bridge_header",
+ ]
+
+ configs += [
+ "//bt:target_defaults",
]
}
@@ -78,15 +82,18 @@ executable("net_test_osi") {
]
include_dirs = [
- "//",
- "//osi/test",
+ "//bt/",
+ "//bt/osi/test",
]
deps = [
- "//osi",
- "//third_party/googletest:gtest_main",
- "//third_party/googletest:gmock_main",
- "//third_party/libchrome:base",
+ "//bt/osi",
+ ]
+
+ configs += [
+ "//bt:external_gtest_main",
+ "//bt:external_gmock_main",
+ "//bt:target_defaults",
]
libs = [
diff --git a/system/packet/BUILD.gn b/system/packet/BUILD.gn
index 37d6ca4944..8b786ccc57 100644
--- a/system/packet/BUILD.gn
+++ b/system/packet/BUILD.gn
@@ -40,13 +40,14 @@ static_library("packet") {
]
include_dirs = [
- "//",
- "//internal_include",
- "//stack/include",
- "//profile/avrcp",
+ "//bt/",
+ "//bt/include",
+ "//bt/internal_include",
+ "//bt/stack/include",
+ "//bt/profile/avrcp",
]
- deps = [
- "//third_party/libchrome:base"
+ configs += [
+ "//bt:target_defaults"
]
}
diff --git a/system/packet/base/packet.h b/system/packet/base/packet.h
index 8c8f229620..2de22abac2 100644
--- a/system/packet/base/packet.h
+++ b/system/packet/base/packet.h
@@ -17,6 +17,7 @@
#pragma once
#include <cstdint>
+#include <memory>
#include <type_traits>
#include <utility>
#include <vector>
@@ -96,4 +97,4 @@ class Packet : public std::enable_shared_from_this<Packet> {
virtual std::pair<size_t, size_t> GetPayloadIndecies() const = 0;
};
-} // namespace bluetooth \ No newline at end of file
+} // namespace bluetooth
diff --git a/system/profile/avrcp/BUILD.gn b/system/profile/avrcp/BUILD.gn
index c37e0a7aa3..1778b98334 100644
--- a/system/profile/avrcp/BUILD.gn
+++ b/system/profile/avrcp/BUILD.gn
@@ -21,14 +21,14 @@ static_library("profile_avrcp") {
]
include_dirs = [
- "//",
- "//btcore/include",
- "//internal_include",
- "//stack/include",
- "//profile/avrcp",
+ "//bt/",
+ "//bt/btcore/include",
+ "//bt/internal_include",
+ "//bt/stack/include",
+ "//bt/profile/avrcp",
]
- deps = [
- "//third_party/libchrome:base"
+ configs += [
+ "//bt:target_defaults"
]
}
diff --git a/system/service/BUILD.gn b/system/service/BUILD.gn
index 59acb167cd..f84610623b 100644
--- a/system/service/BUILD.gn
+++ b/system/service/BUILD.gn
@@ -60,17 +60,20 @@ source_set("service") {
]
include_dirs = [
- "//",
- "//linux_include",
- "//include",
- "//service/common",
- "//third_party/modp_b64/modp64",
+ "//bt/",
+ "//bt/linux_include",
+ "//bt/include",
+ "//bt/service/common",
]
deps = [
- "//types",
- "//osi",
- "//third_party/libchrome:base",
+ "//bt/types",
+ "//bt/osi",
+ "//bt/gd/rust/shim:init_flags_bridge_header",
+ ]
+
+ configs += [
+ "//bt:target_defaults",
]
}
@@ -81,17 +84,19 @@ executable("bluetoothtbd") {
deps = [
":service",
- "//btcore",
- "//third_party/libchrome:base",
- "//third_party/modp_b64",
+ "//bt/btcore",
+ ]
+
+ configs += [
+ "//bt:target_defaults",
]
- include_dirs = [ "//" ]
+ include_dirs = [ "//bt/" ]
libs = [
- "-ldl",
- "-lpthread",
- "-lrt",
+ "dl",
+ "pthread",
+ "rt",
]
}
@@ -102,12 +107,14 @@ executable("service_unittests") {
"test/settings_unittest.cc",
]
- include_dirs = [ "//" ]
+ include_dirs = [ "//bt/" ]
deps = [
":service",
- "//third_party/googletest:gmock_main",
- "//third_party/libchrome:base",
- "//third_party/modp_b64",
+ ]
+
+ configs += [
+ "//bt:external_gmock_main",
+ "//bt:target_defaults",
]
}
diff --git a/system/service/avrcp_target.cc b/system/service/avrcp_target.cc
index fb63fba38d..264945a515 100644
--- a/system/service/avrcp_target.cc
+++ b/system/service/avrcp_target.cc
@@ -26,6 +26,7 @@
#include "base/memory/ptr_util.h"
#include "service/logging_helpers.h"
+#include "array_utils.h"
#include "stack/include/avrc_defs.h"
#define PARSE_ADDR(str) \
@@ -157,7 +158,7 @@ bool AvrcpTarget::GetPlayerAppValueResponse(
const std::string& str_addr, const std::vector<AvrcpIntValue>& values) {
RawAddress addr = PARSE_ADDR(str_addr);
btrc_player_settings_t btrc_values;
- if (values.size() >= arraysize(btrc_values.attr_ids)) {
+ if (values.size() >= ARRAY_SIZE(btrc_values.attr_ids)) {
LOG(ERROR) << "Too many attribute values";
return false;
}
diff --git a/system/service/ipc/dbus/bluetooth_adapter.cc b/system/service/ipc/dbus/bluetooth_adapter.cc
index fd6688a94a..70ee19f188 100644
--- a/system/service/ipc/dbus/bluetooth_adapter.cc
+++ b/system/service/ipc/dbus/bluetooth_adapter.cc
@@ -72,7 +72,7 @@ BluetoothAdapter::BluetoothAdapter(scoped_refptr<Bus> bus,
void BluetoothAdapter::Enable(MethodCall* method_call,
ExportedObject::ResponseSender response_sender) {
VLOG(1) << __func__;
- adapter_->Enable(false);
+ adapter_->Enable();
response_sender.Run(Response::FromMethodCall(method_call));
}
diff --git a/system/service/test/ipc_linux_unittest.cc b/system/service/test/ipc_linux_unittest.cc
index 4a347ae36c..762eb88649 100644
--- a/system/service/test/ipc_linux_unittest.cc
+++ b/system/service/test/ipc_linux_unittest.cc
@@ -27,6 +27,7 @@
#include <base/strings/stringprintf.h>
#include <gtest/gtest.h>
+#include "array_utils.h"
#include "service/adapter.h"
#include "service/hal/fake_bluetooth_gatt_interface.h"
#include "service/hal/fake_bluetooth_interface.h"
@@ -82,7 +83,7 @@ class IPCLinuxTest : public ::testing::Test {
const base::CommandLine::CharType* argv[] = {
"program", ipc_socket_arg.c_str(),
};
- base::CommandLine::Init(arraysize(argv), argv);
+ base::CommandLine::Init(ARRAY_SIZE(argv), argv);
}
void ConnectToTestSocket() {
@@ -119,7 +120,7 @@ class IPCLinuxTestDisabled : public IPCLinuxTest {
void SetUpCommandLine() override {
// Set up with no --ipc-socket-path
const base::CommandLine::CharType* argv[] = {"program"};
- base::CommandLine::Init(arraysize(argv), argv);
+ base::CommandLine::Init(ARRAY_SIZE(argv), argv);
}
private:
diff --git a/system/service/test/settings_unittest.cc b/system/service/test/settings_unittest.cc
index 551c1e053d..60d372e375 100644
--- a/system/service/test/settings_unittest.cc
+++ b/system/service/test/settings_unittest.cc
@@ -19,6 +19,7 @@
#include <base/macros.h>
#include <gtest/gtest.h>
+#include "array_utils.h"
#include "service/settings.h"
#include "service/switches.h"
@@ -45,33 +46,33 @@ class SettingsTest : public ::testing::Test {
TEST_F(SettingsTest, EmptyCommandLine) {
const base::CommandLine::CharType* argv[] = {"program"};
- EXPECT_TRUE(base::CommandLine::Init(arraysize(argv), argv));
+ EXPECT_TRUE(base::CommandLine::Init(ARRAY_SIZE(argv), argv));
EXPECT_TRUE(settings_.Init());
}
TEST_F(SettingsTest, UnexpectedSwitches1) {
const base::CommandLine::CharType* argv[] = {
"program", "--create-ipc-socket=foobar", "--foobarbaz"};
- EXPECT_TRUE(base::CommandLine::Init(arraysize(argv), argv));
+ EXPECT_TRUE(base::CommandLine::Init(ARRAY_SIZE(argv), argv));
EXPECT_FALSE(settings_.Init());
}
TEST_F(SettingsTest, UnexpectedSwitches2) {
const base::CommandLine::CharType* argv[] = {"program", "--foobarbaz"};
- EXPECT_TRUE(base::CommandLine::Init(arraysize(argv), argv));
+ EXPECT_TRUE(base::CommandLine::Init(ARRAY_SIZE(argv), argv));
EXPECT_FALSE(settings_.Init());
}
TEST_F(SettingsTest, UnexpectedArguments1) {
const base::CommandLine::CharType* argv[] = {"program", "foobarbaz"};
- EXPECT_TRUE(base::CommandLine::Init(arraysize(argv), argv));
+ EXPECT_TRUE(base::CommandLine::Init(ARRAY_SIZE(argv), argv));
EXPECT_FALSE(settings_.Init());
}
TEST_F(SettingsTest, UnexpectedArguments2) {
const base::CommandLine::CharType* argv[] = {
"program", "--create-ipc-socket=foobar", "foobarbaz"};
- EXPECT_TRUE(base::CommandLine::Init(arraysize(argv), argv));
+ EXPECT_TRUE(base::CommandLine::Init(ARRAY_SIZE(argv), argv));
EXPECT_FALSE(settings_.Init());
}
@@ -79,21 +80,21 @@ TEST_F(SettingsTest, TooManyIpcOptions) {
const base::CommandLine::CharType* argv[] = {
"program", "--create-ipc-socket=foobar",
"--android-ipc-socket-suffix=foobar"};
- EXPECT_TRUE(base::CommandLine::Init(arraysize(argv), argv));
+ EXPECT_TRUE(base::CommandLine::Init(ARRAY_SIZE(argv), argv));
EXPECT_FALSE(settings_.Init());
}
TEST_F(SettingsTest, GoodArgumentsCreateIpc) {
const base::CommandLine::CharType* argv[] = {"program",
"--create-ipc-socket=foobar"};
- EXPECT_TRUE(base::CommandLine::Init(arraysize(argv), argv));
+ EXPECT_TRUE(base::CommandLine::Init(ARRAY_SIZE(argv), argv));
EXPECT_TRUE(settings_.Init());
}
TEST_F(SettingsTest, GoodArgumentsAndroidIpc) {
const base::CommandLine::CharType* argv[] = {
"program", "--android-ipc-socket-suffix=foobar"};
- EXPECT_TRUE(base::CommandLine::Init(arraysize(argv), argv));
+ EXPECT_TRUE(base::CommandLine::Init(ARRAY_SIZE(argv), argv));
EXPECT_TRUE(settings_.Init());
}
diff --git a/system/stack/BUILD.gn b/system/stack/BUILD.gn
index 9bb356ce6e..8237d69a22 100644
--- a/system/stack/BUILD.gn
+++ b/system/stack/BUILD.gn
@@ -22,26 +22,19 @@ static_library("crypto_toolbox") {
]
include_dirs = [
- "//",
+ "//bt/",
]
- deps = [
- "//third_party/libchrome:base",
+ configs += [
+ "//bt:target_defaults",
]
}
-static_library("stack") {
+source_set("nonstandard_codecs") {
sources = [
"a2dp/a2dp_aac.cc",
"a2dp/a2dp_aac_decoder.cc",
"a2dp/a2dp_aac_encoder.cc",
- "a2dp/a2dp_api.cc",
- "a2dp/a2dp_codec_config.cc",
- "a2dp/a2dp_sbc.cc",
- "a2dp/a2dp_sbc_decoder.cc",
- "a2dp/a2dp_sbc_encoder.cc",
- "a2dp/a2dp_sbc_up_sample.cc",
- "a2dp/a2dp_vendor.cc",
"a2dp/a2dp_vendor_aptx.cc",
"a2dp/a2dp_vendor_aptx_encoder.cc",
"a2dp/a2dp_vendor_aptx_hd.cc",
@@ -50,6 +43,25 @@ static_library("stack") {
"a2dp/a2dp_vendor_ldac_abr.cc",
"a2dp/a2dp_vendor_ldac_decoder.cc",
"a2dp/a2dp_vendor_ldac_encoder.cc",
+ ]
+
+ configs += [
+ # "//bt:external_libldac",
+ # "//bt:external_aac",
+ ]
+}
+
+static_library("stack") {
+ sources = [
+ "a2dp/a2dp_api.cc",
+ "a2dp/a2dp_codec_config.cc",
+ "a2dp/a2dp_sbc.cc",
+ "a2dp/a2dp_sbc_decoder.cc",
+ "a2dp/a2dp_sbc_encoder.cc",
+ "a2dp/a2dp_sbc_up_sample.cc",
+ "a2dp/a2dp_vendor.cc",
+ "acl/btm_acl.cc",
+ "acl/btm_pm.cc",
"avct/avct_api.cc",
"avct/avct_bcb_act.cc",
"avct/avct_ccb.cc",
@@ -64,7 +76,8 @@ static_library("stack") {
"avdt/avdt_l2c.cc",
"avdt/avdt_msg.cc",
"avdt/avdt_scb.cc",
- "avdt/avdt_scb_act.cc",
+ # Disable temporarily due to libcutils dependency
+ #"avdt/avdt_scb_act.cc",
"avrc/avrc_api.cc",
"avrc/avrc_bld_ct.cc",
"avrc/avrc_bld_tg.cc",
@@ -78,7 +91,6 @@ static_library("stack") {
"bnep/bnep_utils.cc",
"btm/ble_advertiser_hci_interface.cc",
"btm/ble_scanner_hci_interface.cc",
- "btm/btm_acl.cc",
"btm/btm_ble.cc",
"btm/btm_ble_addr.cc",
"btm/btm_ble_adv_filter.cc",
@@ -93,7 +105,6 @@ static_library("stack") {
"btm/btm_inq.cc",
"btm/btm_iso.cc",
"btm/btm_main.cc",
- "btm/btm_pm.cc",
"btm/btm_sco.cc",
"btm/btm_sec.cc",
"btu/btu_hcif.cc",
@@ -149,7 +160,8 @@ static_library("stack") {
"smp/smp_api.cc",
"smp/smp_br_main.cc",
"smp/smp_keys.cc",
- "smp/smp_l2c.cc",
+ # Disable temporarily due to libcutils dependency
+ #"smp/smp_l2c.cc",
"smp/smp_main.cc",
"smp/smp_utils.cc",
"srvc/srvc_dis.cc",
@@ -157,6 +169,7 @@ static_library("stack") {
]
include_dirs = [
+ ".",
"include",
"avct",
"btm",
@@ -172,31 +185,34 @@ static_library("stack") {
"sdp",
"smp",
"srvc",
- "//linux_include",
- "//internal_include",
- "//btcore/include",
- "//vnd/include",
- "//vnd/ble",
- "//btif/include",
- "//hci/include",
- "//internal_include",
- "//udrv/include",
- "//rpc/include",
- "//hcis",
- "//ctrlr/include",
- "//bta/include",
- "//bta/sys",
- "//utils/include",
- "//",
+ "//bt/types",
+ "//bt/linux_include",
+ "//bt/internal_include",
+ "//bt/btcore/include",
+ "//bt/vnd/include",
+ "//bt/vnd/ble",
+ "//bt/btif/include",
+ "//bt/hci/include",
+ "//bt/internal_include",
+ "//bt/udrv/include",
+ "//bt/rpc/include",
+ "//bt/hcis",
+ "//bt/ctrlr/include",
+ "//bt/bta/include",
+ "//bt/bta/sys",
+ "//bt/utils/include",
+ "//bt/",
]
deps = [
":crypto_toolbox",
- "//types",
- "//third_party/libchrome:base",
- "//third_party/libldac:libldacBT_enc",
- "//third_party/libldac:libldacBT_abr",
- "//third_party/aac:libFraunhoferAAC",
+ "//bt/types",
+ "//bt/gd/rust/shim:init_flags_bridge_header",
+ "//bt/third_party/proto_logging/stats:libbt-platform-protos",
+ ]
+
+ configs += [
+ "//bt:target_defaults",
]
}
@@ -209,21 +225,20 @@ executable("stack_unittests") {
include_dirs = [
"include",
- "//",
- "//bta/eatt",
- "//bta/include",
- "//bta/sys",
- "//btcore/include",
- "//embdrv/sbc/encoder/include",
- "//hci/include",
- "//internal_include",
- "//stack/a2dp",
- "//stack/btm",
- "//stack/include",
- "//third_party/tinyxml2",
- "//udrv/include",
- "//utils/include",
- "//vnd/include"
+ "//bt/",
+ "//bt/bta/eatt",
+ "//bt/bta/include",
+ "//bt/bta/sys",
+ "//bt/btcore/include",
+ "//bt/embdrv/sbc/encoder/include",
+ "//bt/hci/include",
+ "//bt/internal_include",
+ "//bt/stack/a2dp",
+ "//bt/stack/btm",
+ "//bt/stack/include",
+ "//bt/udrv/include",
+ "//bt/utils/include",
+ "//bt/vnd/include"
]
libs = [
@@ -237,16 +252,20 @@ executable("stack_unittests") {
deps = [
":stack",
- "//osi",
- "//btcore",
- "//device",
- "//embdrv/sbc",
- "//embdrv/g722",
- "//hci",
- "//types",
- "//main:bluetooth",
- "//third_party/googletest:gmock_main",
- "//third_party/libchrome:base",
+ "//bt/osi",
+ "//bt/btcore",
+ "//bt/device",
+ "//bt/embdrv/sbc",
+ "//bt/embdrv/g722",
+ "//bt/hci",
+ "//bt/types",
+ "//bt/main:bluetooth",
+ ]
+
+ configs += [
+ "//bt:external_tinyxml2",
+ "//bt:external_gmock_main",
+ "//bt:external_libchrome",
]
}
@@ -257,13 +276,16 @@ executable("net_test_stack_crypto_toolbox") {
]
include_dirs = [
- "//",
+ "//bt/",
]
deps = [
":crypto_toolbox",
- "//third_party/googletest:gmock_main",
- "//third_party/libchrome:base",
+ ]
+
+ configs += [
+ "//bt:external_gmock_main",
+ "//bt:external_libchrome",
]
}
@@ -281,26 +303,25 @@ executable("net_test_stack_smp") {
]
include_dirs = [
- "//",
- "//linux_include",
- "//internal_include",
- "//btcore/include",
- "//hci/include",
- "//utils/include",
- "//bta/include",
- "//bta/sys",
- "//btcore/include",
- "//embdrv/sbc/encoder/include",
- "//hci/include",
- "//internal_include",
- "//stack/a2dp",
- "//stack/l2cap",
- "//stack/btm",
- "//stack/include",
- "//third_party/tinyxml2",
- "//udrv/include",
- "//utils/include",
- "//vnd/include"
+ "//bt/",
+ "//bt/linux_include",
+ "//bt/internal_include",
+ "//bt/btcore/include",
+ "//bt/hci/include",
+ "//bt/utils/include",
+ "//bt/bta/include",
+ "//bt/bta/sys",
+ "//bt/btcore/include",
+ "//bt/embdrv/sbc/encoder/include",
+ "//bt/hci/include",
+ "//bt/internal_include",
+ "//bt/stack/a2dp",
+ "//bt/stack/l2cap",
+ "//bt/stack/btm",
+ "//bt/stack/include",
+ "//bt/udrv/include",
+ "//bt/utils/include",
+ "//bt/vnd/include"
]
libs = [
@@ -314,10 +335,14 @@ executable("net_test_stack_smp") {
deps = [
":crypto_toolbox",
- "//osi",
- "//types",
- "//third_party/googletest:gmock_main",
- "//third_party/libchrome:base",
+ "//bt/osi",
+ "//bt/types",
+ ]
+
+ configs += [
+ "//bt:external_tinyxml2",
+ "//bt:external_gmock_main",
+ "//bt:target_defaults",
]
}
@@ -330,11 +355,11 @@ executable("net_test_stack_multi_adv") {
include_dirs = [
"include",
- "//",
- "//btcore/include",
- "//hci/include",
- "//internal_include",
- "//stack/btm",
+ "//bt/",
+ "//bt/btcore/include",
+ "//bt/hci/include",
+ "//bt/internal_include",
+ "//bt/stack/btm",
]
libs = [
@@ -347,9 +372,12 @@ executable("net_test_stack_multi_adv") {
]
deps = [
- "//types",
- "//third_party/googletest:gmock_main",
- "//third_party/libchrome:base",
+ "//bt/types",
+ ]
+
+ configs += [
+ "//bt:external_gmock_main",
+ "//bt:target_defaults",
]
}
diff --git a/system/stack/a2dp/a2dp_aac_decoder.cc b/system/stack/a2dp/a2dp_aac_decoder.cc
index 55c020d048..0dcd5adf8a 100644
--- a/system/stack/a2dp/a2dp_aac_decoder.cc
+++ b/system/stack/a2dp/a2dp_aac_decoder.cc
@@ -18,7 +18,11 @@
#include "a2dp_aac_decoder.h"
+#ifdef OS_ANDROID
#include <aacdecoder_lib.h>
+#else
+#include <fdk-aac/aacdecoder_lib.h>
+#endif
#include <base/logging.h>
#include "a2dp_aac.h"
diff --git a/system/stack/a2dp/a2dp_aac_encoder.cc b/system/stack/a2dp/a2dp_aac_encoder.cc
index b0f3dcb384..171db39962 100644
--- a/system/stack/a2dp/a2dp_aac_encoder.cc
+++ b/system/stack/a2dp/a2dp_aac_encoder.cc
@@ -23,7 +23,11 @@
#include <stdio.h>
#include <string.h>
+#ifdef OS_ANDROID
#include <aacenc_lib.h>
+#else
+#include <fdk-aac/aacenc_lib.h>
+#endif
#include <base/logging.h>
#include "a2dp_aac.h"
diff --git a/system/stack/btm/security_device_record.h b/system/stack/btm/security_device_record.h
index e68ae93ccb..fefa6ccf1e 100644
--- a/system/stack/btm/security_device_record.h
+++ b/system/stack/btm/security_device_record.h
@@ -19,6 +19,7 @@
#pragma once
#include <base/strings/stringprintf.h>
+#include <string.h>
#include <cstdint>
#include <string>
diff --git a/system/stack/hcic/hciblecmds.cc b/system/stack/hcic/hciblecmds.cc
index 92a15c3006..bc18dd62d4 100644
--- a/system/stack/hcic/hciblecmds.cc
+++ b/system/stack/hcic/hciblecmds.cc
@@ -29,6 +29,8 @@
#include "hcidefs.h"
#include "hcimsgs.h"
+#include <bitset>
+
#include <base/bind.h>
#include <stddef.h>
#include <string.h>
diff --git a/system/stack/include/bt_types.h b/system/stack/include/bt_types.h
index 1fbdbd9912..c1ac7e8c6c 100644
--- a/system/stack/include/bt_types.h
+++ b/system/stack/include/bt_types.h
@@ -234,7 +234,7 @@ typedef struct {
#define BT_HDR_SIZE (sizeof(BT_HDR))
-enum : uint16_t {
+enum {
BT_PSM_SDP = 0x0001,
BT_PSM_RFCOMM = 0x0003,
BT_PSM_TCS = 0x0005,
@@ -667,7 +667,7 @@ typedef uint8_t COF[COF_LEN]; /* ciphering offset number */
/* Device Types
*/
-enum : uint8_t {
+enum {
BT_DEVICE_TYPE_BREDR = (1 << 0),
BT_DEVICE_TYPE_BLE = (1 << 1),
BT_DEVICE_TYPE_DUMO = BT_DEVICE_TYPE_BREDR | BT_DEVICE_TYPE_BLE,
diff --git a/system/test/suite/BUILD.gn b/system/test/suite/BUILD.gn
index 7e68a1a958..2cb68f1c2f 100644
--- a/system/test/suite/BUILD.gn
+++ b/system/test/suite/BUILD.gn
@@ -22,19 +22,22 @@ executable("net_test_bluetooth") {
]
include_dirs = [
- "//",
- "//test/suite",
+ "//bt",
+ "//bt/test/suite",
]
deps = [
- "//btcore",
- "//main:bluetooth",
- "//service:service",
- "//service:service_unittests",
- "//types:types_unittests",
- "//third_party/libchrome:base",
- "//osi",
- "//third_party/googletest:gtest_main",
+ "//bt/btcore",
+ "//bt/main:bluetooth",
+ "//bt/service:service",
+ "//bt/service:service_unittests",
+ "//bt/types:types_unittests",
+ "//bt/osi",
+ ]
+
+ configs += [
+ "//bt:external_libchrome",
+ "//bt:external_gtest_main",
]
libs = [
diff --git a/system/types/BUILD.gn b/system/types/BUILD.gn
index fa9a4af4c1..08ab05cf00 100644
--- a/system/types/BUILD.gn
+++ b/system/types/BUILD.gn
@@ -21,16 +21,15 @@ static_library("types") {
sources = [
"bluetooth/uuid.cc",
- "le_address.cc",
"raw_address.cc",
]
include_dirs = [
- "//",
+ "//bt/",
]
- deps = [
- "//third_party/libchrome:base",
+ configs += [
+ "//bt:external_libchrome",
]
}
@@ -42,7 +41,7 @@ executable("types_unittests") {
]
include_dirs = [
- "//",
+ "//bt/",
]
libs = [
@@ -55,8 +54,11 @@ executable("types_unittests") {
]
deps = [
- "//types",
- "//third_party/googletest:gmock_main",
- "//third_party/libchrome:base",
+ "//bt/types",
+ ]
+
+ configs += [
+ "//bt:external_gmock_main",
+ "//bt:external_libchrome",
]
}
diff --git a/system/types/bluetooth/uuid.cc b/system/types/bluetooth/uuid.cc
index 28c67186be..d05f4370f0 100644
--- a/system/types/bluetooth/uuid.cc
+++ b/system/types/bluetooth/uuid.cc
@@ -20,6 +20,7 @@
#include <base/rand_util.h>
#include <base/strings/stringprintf.h>
+#include <string.h>
#include <algorithm>
namespace bluetooth {
@@ -173,4 +174,4 @@ std::string Uuid::ToString() const {
uu[0], uu[1], uu[2], uu[3], uu[4], uu[5], uu[6], uu[7], uu[8], uu[9],
uu[10], uu[11], uu[12], uu[13], uu[14], uu[15]);
}
-} // namespace bluetooth \ No newline at end of file
+} // namespace bluetooth
diff --git a/system/udrv/BUILD.gn b/system/udrv/BUILD.gn
index 3712bd4189..b42932e660 100644
--- a/system/udrv/BUILD.gn
+++ b/system/udrv/BUILD.gn
@@ -22,10 +22,13 @@ source_set("udrv") {
include_dirs = [
"include",
"uipc",
- "//",
- "//internal_include",
- "//stack/include",
- "//utils/include",
- "//third_party/libchrome",
+ "//bt/",
+ "//bt/internal_include",
+ "//bt/stack/include",
+ "//bt/utils/include",
+ ]
+
+ configs += [
+ "//bt:target_defaults"
]
}
diff --git a/system/utils/BUILD.gn b/system/utils/BUILD.gn
index 46b7236d07..f92942d50a 100644
--- a/system/utils/BUILD.gn
+++ b/system/utils/BUILD.gn
@@ -21,9 +21,16 @@ static_library("utils") {
include_dirs = [
"include",
- "//",
- "//stack/include",
- "//third_party/libchrome",
- "//third_party/googletest/googletest/include/",
+ "//bt/",
+ "//bt/stack/include",
+ ]
+
+ configs += [
+ "//bt:target_defaults",
+ "//bt:external_gtest"
+ ]
+
+ deps = [
+ "//bt/gd/rust/shim:init_flags_bridge_header",
]
}
diff --git a/system/vendor_libs/test_vendor_lib/types/BUILD.gn b/system/vendor_libs/test_vendor_lib/types/BUILD.gn
index 68f76e3c54..dac333c32c 100644
--- a/system/vendor_libs/test_vendor_lib/types/BUILD.gn
+++ b/system/vendor_libs/test_vendor_lib/types/BUILD.gn
@@ -26,11 +26,11 @@ static_library("types") {
]
include_dirs = [
- "//",
+ "//bt",
]
- deps = [
- "//third_party/libchrome:base",
+ configs += [
+ "//bt:external_libchrome",
]
}
@@ -42,7 +42,7 @@ executable("types_unittests") {
]
include_dirs = [
- "//",
+ "//bt",
]
libs = [
@@ -55,8 +55,11 @@ executable("types_unittests") {
]
deps = [
- "//types",
- "//third_party/googletest:gmock_main",
- "//third_party/libchrome:base",
+ "//bt/types",
+ ]
+
+ configs += [
+ "//bt:external_gmock_main",
+ "//bt:external_libchrome",
]
}