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

Commit 86c11fd1 authored by floss-automerger's avatar floss-automerger Committed by Sarvesh Kalwit
Browse files

libbluetooth: Add BT_STATUS_UNEXPECTED_STATE metric

Add granularity to BT_STATUS_FAIL error codes by introducing a new
BT_STATUS_UNEXPECTED_STATE metric, to be used when an effort to find a
device by address or other identifier fails.

Bug: 340296381
Test: m -j
Flag: Exempt, metrics-only change

Change-Id: I0b358f08821cb1904f828b1aa04b1855b41ec8df
parent b7d0abce
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -135,6 +135,7 @@ class BtStatus(enum.IntEnum):
    WAKE_LOCK_ERROR = 14
    BT_STATUS_TIMEOUT = 15
    DEVICE_NOT_FOUND = 16
    UNEXPECTED_STATE = 17


class SocketType(enum.IntEnum):
+1 −1
Original line number Diff line number Diff line
@@ -946,7 +946,7 @@ int dut_mode_configure(uint8_t enable) {

int dut_mode_send(uint16_t opcode, uint8_t* buf, uint8_t len) {
  if (!interface_ready()) return BT_STATUS_NOT_READY;
  if (!btif_is_dut_mode()) return BT_STATUS_FAIL;
  if (!btif_is_dut_mode()) return BT_STATUS_UNEXPECTED_STATE;

  uint8_t* copy = (uint8_t*)osi_calloc(len);
  memcpy(copy, buf, len);
+1 −1
Original line number Diff line number Diff line
@@ -122,7 +122,7 @@ static tHID_KB_LIST hid_kb_numlock_on_list[] = {{LOGITECH_KB_MX5500_PRODUCT_ID,
  do {                                                                      \
    if (btif_hh_cb.status == BTIF_HH_DISABLED) {                            \
      log::error("HH status = {}", btif_hh_status_text(btif_hh_cb.status)); \
      return BT_STATUS_FAIL;                                                \
      return BT_STATUS_UNEXPECTED_STATE;                                    \
    }                                                                       \
  } while (0)

+1 −1
Original line number Diff line number Diff line
@@ -191,7 +191,7 @@ bt_status_t btif_queue_connect_next(void) {

  if (connect_queue.empty()) return BT_STATUS_FAIL;
  if (!stack_manager_get_interface()->get_stack_is_running())
    return BT_STATUS_FAIL;
    return BT_STATUS_UNEXPECTED_STATE;

  ConnectNode& head = connect_queue.front();

+4 −1
Original line number Diff line number Diff line
@@ -108,7 +108,8 @@ typedef enum {
  BT_STATUS_JNI_THREAD_ATTACH_ERROR,
  BT_STATUS_WAKELOCK_ERROR,
  BT_STATUS_TIMEOUT,
  BT_STATUS_DEVICE_NOT_FOUND
  BT_STATUS_DEVICE_NOT_FOUND,
  BT_STATUS_UNEXPECTED_STATE
} bt_status_t;

inline std::string bt_status_text(const bt_status_t& status) {
@@ -147,6 +148,8 @@ inline std::string bt_status_text(const bt_status_t& status) {
      return std::string("timeout_error");
    case BT_STATUS_DEVICE_NOT_FOUND:
      return std::string("device_not_found");
    case BT_STATUS_UNEXPECTED_STATE:
      return std::string("unexpected_state");
    default:
      return std::string("UNKNOWN");
  }