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

Commit 7a94a00a authored by David Duarte's avatar David Duarte Committed by Automerger Merge Worker
Browse files

Merge "[BluetoothMetrics] Adding dependent changes for direct LE-ACL L2CAP...

Merge "[BluetoothMetrics] Adding dependent changes for direct LE-ACL L2CAP fixed channel" am: 3ca03f89 am: 727a1034

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2507095



Change-Id: I7c6f2ed614238ba3aaf3152dc80369bbe5563e2e
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents b4f88576 727a1034
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -75,6 +75,17 @@ void LEConnectionMetricState::AddStateChangedEvent(
  end_timepoint = current_timestamp;

  switch (state) {
    case LeConnectionState::STATE_LE_ACL_START: {
      int connection_type_cid = GetArgumentTypeFromList(argument_list, os::ArgumentType::L2CAP_CID);
      if (connection_type_cid != -1) {
        LeConnectionType connection_type = GetLeConnectionTypeFromCID(connection_type_cid);
        if (connection_type != LeConnectionType::CONNECTION_TYPE_UNSPECIFIED) {
          LOG_INFO("LEConnectionMetricsRemoteDevice: Populating the connection type\n");
          input_connection_type = connection_type;
        }
      }
      break;
    }
    case LeConnectionState::STATE_LE_ACL_END: {
      int acl_status_code_from_args =
          GetArgumentTypeFromList(argument_list, os::ArgumentType::ACL_STATUS_CODE);
+23 −0
Original line number Diff line number Diff line
@@ -45,6 +45,29 @@ int GetArgumentTypeFromList(
  return -1;
}

os::LeConnectionType GetLeConnectionTypeFromCID(int fixed_cid) {
  switch(fixed_cid) {
    case 3: {
      return os::LeConnectionType::CONNECTION_TYPE_L2CAP_FIXED_CHNL_AMP;
    }
    case 4: {
      return os::LeConnectionType::CONNECTION_TYPE_L2CAP_FIXED_CHNL_ATT;
    }
    case 5: {
      return os::LeConnectionType::CONNECTION_TYPE_L2CAP_FIXED_CHNL_LE_SIGNALLING;
    }
    case 6: {
      return os::LeConnectionType::CONNECTION_TYPE_L2CAP_FIXED_CHNL_SMP;
    }
    case 7: {
      return os::LeConnectionType::CONNECTION_TYPE_L2CAP_FIXED_CHNL_SMP_BR_EDR;
    }
    default: {
      return os::LeConnectionType::CONNECTION_TYPE_UNSPECIFIED;
    }
  }
}



}  // namespace metrics
+1 −1
Original line number Diff line number Diff line
@@ -27,6 +27,6 @@ namespace metrics {
bool GetBootId(std::string* boot_id);
int GetArgumentTypeFromList(
    std::vector<std::pair<os::ArgumentType, int>>& argument_list, os::ArgumentType argumentType);

    os::LeConnectionType GetLeConnectionTypeFromCID(int fixed_cid);
}  // namespace metrics
}  // namespace bluetooth
+12 −0
Original line number Diff line number Diff line
@@ -36,8 +36,10 @@
#include "gd/common/init_flags.h"
#include "gd/hal/snoop_logger.h"
#include "gd/os/system_properties.h"
#include "gd/os/metrics.h"
#include "hci/include/btsnoop.h"
#include "main/shim/shim.h"
#include "main/shim/metrics_api.h"
#include "osi/include/allocator.h"
#include "osi/include/log.h"
#include "stack/btm/btm_sec.h"
@@ -1354,6 +1356,16 @@ bool L2CA_ConnectFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda) {
  }

  if (transport == BT_TRANSPORT_LE) {
    auto argument_list = std::vector<std::pair<bluetooth::os::ArgumentType, int>>();
    argument_list.push_back(std::make_pair(bluetooth::os::ArgumentType::L2CAP_CID, fixed_cid));

    bluetooth::shim::LogMetricBluetoothLEConnectionMetricEvent(
        rem_bda,
        android::bluetooth::le::LeConnectionOriginType::ORIGIN_NATIVE,
        android::bluetooth::le::LeConnectionType::CONNECTION_TYPE_LE_ACL,
        android::bluetooth::le::LeConnectionState::STATE_LE_ACL_START,
        argument_list);

    bool ret = l2cu_create_conn_le(p_lcb);
    if (!ret) {
      LOG_WARN("Unable to create fixed channel le connection fixed_cid:0x%04x",