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

Commit 1d7342c2 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Get rid of Connectability shim

Bug: 149757450
Change-Id: Idef691e97109e2634fc05fc7bddfeca72b967d11
parent a9e7ba44
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include "hci/facade/le_advertising_manager_facade.h"
#include "hci/facade/le_scanning_manager_facade.h"
#include "l2cap/classic/facade.h"
#include "neighbor/connectability.h"
#include "neighbor/discoverability.h"
#include "neighbor/facade/facade.h"
#include "neighbor/page.h"
@@ -37,7 +38,6 @@
#include "security/facade.h"
#include "security/security_module.h"
#include "shim/advertising.h"
#include "shim/connectability.h"
#include "shim/dumpsys.h"
#include "shim/hci_layer.h"
#include "shim/inquiry.h"
@@ -106,7 +106,7 @@ class RootFacadeService : public ::bluetooth::facade::RootFacade::Service {
        break;
      case BluetoothModule::SHIM:
        modules.add<::bluetooth::shim::Advertising>();
        modules.add<::bluetooth::shim::Connectability>();
        modules.add<::bluetooth::neighbor::ConnectabilityModule>();
        modules.add<::bluetooth::neighbor::DiscoverabilityModule>();
        modules.add<::bluetooth::shim::Dumpsys>();
        modules.add<::bluetooth::shim::HciLayer>();
+0 −1
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@ filegroup {
    name: "BluetoothShimSources",
    srcs: [
            "advertising.cc",
            "connectability.cc",
            "dumpsys.cc",
            "hci_layer.cc",
            "inquiry.cc",

system/gd/shim/connectability.cc

deleted100644 → 0
+0 −78
Original line number Diff line number Diff line
/*
 * Copyright 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#define LOG_TAG "bt_gd_shim"

#include <memory>
#include <string>

#include "common/bidi_queue.h"
#include "hci/address.h"
#include "hci/controller.h"
#include "hci/hci_packets.h"
#include "module.h"
#include "neighbor/connectability.h"
#include "os/handler.h"
#include "os/log.h"
#include "shim/connectability.h"

namespace bluetooth {
namespace shim {

namespace {
constexpr char kModuleName[] = "shim::Connectability";
}  // namespace

const ModuleFactory Connectability::Factory = ModuleFactory([]() { return new Connectability(); });

struct Connectability::impl {
  impl(neighbor::ConnectabilityModule* module) : module_(module) {}

  neighbor::ConnectabilityModule* module_{nullptr};
};

void Connectability::StartConnectability() {
  pimpl_->module_->StartConnectability();
}

void Connectability::StopConnectability() {
  pimpl_->module_->StopConnectability();
}

bool Connectability::IsConnectable() const {
  return pimpl_->module_->IsConnectable();
}

/**
 * Module methods
 */
void Connectability::ListDependencies(ModuleList* list) {
  list->add<neighbor::ConnectabilityModule>();
}

void Connectability::Start() {
  pimpl_ = std::make_unique<impl>(GetDependency<neighbor::ConnectabilityModule>());
}

void Connectability::Stop() {
  pimpl_.reset();
}

std::string Connectability::ToString() const {
  return kModuleName;
}

}  // namespace shim
}  // namespace bluetooth

system/gd/shim/connectability.h

deleted100644 → 0
+0 −50
Original line number Diff line number Diff line
/*
 * Copyright 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#pragma once

#include <memory>
#include <string>

#include "module.h"

namespace bluetooth {
namespace shim {

class Connectability : public bluetooth::Module {
 public:
  void StartConnectability();
  void StopConnectability();
  bool IsConnectable() const;

  Connectability() = default;
  ~Connectability() = default;

  static const ModuleFactory Factory;

 protected:
  void ListDependencies(ModuleList* list) override;  // Module
  void Start() override;                             // Module
  void Stop() override;                              // Module
  std::string ToString() const override;             // Module

 private:
  struct impl;
  std::unique_ptr<impl> pimpl_;
  DISALLOW_COPY_AND_ASSIGN(Connectability);
};

}  // namespace shim
}  // namespace bluetooth
+0 −2
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@
#include "os/thread.h"
#include "security/security_module.h"
#include "shim/advertising.h"
#include "shim/connectability.h"
#include "shim/dumpsys.h"
#include "shim/hci_layer.h"
#include "shim/inquiry.h"
@@ -77,7 +76,6 @@ struct bluetooth::shim::Stack::impl {
    modules.add<::bluetooth::security::SecurityModule>();
    modules.add<::bluetooth::storage::LegacyModule>();
    modules.add<::bluetooth::shim::Advertising>();
    modules.add<::bluetooth::shim::Connectability>();
    modules.add<::bluetooth::shim::Dumpsys>();
    modules.add<::bluetooth::shim::Inquiry>();
    modules.add<::bluetooth::shim::Name>();
Loading