gn-build: Add bluetooth-service target
This patch makes the Bluetooth system service (service/) buildable using GN:
1. Added new BUILD.gn file for service/
2. Added conditional compilation for global config paths, with TODOs for
generalizing them later.
3. Added a shim for loading the Bluetooth library that calls hw_get_module on
Android and explicitly calls dlopen on OS_GENERIC.
4. Fixed compile warnings and errors.
5. Did some minor clean up in gatt_server.cpp for better readability.
Bug: 22124644
Change-Id: I3226537a3a5211a6762651a35707638df29956b0
diff --git a/main/stack_config.c b/main/stack_config.c
index 53dda72..cbc1c71 100644
--- a/main/stack_config.c
+++ b/main/stack_config.c
@@ -35,7 +35,12 @@
// Module lifecycle functions
static future_t *init() {
+// TODO(armansito): Find a better way than searching by a hardcoded path.
+#if defined(OS_GENERIC)
+ const char *path = "bt_stack.conf";
+#else // !defined(OS_GENERIC)
const char *path = "/etc/bluetooth/bt_stack.conf";
+#endif // defined(OS_GENERIC)
assert(path != NULL);
LOG_INFO(LOG_TAG, "%s attempt to load stack conf from %s", __func__, path);