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

Commit 18285cec authored by Chris Manton's avatar Chris Manton
Browse files

Add runtime sanity checks

Bug: 146086425
Test: Manually boots
Change-Id: I17e10a2c7fa9646b2a727da726ed3757d42439e3
parent 5c986c39
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -103,46 +103,57 @@ struct bluetooth::shim::Stack::impl {
  }

  IAdvertising* GetAdvertising() {
    ASSERT(is_running_);
    return stack_manager_.GetInstance<bluetooth::shim::Advertising>();
  }

  IController* GetController() {
    ASSERT(is_running_);
    return stack_manager_.GetInstance<bluetooth::shim::Controller>();
  }

  IConnectability* GetConnectability() {
    ASSERT(is_running_);
    return stack_manager_.GetInstance<bluetooth::shim::Connectability>();
  }

  IDiscoverability* GetDiscoverability() {
    ASSERT(is_running_);
    return stack_manager_.GetInstance<bluetooth::shim::Discoverability>();
  }

  IHciLayer* GetHciLayer() {
    ASSERT(is_running_);
    return stack_manager_.GetInstance<bluetooth::shim::HciLayer>();
  }

  IInquiry* GetInquiry() {
    ASSERT(is_running_);
    return stack_manager_.GetInstance<bluetooth::shim::Inquiry>();
  }

  IL2cap* GetL2cap() {
    ASSERT(is_running_);
    return stack_manager_.GetInstance<bluetooth::shim::L2cap>();
  }

  IName* GetName() {
    ASSERT(is_running_);
    return stack_manager_.GetInstance<bluetooth::shim::Name>();
  }

  IPage* GetPage() {
    ASSERT(is_running_);
    return stack_manager_.GetInstance<bluetooth::shim::Page>();
  }

  IScanning* GetScanning() {
    ASSERT(is_running_);
    return stack_manager_.GetInstance<bluetooth::shim::Scanning>();
  }

  ISecurity* GetSecurity() {
    ASSERT(is_running_);
    return stack_manager_.GetInstance<bluetooth::shim::Security>();
  }

+2 −0
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@ uint16_t bluetooth::shim::L2CA_Register(uint16_t client_psm,
                                        tL2CAP_APPL_INFO* callbacks,
                                        bool enable_snoop,
                                        tL2CAP_ERTM_INFO* p_ertm_info) {
  CHECK(callbacks != nullptr);

  if (L2C_INVALID_PSM(client_psm)) {
    LOG_ERROR(LOG_TAG, "%s Invalid classic psm:%hd", __func__, client_psm);
    return 0;