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

Commit de0d9204 authored by Chen Chen's avatar Chen Chen Committed by Android (Google) Code Review
Browse files

Merge "BluetoothMetrics: Upload remote device supported features" into tm-qpr-dev

parents 1eb32cb6 98fae8dd
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -615,6 +615,8 @@ struct classic_impl : public security::ISecurityManagerListener {
    auto view = ReadRemoteSupportedFeaturesCompleteView::Create(packet);
    ASSERT_LOG(view.IsValid(), "Read remote supported features packet invalid");
    uint16_t handle = view.GetConnectionHandle();
    bluetooth::os::LogMetricBluetoothRemoteSupportedFeatures(
        connections.get_address(handle), 0, view.GetLmpFeatures(), handle);
    connections.execute(handle, [=](ConnectionManagementCallbacks* callbacks) {
      callbacks->OnReadRemoteSupportedFeaturesComplete(view.GetLmpFeatures());
    });
@@ -624,6 +626,8 @@ struct classic_impl : public security::ISecurityManagerListener {
    auto view = ReadRemoteExtendedFeaturesCompleteView::Create(packet);
    ASSERT_LOG(view.IsValid(), "Read remote extended features packet invalid");
    uint16_t handle = view.GetConnectionHandle();
    bluetooth::os::LogMetricBluetoothRemoteSupportedFeatures(
        connections.get_address(handle), view.GetPageNumber(), view.GetExtendedLmpFeatures(), handle);
    connections.execute(handle, [=](ConnectionManagementCallbacks* callbacks) {
      callbacks->OnReadRemoteExtendedFeaturesComplete(
          view.GetPageNumber(), view.GetMaximumPageNumber(), view.GetExtendedLmpFeatures());
+19 −0
Original line number Diff line number Diff line
@@ -463,6 +463,25 @@ void LogMetricBluetoothDisconnectionReasonReported(
  }
}

void LogMetricBluetoothRemoteSupportedFeatures(
    const Address& address, uint32_t page, uint64_t features, uint32_t connection_handle) {
  int metric_id = 0;
  if (!address.IsEmpty()) {
    metric_id = MetricIdManager::GetInstance().AllocateId(address);
  }
  int ret = stats_write(BLUETOOTH_REMOTE_SUPPORTED_FEATURES_REPORTED, metric_id, page, features, connection_handle);
  if (ret < 0) {
    LOG_WARN(
        "Failed for LogMetricBluetoothRemoteSupportedFeatures, "
        "metric_id %d, page %d, features %s, connection_handle %d, error %d",
        metric_id,
        page,
        std::to_string(features).c_str(),
        connection_handle,
        ret);
  }
}

void LogMetricBluetoothCodePathCounterMetrics(int32_t key, int64_t count) {
  int ret = stats_write(BLUETOOTH_CODE_PATH_COUNTER, key, count);
  if (ret < 0) {
+3 −0
Original line number Diff line number Diff line
@@ -113,6 +113,9 @@ void LogMetricBluetoothLocalVersions(
void LogMetricBluetoothDisconnectionReasonReported(
    uint32_t reason, const Address& address, uint32_t connection_handle) {}

void LogMetricBluetoothRemoteSupportedFeatures(
    const Address& address, uint32_t page, uint64_t features, uint32_t connection_handle) {}

void LogMetricBluetoothCodePathCounterMetrics(int32_t key, int64_t count) {}
}  // namespace os
}  // namespace bluetooth
+3 −0
Original line number Diff line number Diff line
@@ -113,6 +113,9 @@ void LogMetricBluetoothLocalVersions(
void LogMetricBluetoothDisconnectionReasonReported(
    uint32_t reason, const Address& address, uint32_t connection_handle) {}

void LogMetricBluetoothRemoteSupportedFeatures(
    const Address& address, uint32_t page, uint64_t features, uint32_t connection_handle) {}

void LogMetricBluetoothCodePathCounterMetrics(int32_t key, int64_t count) {}

}  // namespace os
+3 −0
Original line number Diff line number Diff line
@@ -275,6 +275,9 @@ void LogMetricBluetoothLocalVersions(
void LogMetricBluetoothDisconnectionReasonReported(
    uint32_t reason, const hci::Address& address, uint32_t connection_handle);

void LogMetricBluetoothRemoteSupportedFeatures(
    const hci::Address& address, uint32_t page, uint64_t features, uint32_t connection_handle);

void LogMetricBluetoothCodePathCounterMetrics(int32_t key, int64_t count);
}  // namespace os