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

Commit fe9a28c6 authored by Steven Liu's avatar Steven Liu
Browse files

Initialize ras only if the controller support channel soudning.

Flag: com.android.bluetooth.flags.channel_sounding_in_stack
Bug: 324185011
Bug: 372010287
Test: m com.android.btservices
Change-Id: Ib3e60495737c0c33073c106b2afc02b73a36d245
parent 2735e4a7
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@
#include "bta/include/bta_gatt_api.h"
#include "bta/include/bta_ras_api.h"
#include "bta/ras/ras_types.h"
#include "gd/hci/controller_interface.h"
#include "main/shim/entry.h"
#include "os/logging/log_adapter.h"
#include "stack/include/bt_types.h"
#include "stack/include/btm_ble_addr.h"
@@ -100,6 +102,11 @@ public:
  };

  void Initialize() override {
    auto controller = bluetooth::shim::GetController();
    if (controller && !controller->SupportsBleChannelSounding()) {
      log::info("controller does not support channel sounding.");
      return;
    }
    BTA_GATTC_AppRegister(
            [](tBTA_GATTC_EVT event, tBTA_GATTC* p_data) {
              if (instance && p_data) {
+8 −2
Original line number Diff line number Diff line
@@ -23,8 +23,10 @@
#include "bta/include/bta_gatt_api.h"
#include "bta/include/bta_ras_api.h"
#include "bta/ras/ras_types.h"
#include "gd/hci/controller_interface.h"
#include "gd/hci/uuid.h"
#include "gd/os/rand.h"
#include "main/shim/entry.h"
#include "os/logging/log_adapter.h"
#include "stack/include/bt_types.h"
#include "stack/include/btm_ble_addr.h"
@@ -74,11 +76,15 @@ public:
    uint16_t last_overwritten_procedure_ = 0;
  };

  void Initialize() {
  void Initialize() override {
    auto controller = bluetooth::shim::GetController();
    if (controller && !controller->SupportsBleChannelSounding()) {
      log::info("controller does not support channel sounding.");
      return;
    }
    Uuid uuid = Uuid::From128BitBE(bluetooth::os::GenerateRandom<Uuid::kNumBytes128>());
    app_uuid_ = uuid;
    log::info("Register server with uuid:{}", app_uuid_.ToString());

    BTA_GATTS_AppRegister(
            app_uuid_,
            [](tBTA_GATTS_EVT event, tBTA_GATTS* p_data) {