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

Commit e7bf8a99 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

Misc fix for bluetooth host build

- Use hci_layer_linux for host
- No-op for some functions for host
- Don't crash if we cannot enable real time thread.  Note that we may
need sudo to do this; or this might be unsupported by kernel.  Make the
stack more generic in this case.

Tag: #gd-refactor
Bug: 181590011
Test: make and run bt_topshim_facade
Change-Id: I05bb8245f8f688ea1ac73608707de962b0ee7a4b
parent 6e420f5c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -192,8 +192,10 @@ bool btif_a2dp_sink_init() {

  /* Schedule the rest of the operations */
  if (!btif_a2dp_sink_cb.worker_thread.EnableRealTimeScheduling()) {
#if defined(OS_ANDROID)
    LOG(FATAL) << __func__
               << ": Failed to increase A2DP decoder thread priority";
#endif
  }
  btif_a2dp_sink_cb.worker_thread.DoInThread(
      FROM_HERE, base::BindOnce(btif_a2dp_sink_init_delayed));
+2 −0
Original line number Diff line number Diff line
@@ -357,7 +357,9 @@ bool btif_a2dp_source_startup(void) {
static void btif_a2dp_source_startup_delayed() {
  LOG_INFO("%s: state=%s", __func__, btif_a2dp_source_cb.StateStr().c_str());
  if (!btif_a2dp_source_thread.EnableRealTimeScheduling()) {
#if defined(OS_ANDROID)
    LOG(FATAL) << __func__ << ": unable to enable real time scheduling";
#endif
  }
  if (!bluetooth::audio::a2dp::init(&btif_a2dp_source_thread)) {
    if (btif_av_is_a2dp_offload_enabled()) {
+9 −1
Original line number Diff line number Diff line
@@ -18,9 +18,16 @@

#define LOG_TAG "bt_btif_config_transcode"

#include "osi/include/config.h"

#ifndef OS_ANDROID
std::unique_ptr<config_t> btif_config_transcode(const char* xml_filename) {
  // Legacy XML config never exists for non-Android
  return nullptr;
}
#else
#include <tinyxml2.h>

#include "osi/include/config.h"
#include "osi/include/log.h"

using namespace tinyxml2;
@@ -59,3 +66,4 @@ std::unique_ptr<config_t> btif_config_transcode(const char* xml_filename) {

  return config;
}
#endif
+13 −2
Original line number Diff line number Diff line
@@ -24,13 +24,20 @@ cc_library_static {
        "address_obfuscator.cc",
        "message_loop_thread.cc",
        "metric_id_allocator.cc",
        "metrics.cc",
        "once_timer.cc",
        "os_utils.cc",
        "repeating_timer.cc",
        "time_util.cc",
        "stop_watch_legacy.cc",
    ],
    target: {
        android: {
            srcs: ["metrics.cc"],
        },
        host: {
            srcs: ["metrics_linux.cc"],
        },
    },
    shared_libs: [
        "libcrypto",
    ],
@@ -61,7 +68,6 @@ cc_test {
        "leaky_bonded_queue_unittest.cc",
        "lru_unittest.cc",
        "message_loop_thread_unittest.cc",
        "metrics_unittest.cc",
        "metric_id_allocator_unittest.cc",
        "once_timer_unittest.cc",
        "repeating_timer_unittest.cc",
@@ -69,6 +75,11 @@ cc_test {
        "time_util_unittest.cc",
        "id_generator_unittest.cc",
    ],
    target: {
        android: {
            srcs: ["metrics_unittest.cc"],
        },
    },
    shared_libs: [
        "libprotobuf-cpp-lite",
        "libcrypto",
+2 −2
Original line number Diff line number Diff line
@@ -29,8 +29,8 @@ namespace common {
void A2dpSessionMetrics::Update(const A2dpSessionMetrics& metrics) {}

bool A2dpSessionMetrics::operator==(const A2dpSessionMetrics& rhs) const {
  LOG(FATAL) << "UNIMPLEMENTED";
  return 0;
  LOG(INFO) << "UNIMPLEMENTED";
  return true;
}

struct BluetoothMetricsLogger::impl {
Loading