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

Commit 274cda3d authored by Antoine SOULIER's avatar Antoine SOULIER
Browse files

gd/hal: Restore BtStopWatch that looks used

Bug: 346908175
Test: m .
Flag: EXEMPT, No functionnal change
Change-Id: I311441373ccc92cb84d4e0bf1ad81ab5e7158f6c
parent f3b64def
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -63,8 +63,6 @@ class AidlHciCallbacks : public ::aidl::android::hardware::bluetooth::BnBluetoot
class AidlHci : public HciBackend {
 public:
  AidlHci(const char* service_name) {
    common::StopWatch stop_watch(__func__);

    ::ndk::SpAIBinder binder(AServiceManager_waitForService(service_name));
    hci_ = aidl::android::hardware::bluetooth::IBluetoothHci::fromBinder(binder);
    log::assert_that(hci_ != nullptr, "Failed to retrieve AIDL interface.");
+0 −1
Original line number Diff line number Diff line
@@ -90,7 +90,6 @@ class HidlHci : public HciBackend {

 public:
  HidlHci(Handler* module_handler) {
    common::StopWatch stop_watch(__func__);
    log::info("Trying to find a HIDL interface");

    auto get_service_alarm = new os::Alarm(module_handler);
+17 −0
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@
#include <future>
#include <mutex>

#include "common/stop_watch.h"
#include "common/strings.h"
#include "hal/hci_backend.h"
#include "hal/hci_hal.h"
#include "hal/link_clocker.h"
@@ -26,6 +28,15 @@

namespace bluetooth::hal {

template <class VecType>
std::string GetTimerText(const char* func_name, VecType vec) {
  return common::StringFormat(
      "%s: len %zu, 1st 5 bytes '%s'",
      func_name,
      vec.size(),
      common::ToHexString(vec.begin(), std::min(vec.end(), vec.begin() + 5)).c_str());
}

class HciCallbacksImpl : public HciBackendCallbacks {
  class : public HciHalCallbacks {
   public:
@@ -63,10 +74,12 @@ class HciCallbacksImpl : public HciBackendCallbacks {
  }

  void initializationComplete() override {
    common::StopWatch stop_watch(__func__);
    init_promise_.set_value();
  }

  void hciEventReceived(const std::vector<uint8_t>& packet) override {
    common::StopWatch stop_watch(GetTimerText(__func__, packet));
    link_clocker_->OnHciEvent(packet);
    btsnoop_logger_->Capture(
        packet, SnoopLogger::Direction::INCOMING, SnoopLogger::PacketType::EVT);
@@ -77,6 +90,7 @@ class HciCallbacksImpl : public HciBackendCallbacks {
  }

  void aclDataReceived(const std::vector<uint8_t>& packet) override {
    common::StopWatch stop_watch(GetTimerText(__func__, packet));
    btsnoop_logger_->Capture(
        packet, SnoopLogger::Direction::INCOMING, SnoopLogger::PacketType::ACL);
    {
@@ -86,6 +100,7 @@ class HciCallbacksImpl : public HciBackendCallbacks {
  }

  void scoDataReceived(const std::vector<uint8_t>& packet) override {
    common::StopWatch stop_watch(GetTimerText(__func__, packet));
    btsnoop_logger_->Capture(
        packet, SnoopLogger::Direction::INCOMING, SnoopLogger::PacketType::SCO);
    {
@@ -95,6 +110,7 @@ class HciCallbacksImpl : public HciBackendCallbacks {
  }

  void isoDataReceived(const std::vector<uint8_t>& packet) override {
    common::StopWatch stop_watch(GetTimerText(__func__, packet));
    btsnoop_logger_->Capture(
        packet, SnoopLogger::Direction::INCOMING, SnoopLogger::PacketType::ISO);
    {
@@ -152,6 +168,7 @@ class HciHalImpl : public HciHal {
  }

  void Start() override {
    common::StopWatch stop_watch(__func__);
    log::assert_that(
        backend_ == nullptr, "Start can't be called more than once before Stop is called.");