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

Commit 4bf5775c authored by Zhengping Jiang's avatar Zhengping Jiang Committed by Automerger Merge Worker
Browse files

Merge "floss: skip resume flow if no suspend id is recorded" into main am:...

Merge "floss: skip resume flow if no suspend id is recorded" into main am: 72d4769c am: 606608b3

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



Change-Id: Ia1f1d6c7953e13f70f07ef09459a2f1b592a5370
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 27a1ab15 606608b3
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -318,5 +318,24 @@ void LogMetricsChipsetInfoReport() {
  }
}

void LogMetricsSuspendIdState(uint32_t state) {
  int64_t suspend_id_state = 0;
  int64_t boot_time;
  std::string boot_id;

  if (!GetBootId(&boot_id)) return;

  boot_time = bluetooth::common::time_get_os_boottime_us();

  suspend_id_state = (int64_t)ToSuspendIdState(state);
  LOG_DEBUG("SuspendIdState: %s, %d, %d", boot_id.c_str(), boot_time, suspend_id_state);

  ::metrics::structured::events::bluetooth::BluetoothSuspendIdStateChanged()
      .SetBootId(boot_id)
      .SetSystemTime(boot_time)
      .SetSuspendIdState(suspend_id_state)
      .Record();
}

}  // namespace metrics
}  // namespace bluetooth
+4 −0
Original line number Diff line number Diff line
@@ -234,6 +234,10 @@ AdapterState ToAdapterState(uint32_t state) {
  return state == 1 ? AdapterState::ON : AdapterState::OFF;
}

SuspendIdState ToSuspendIdState(uint32_t state) {
  return state == 1 ? SuspendIdState::Recorded : SuspendIdState::NoRecord;
}

ConnectionType ToPairingDeviceType(std::string addr, uint32_t device_type) {
  // A map stores the pending ConnectionType used to match a pairing event with unknown type.
  // map<address, type>
+7 −0
Original line number Diff line number Diff line
@@ -195,6 +195,10 @@ enum class MetricTransportType {
  TRANSPORT_TYPE_SDIO = 3,
};

// ENUM definition for suspend id state that in sync with ChromeOS structured metrics
// BluetoothSuspendIdStateChanged/SuspendIdState.
enum class SuspendIdState : int64_t { NoRecord = 0, Recorded = 1 };

// A struct holds the parsed profile connection event.
struct ProfileConnectionEvent {
  int64_t type;
@@ -205,6 +209,9 @@ struct ProfileConnectionEvent {
// Convert topshim::btif::BtState to AdapterState.
AdapterState ToAdapterState(uint32_t state);

// Convert to SuspendIdState.
SuspendIdState ToSuspendIdState(uint32_t state);

// Convert topshim::btif::BtDeviceType to ConnectionType
ConnectionType ToPairingDeviceType(std::string addr, uint32_t device_type);

+2 −0
Original line number Diff line number Diff line
@@ -51,5 +51,7 @@ void LogMetricsAclConnectionStateChanged(

void LogMetricsChipsetInfoReport() {}

void LogMetricsSuspendIdState(uint32_t state){};

}  // namespace metrics
}  // namespace bluetooth
+2 −0
Original line number Diff line number Diff line
@@ -40,5 +40,7 @@ void LogMetricsAclConnectionStateChanged(
    RawAddress* addr, uint32_t transport, uint32_t status, uint32_t acl_state, uint32_t direction, uint32_t hci_reason);
void LogMetricsChipsetInfoReport();

void LogMetricsSuspendIdState(uint32_t state);

}  // namespace metrics
}  // namespace bluetooth
Loading