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

Commit fc56c743 authored by Rahul Arya's avatar Rahul Arya
Browse files

Pass PHY change event up to GATT

Allow GATT to use 2M phy.

Test: manual QA testing
Bug: 245969911
Change-Id: I1e3458423dde7f5b7240f573955fec7b5b83e9d2
(cherry picked from commit 6221f7f4)
Merged-In: I1e3458423dde7f5b7240f573955fec7b5b83e9d2
parent c75ca11a
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -5082,6 +5082,7 @@ public class AdapterService extends Service {
    private static final String GATT_ROBUST_CACHING_CLIENT_FLAG = "INIT_gatt_robust_caching_client";
    private static final String GATT_ROBUST_CACHING_CLIENT_FLAG = "INIT_gatt_robust_caching_client";
    private static final String GATT_ROBUST_CACHING_SERVER_FLAG = "INIT_gatt_robust_caching_server";
    private static final String GATT_ROBUST_CACHING_SERVER_FLAG = "INIT_gatt_robust_caching_server";
    private static final String IRK_ROTATION_FLAG = "INIT_irk_rotation";
    private static final String IRK_ROTATION_FLAG = "INIT_irk_rotation";
    private static final String PASS_PHY_UPDATE_CALLBACK_FLAG = "INIT_pass_phy_update_callback";


    /**
    /**
     * Logging flags logic (only applies to DEBUG and VERBOSE levels):
     * Logging flags logic (only applies to DEBUG and VERBOSE levels):
@@ -5145,6 +5146,10 @@ public class AdapterService extends Service {
        if (DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_BLUETOOTH, IRK_ROTATION_FLAG, false)) {
        if (DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_BLUETOOTH, IRK_ROTATION_FLAG, false)) {
            initFlags.add(String.format("%s=%s", IRK_ROTATION_FLAG, "true"));
            initFlags.add(String.format("%s=%s", IRK_ROTATION_FLAG, "true"));
        }
        }
        if (DeviceConfig.getBoolean(
                DeviceConfig.NAMESPACE_BLUETOOTH, PASS_PHY_UPDATE_CALLBACK_FLAG, true)) {
            initFlags.add(String.format("%s=%s", PASS_PHY_UPDATE_CALLBACK_FLAG, "true"));
        }
        if (DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_BLUETOOTH,
        if (DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_BLUETOOTH,
                LOGGING_DEBUG_ENABLED_FOR_ALL_FLAG, false)) {
                LOGGING_DEBUG_ENABLED_FOR_ALL_FLAG, false)) {
            initFlags.add(String.format("%s=%s", LOGGING_DEBUG_ENABLED_FOR_ALL_FLAG, "true"));
            initFlags.add(String.format("%s=%s", LOGGING_DEBUG_ENABLED_FOR_ALL_FLAG, "true"));
+2 −1
Original line number Original line Diff line number Diff line
@@ -82,7 +82,8 @@ init_flags!(
        btaa_hci,
        btaa_hci,
        gd_rust,
        gd_rust,
        gd_link_policy,
        gd_link_policy,
        irk_rotation
        irk_rotation,
        pass_phy_update_callback
    },
    },
    dependencies: {
    dependencies: {
        gd_core => gd_security
        gd_core => gd_security
+1 −0
Original line number Original line Diff line number Diff line
@@ -13,6 +13,7 @@ mod ffi {
        fn gd_rust_is_enabled() -> bool;
        fn gd_rust_is_enabled() -> bool;
        fn gd_link_policy_is_enabled() -> bool;
        fn gd_link_policy_is_enabled() -> bool;
        fn irk_rotation_is_enabled() -> bool;
        fn irk_rotation_is_enabled() -> bool;
        fn pass_phy_update_callback_is_enabled() -> bool;
    }
    }
}
}


+13 −3
Original line number Original line Diff line number Diff line
@@ -33,6 +33,7 @@
#include "device/include/controller.h"
#include "device/include/controller.h"
#include "gd/common/bidi_queue.h"
#include "gd/common/bidi_queue.h"
#include "gd/common/bind.h"
#include "gd/common/bind.h"
#include "gd/common/init_flags.h"
#include "gd/common/strings.h"
#include "gd/common/strings.h"
#include "gd/common/sync_map_count.h"
#include "gd/common/sync_map_count.h"
#include "gd/hci/acl_manager.h"
#include "gd/hci/acl_manager.h"
@@ -61,6 +62,7 @@
#include "stack/include/bt_hdr.h"
#include "stack/include/bt_hdr.h"
#include "stack/include/btm_api.h"
#include "stack/include/btm_api.h"
#include "stack/include/btm_status.h"
#include "stack/include/btm_status.h"
#include "stack/include/gatt_api.h"
#include "stack/include/pan_api.h"
#include "stack/include/pan_api.h"
#include "stack/include/sec_hci_link_interface.h"
#include "stack/include/sec_hci_link_interface.h"
#include "stack/l2cap/l2c_int.h"
#include "stack/l2cap/l2c_int.h"
@@ -753,9 +755,17 @@ class LeShimAclConnection


  void OnPhyUpdate(hci::ErrorCode hci_status, uint8_t tx_phy,
  void OnPhyUpdate(hci::ErrorCode hci_status, uint8_t tx_phy,
                   uint8_t rx_phy) override {
                   uint8_t rx_phy) override {
    TRY_POSTING_ON_MAIN(interface_.on_phy_update,
    if (common::init_flags::pass_phy_update_callback_is_enabled()) {
                        ToLegacyHciErrorCode(hci_status), handle_, tx_phy,
      TRY_POSTING_ON_MAIN(
                        rx_phy);
          interface_.on_phy_update,
          static_cast<tGATT_STATUS>(ToLegacyHciErrorCode(hci_status)), handle_,
          tx_phy, rx_phy);
    } else {
      LOG_WARN(
          "Not posting OnPhyUpdate callback since it is disabled: (tx:%x, "
          "rx:%x, status:%s)",
          tx_phy, rx_phy, hci::ErrorCodeText(hci_status).c_str());
    }
  }
  }


  void OnLocalAddressUpdate(hci::AddressWithType address_with_type) override {
  void OnLocalAddressUpdate(hci::AddressWithType address_with_type) override {
+5 −0
Original line number Original line Diff line number Diff line
@@ -15,12 +15,16 @@
 */
 */


#include "main/shim/acl_legacy_interface.h"
#include "main/shim/acl_legacy_interface.h"

#include "stack/include/acl_hci_link_interface.h"
#include "stack/include/acl_hci_link_interface.h"
#include "stack/include/ble_acl_interface.h"
#include "stack/include/ble_acl_interface.h"
#include "stack/include/gatt_api.h"
#include "stack/include/sco_hci_link_interface.h"
#include "stack/include/sco_hci_link_interface.h"
#include "stack/include/sec_hci_link_interface.h"
#include "stack/include/sec_hci_link_interface.h"


struct tBTM_ESCO_DATA;
struct tBTM_ESCO_DATA;
void gatt_notify_phy_updated(tGATT_STATUS status, uint16_t handle,
                             uint8_t tx_phy, uint8_t rx_phy);


namespace bluetooth {
namespace bluetooth {
namespace shim {
namespace shim {
@@ -78,6 +82,7 @@ const acl_interface_t GetAclInterface() {
      .link.le.on_data_length_change = acl_ble_data_length_change_event,
      .link.le.on_data_length_change = acl_ble_data_length_change_event,
      .link.le.on_read_remote_version_information_complete =
      .link.le.on_read_remote_version_information_complete =
          btm_read_remote_version_complete,
          btm_read_remote_version_complete,
      .link.le.on_phy_update = gatt_notify_phy_updated,
  };
  };
  return acl_interface;
  return acl_interface;
}
}
Loading