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

Commit c3970f39 authored by Liana Kazanova's avatar Liana Kazanova
Browse files

Revert "Don't disable BtQualityReports twice"

Revert submission 3237049

Reason for revert: DroidMonitor: Potential culprit for http://b/362263539 - verifying through ABTD before submission. 

Reverted changes: /q/submissionid:3237049

Change-Id: Ife0f77b6d8e4f3257fe3dfe61340a232eabc56ad
parent e32edb8e
Loading
Loading
Loading
Loading
+17 −9
Original line number Diff line number Diff line
@@ -311,16 +311,16 @@ static std::string PacketTypeToString(uint8_t packet_type) {
  }
}

void register_vse();
void unregister_vse();

static void ConfigureBqr(const BqrConfiguration& bqr_config);
static void vendor_specific_event_callback(hci::VendorSpecificEventView vendor_specific_event_view);

void EnableBtQualityReport(common::PostableContext* to_bind) {
  log::info("is_enable: {}", to_bind != nullptr);
  if (to_bind_ == to_bind) {
    log::warn("Skipping second call (Lifecycle issue).");
    return;
  }
  if (to_bind != nullptr) {
    to_bind_ = to_bind;
  }

  char bqr_prop_evtmask[PROPERTY_VALUE_MAX] = {0};
  char bqr_prop_interval_ms[PROPERTY_VALUE_MAX] = {0};
@@ -350,8 +350,7 @@ void EnableBtQualityReport(common::PostableContext* to_bind) {
    bqr_config.vnd_quality_mask = static_cast<uint32_t>(atoi(bqr_prop_vnd_quality_mask));
    bqr_config.vnd_trace_mask = static_cast<uint32_t>(atoi(bqr_prop_vnd_trace_mask));
    bqr_config.report_interval_multiple = static_cast<uint32_t>(atoi(bqr_prop_interval_multiple));
    bluetooth::shim::GetHciLayer()->RegisterVendorSpecificEventHandler(
            hci::VseSubeventCode::BQR_EVENT, to_bind_->Bind(vendor_specific_event_callback));
    register_vse();
    kpBqrEventQueue.Clear();
  } else {
    bqr_config.report_action = REPORT_ACTION_CLEAR;
@@ -360,8 +359,7 @@ void EnableBtQualityReport(common::PostableContext* to_bind) {
    bqr_config.vnd_quality_mask = 0;
    bqr_config.vnd_trace_mask = 0;
    bqr_config.report_interval_multiple = 0;
    bluetooth::shim::GetHciLayer()->UnregisterVendorSpecificEventHandler(
            hci::VseSubeventCode::BQR_EVENT);
    unregister_vse();
  }

  tBTM_BLE_VSC_CB cmn_vsc_cb;
@@ -908,6 +906,16 @@ static void vendor_specific_event_callback(
  CategorizeBqrEvent(bytes.size(), bytes.data());
}

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

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

namespace testing {
void set_lmp_trace_log_fd(int fd) { LmpLlMessageTraceLogFd = fd; }
}  // namespace testing