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

Commit 09b66475 authored by Jakub Rotkiewicz's avatar Jakub Rotkiewicz
Browse files

Bluetooth Quality Report feature flag

Bug: 259448922
Tag: #feature
Test: atest bluetooth_test_gd
Test: atest InitFlagsTest
BYPASS_LONG_LINES_REASON: Bluetooth likes 120 lines

Change-Id: Ie4dcf7ade01de98cdf8325cb8e7b0d8d9b3d80cc
parent 12bfe92f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@

#include "base/logging.h"
#include "com_android_bluetooth.h"
#include "gd/common/init_flags.h"
#include "hardware/bt_bqr.h"

using bluetooth::bqr::BluetoothQualityReportCallbacks;
@@ -91,6 +92,11 @@ static void initNative(JNIEnv* env, jobject object) {
  std::unique_lock<std::shared_timed_mutex> interface_lock(interface_mutex);
  std::unique_lock<std::shared_timed_mutex> callbacks_lock(callbacks_mutex);

  if (!bluetooth::common::InitFlags::
          IsBluetoothQualityReportCallbackEnabled()) {
    return;
  }

  const bt_interface_t* btInf = getBluetoothInterface();
  if (btInf == nullptr) {
    LOG(ERROR) << "Bluetooth module is not loaded";
+6 −2
Original line number Diff line number Diff line
@@ -874,8 +874,12 @@ static const void* get_profile_interface(const char* profile_id) {
  if (is_profile(profile_id, BT_PROFILE_CSIS_CLIENT_ID))
    return btif_csis_client_get_interface();

  bool isBqrEnabled =
      bluetooth::common::InitFlags::IsBluetoothQualityReportCallbackEnabled();
  if (isBqrEnabled) {
    if (is_profile(profile_id, BT_BQR_ID))
      return bluetooth::bqr::getBluetoothQualityReportInterface();
  }

  return NULL;
}
+20 −15
Original line number Diff line number Diff line
@@ -419,7 +419,9 @@ void ConfigureBqrCmpl(uint32_t current_evt_mask) {
  tBTM_STATUS btm_status = BTM_BT_Quality_Report_VSE_Register(
      current_evt_mask > kQualityEventMaskAllOff, CategorizeBqrEvent);

  if (current_evt_mask > kQualityEventMaskAllOff) {
  bool isBqrEnabled =
      bluetooth::common::InitFlags::IsBluetoothQualityReportCallbackEnabled();
  if (isBqrEnabled && current_evt_mask > kQualityEventMaskAllOff) {
    ConfigBqrA2dpScoThreshold();
  }

@@ -530,7 +532,9 @@ void AddLinkQualityEventToQueue(uint8_t length,
#else
  // TODO(abps) Metrics for non-Android build
#endif

  bool isBqrEnabled =
      bluetooth::common::InitFlags::IsBluetoothQualityReportCallbackEnabled();
  if (isBqrEnabled) {
    BluetoothQualityReportInterface* bqrItf =
        getBluetoothQualityReportInterface();

@@ -547,6 +551,7 @@ void AddLinkQualityEventToQueue(uint8_t length,
    } else {
      LOG(WARNING) << __func__ << ": failed to deliver BQR, bqrItf is NULL";
    }
  }

  kpBqrEventQueue->Enqueue(p_bqr_event.release());
}
+1 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ table InitFlagsData {
    rust_event_loop_is_enabled:bool (privacy:"Any");
    sdp_serialization_is_enabled:bool (privacy:"Any");
    sdp_skip_rnr_if_known_is_enabled:bool (privacy:"Any");
    bluetooth_quality_report_callback_is_enabled:bool (privacy:"Any");
    set_min_encryption_is_enabled:bool (privacy:"Any");
    subrating_is_enabled:bool (privacy:"Any");
    trigger_advertising_callbacks_on_first_resume_after_pause_is_enabled:bool (privacy:"Any");
+4 −0
Original line number Diff line number Diff line
@@ -60,6 +60,10 @@ class InitFlags final {
    return init_flags::gd_hal_snoop_logger_filtering_is_enabled();
  }

  inline static bool IsBluetoothQualityReportCallbackEnabled() {
    return init_flags::bluetooth_quality_report_callback_is_enabled();
  }

  inline static bool IsTargetedAnnouncementReconnectionMode() {
    return init_flags::leaudio_targeted_announcement_reconnection_mode_is_enabled();
  }
Loading