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

Commit 3077810b authored by Henri Chataing's avatar Henri Chataing
Browse files

system/gd: Merge VendorSpecificEventManager into HciLayer module

Bug: 333555245
Test: m com.android.btservices
Flag: EXEMPT no logical change
Change-Id: I151f9be5f587d2044e348fa563c4c070c50a4f8e
parent a24c88b9
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@
#include "core_callbacks.h"
#include "hci/hci_interface.h"
#include "hci/hci_packets.h"
#include "hci/vendor_specific_event_manager_interface.h"
#include "internal_include/bt_trace.h"
#include "main/shim/entry.h"
#include "osi/include/properties.h"
@@ -982,13 +981,13 @@ static void vendor_specific_event_callback(
}

void register_vse() {
  bluetooth::shim::GetVendorSpecificEventManager()->RegisterEventHandler(
  bluetooth::shim::GetHciLayer()->RegisterVendorSpecificEventHandler(
      hci::VseSubeventCode::BQR_EVENT,
      to_bind_->Bind(vendor_specific_event_callback));
}

void unregister_vse() {
  bluetooth::shim::GetVendorSpecificEventManager()->UnregisterEventHandler(
  bluetooth::shim::GetHciLayer()->UnregisterVendorSpecificEventHandler(
      hci::VseSubeventCode::BQR_EVENT);
}

+6 −9
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@
#include "gtest/gtest.h"
#include "hci/controller_interface_mock.h"
#include "hci/hci_layer_mock.h"
#include "hci/vendor_specific_event_manager_mock.h"
#include "include/hardware/bluetooth.h"
#include "include/hardware/bt_av.h"
#include "main/shim/entry.h"
@@ -877,8 +876,6 @@ class BtifCoreWithVendorSupportTest : public BtifCoreWithControllerTest {
  void SetUp() override {
    BtifCoreWithControllerTest::SetUp();
    bluetooth::hci::testing::mock_hci_layer_ = &hci_;
    bluetooth::hci::testing::mock_vendor_specific_event_manager_ =
        &vendor_manager_;
    test::mock::osi_properties::osi_property_get.body = get_properties;

    std::promise<void> configuration_promise;
@@ -924,8 +921,9 @@ class BtifCoreWithVendorSupportTest : public BtifCoreWithControllerTest {
              callback(response);
            })
        .RetiresOnSaturation();
    EXPECT_CALL(vendor_manager_,
                RegisterEventHandler(VseSubeventCode::BQR_EVENT, _))
    EXPECT_CALL(
        hci_,
        RegisterVendorSpecificEventHandler(VseSubeventCode::BQR_EVENT, _))
        .WillOnce(SaveArg<1>(&this->vse_callback_));
    do_in_main_thread(FROM_HERE, BindOnce([]() {
                        bluetooth::bqr::EnableBtQualityReport(get_main());
@@ -938,8 +936,9 @@ class BtifCoreWithVendorSupportTest : public BtifCoreWithControllerTest {
    std::promise<void> disable_promise;
    auto disable_future = disable_promise.get_future();
    auto set_promise = [&disable_promise]() { disable_promise.set_value(); };
    EXPECT_CALL(vendor_manager_,
                UnregisterEventHandler(VseSubeventCode::BQR_EVENT));
    EXPECT_CALL(
        hci_,
        UnregisterVendorSpecificEventHandler(VseSubeventCode::BQR_EVENT));
    EXPECT_CALL(
        hci_,
        EnqueueCommand(
@@ -953,11 +952,9 @@ class BtifCoreWithVendorSupportTest : public BtifCoreWithControllerTest {
              disable_future.wait_for(std::chrono::seconds(1)));

    bluetooth::hci::testing::mock_hci_layer_ = nullptr;
    bluetooth::hci::testing::mock_vendor_specific_event_manager_ = nullptr;
    BtifCoreWithControllerTest::TearDown();
  }
  bluetooth::hci::testing::MockHciLayer hci_;
  bluetooth::hci::testing::MockVendorSpecificEventManager vendor_manager_;
  ContextualCallback<void(VendorSpecificEventView)> vse_callback_;
  PostableContext* context;
};
+0 −1
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ filegroup {
        "link_key.cc",
        "remote_name_request.cc",
        "uuid.cc",
        "vendor_specific_event_manager.cc",
    ],
}

+0 −1
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@ source_set("BluetoothHciSources") {
    "msft.cc",
    "remote_name_request.cc",
    "uuid.cc",
    "vendor_specific_event_manager.cc",
  ]

  include_dirs = [ "//bt/system/gd" ]
+6 −0
Original line number Diff line number Diff line
@@ -66,6 +66,12 @@ class HciInterface : public CommandInterface<CommandBuilder> {

  virtual void UnregisterLeEventHandler(SubeventCode subevent_code) = 0;

  virtual void RegisterVendorSpecificEventHandler(
      VseSubeventCode subevent_code,
      common::ContextualCallback<void(VendorSpecificEventView)> event_handler) = 0;

  virtual void UnregisterVendorSpecificEventHandler(VseSubeventCode subevent_code) = 0;

  virtual void RegisterForDisconnects(
      common::ContextualCallback<void(uint16_t, hci::ErrorCode)> on_disconnect) = 0;

Loading