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

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

Merge "Properly lifecycle free tSCO_CB::bluetooth::audio::sco" am: 272b13b5

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2020299

Change-Id: I07cba093f64d5677ab41311b62b63747426dd0de
parents 7ef8dba0 272b13b5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -356,6 +356,7 @@ typedef struct tBTM_CB {
    history_.reset();

    devcb.Free();
    sco_cb.Free();
    btm_inq_vars.Free();

    fixed_queue_free(page_queue, nullptr);
+2 −0
Original line number Diff line number Diff line
@@ -140,6 +140,8 @@ typedef struct {
    bluetooth::audio::sco::init();
  }

  void Free() { bluetooth::audio::sco::cleanup(); }

  uint16_t get_index(const tSCO_CONN* p_sco) const {
    CHECK(p_sco != nullptr);
    const tSCO_CONN* p = sco_db;
+6 −1
Original line number Diff line number Diff line
@@ -68,7 +68,12 @@ namespace bluetooth {
namespace audio {
namespace sco {

void init() { sco_uipc = UIPC_Init(); }
void init() {
  if (sco_uipc != nullptr) {
    LOG_WARN("Re-initializing UIPC that is already running");
  }
  sco_uipc = UIPC_Init();
}

void open() {
  UIPC_Open(*sco_uipc, UIPC_CH_ID_AV_AUDIO, sco_data_cb, SCO_HOST_DATA_PATH);
+8 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include <vector>

#include "btif/include/btif_hh.h"
#include "common/init_flags.h"
#include "hci/include/hci_layer.h"
#include "hci/include/hci_packet_factory.h"
#include "internal_include/stack_config.h"
@@ -121,6 +122,13 @@ TEST_F(StackBtmTest, DynamicLifecycle) {
  delete btm;
}

TEST_F(StackBtmTest, tSCO_CB) {
  bluetooth::common::InitFlags::SetAllForTesting();
  tSCO_CB* p_sco = &btm_cb.sco_cb;
  p_sco->Init();
  p_sco->Free();
}

TEST_F(StackBtmTest, InformClientOnConnectionSuccess) {
  get_btm_client_interface().lifecycle.btm_init();