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

Commit e0d218ec authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Remove dynamic legacy module lookup aka STATIC_LIBBLUETOOTH" am:...

Merge "Remove dynamic legacy module lookup aka STATIC_LIBBLUETOOTH" am: 897dda37 am: be91702c am: 573733fd

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1877017

Change-Id: I72868145aa1d2073bc70bd4e5006dc537ad2595b
parents 610d1b81 573733fd
Loading
Loading
Loading
Loading
+0 −39
Original line number Diff line number Diff line
@@ -29,44 +29,6 @@

using base::StringPrintf;

#define BLUETOOTH_LIBRARY_NAME "libbluetooth.so"

#if !defined(STATIC_LIBBLUETOOTH)
int hal_util_load_bt_library(const bt_interface_t** interface) {
  const char* sym = BLUETOOTH_INTERFACE_STRING;
  bt_interface_t* itf = nullptr;

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

  // Get the address of the bt_interface_t.
  itf = (bt_interface_t*)dlsym(handle, sym);
  if (!itf) {
    LOG(ERROR) << __func__ << ": failed to load symbol from Bluetooth library "
               << sym;
    goto error;
  }

  // Success.
  LOG(INFO) << __func__ << " loaded HAL path=" << BLUETOOTH_LIBRARY_NAME
            << " btinterface=" << itf << " handle=" << handle;

  *interface = itf;
  return 0;

error:
  *interface = NULL;
  if (handle) dlclose(handle);

  return -EINVAL;
}
#else
extern bt_interface_t bluetoothInterface;

int hal_util_load_bt_library(const bt_interface_t** interface) {
@@ -74,4 +36,3 @@ int hal_util_load_bt_library(const bt_interface_t** interface) {

  return 0;
}
#endif
+7 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include <map>

#include "bta/include/bta_ag_api.h"
#include "btcore/include/module.h"
#include "btif/include/btif_api.h"
#include "btif/include/btif_common.h"
#include "types/raw_address.h"
@@ -32,6 +33,12 @@ uint8_t btu_trace_level = BT_TRACE_LEVEL_DEBUG;

const tBTA_AG_RES_DATA tBTA_AG_RES_DATA::kEmpty = {};

module_t bt_utils_module;
module_t gd_controller_module;
module_t gd_idle_module;
module_t gd_shim_module;
module_t osi_module;

namespace {

auto timeout_time = std::chrono::seconds(3);