Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a75a654c authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

hw/bluetooth.default.so -> libbluetooth.so (1/2)

Also rename the build goal for both the library and headers.

Bug: 67853426
Test: run Bluetooth
Merged-In: Iaffeebc1d3f2761e13f6d66d4e855dc342603054
Change-Id: Iaffeebc1d3f2761e13f6d66d4e855dc342603054
(cherry picked from commit 842ff8ed7f5b00d5f6da9d975f37e65c41bb8ebc)
parent 83a66337
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -23,7 +23,7 @@ cc_defaults {
    shared_libs: [
    shared_libs: [
        "libcutils",
        "libcutils",
    ],
    ],
    header_libs: ["bluetooth.default_headers"],
    header_libs: ["libbluetooth_headers"],
    cflags: ["-DBUILDCFG"],
    cflags: ["-DBUILDCFG"],
}
}


+1 −1
Original line number Original line Diff line number Diff line
@@ -15,7 +15,7 @@ cc_library_static {
    shared_libs: [
    shared_libs: [
        "liblog",
        "liblog",
    ],
    ],
    header_libs: ["bluetooth.default_headers"],
    header_libs: ["libbluetooth_headers"],
    host_supported: true,
    host_supported: true,
    target: {
    target: {
        darwin: {
        darwin: {
+1 −1
Original line number Original line Diff line number Diff line
@@ -19,5 +19,5 @@
#include <hardware/bluetooth.h>
#include <hardware/bluetooth.h>


// Loads the Bluetooth library. This function looks explicitly for
// Loads the Bluetooth library. This function looks explicitly for
// libbluetooth.default.so and loads it.
// libbluetooth.so and loads it.
int hal_util_load_bt_library(const bt_interface_t** interface);
int hal_util_load_bt_library(const bt_interface_t** interface);
+5 −19
Original line number Original line Diff line number Diff line
@@ -29,34 +29,20 @@


using base::StringPrintf;
using base::StringPrintf;


#define BLUETOOTH_LIBRARY_NAME "bluetooth.default.so"
#define BLUETOOTH_LIBRARY_NAME "libbluetooth.so"
#if defined(__LP64__)
#define BACKUP_PATH "/system/lib64/hw/" BLUETOOTH_LIBRARY_NAME
#else
#define BACKUP_PATH "/system/lib/hw/" BLUETOOTH_LIBRARY_NAME
#endif


int hal_util_load_bt_library(const bt_interface_t** interface) {
int hal_util_load_bt_library(const bt_interface_t** interface) {
  const char* sym = BLUETOOTH_INTERFACE_STRING;
  const char* sym = BLUETOOTH_INTERFACE_STRING;
  bt_interface_t* itf = nullptr;
  bt_interface_t* itf = nullptr;


  // Always try to load the default Bluetooth stack on GN builds.
  // Always try to load the default Bluetooth stack on GN builds.
  const char* path = BLUETOOTH_LIBRARY_NAME;
  void* handle = dlopen(BLUETOOTH_LIBRARY_NAME, RTLD_NOW);
  void* handle = dlopen(path, RTLD_NOW);
  if (!handle) {
  if (!handle) {
    const char* err_str = dlerror();
    const char* err_str = dlerror();
    LOG(WARNING) << __func__ << ": failed to load Bluetooth library " << path
    LOG(ERROR) << __func__ << ": failed to load bluetooth library, error="
                 << ", error=" << (err_str ? err_str : "error unknown");
               << (err_str ? err_str : "error unknown");
    path = BACKUP_PATH;
    LOG(WARNING) << __func__ << ": loading backup path " << path;
    handle = dlopen(path, RTLD_NOW);
    if (!handle) {
      err_str = dlerror();
      LOG(ERROR) << __func__ << ": failed to load Bluetooth library " << path
                 << ", error=" << (err_str ? err_str : "error unknown");
    goto error;
    goto error;
  }
  }
  }


  // Get the address of the bt_interface_t.
  // Get the address of the bt_interface_t.
  itf = (bt_interface_t*)dlsym(handle, sym);
  itf = (bt_interface_t*)dlsym(handle, sym);
+2 −2
Original line number Original line Diff line number Diff line
@@ -107,7 +107,7 @@ cc_test {
    defaults: ["fluoride_defaults"],
    defaults: ["fluoride_defaults"],
    include_dirs: btifCommonIncludes,
    include_dirs: btifCommonIncludes,
    srcs: ["test/btif_storage_test.cc"],
    srcs: ["test/btif_storage_test.cc"],
    header_libs: ["bluetooth.default_headers"],
    header_libs: ["libbluetooth_headers"],
    shared_libs: [
    shared_libs: [
        "liblog",
        "liblog",
        "libcutils",
        "libcutils",
@@ -132,7 +132,7 @@ cc_test {
      "src/btif_profile_queue.cc",
      "src/btif_profile_queue.cc",
      "test/btif_profile_queue_test.cc"
      "test/btif_profile_queue_test.cc"
    ],
    ],
    header_libs: ["bluetooth.default_headers"],
    header_libs: ["libbluetooth_headers"],
    shared_libs: [
    shared_libs: [
        "liblog",
        "liblog",
        "libcutils",
        "libcutils",
Loading