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

Commit 9badcd9e authored by Andrew Cheng's avatar Andrew Cheng Committed by Gerrit Code Review
Browse files

Merge "Surface ACL disconnect reasons from native to Java"

parents e667de87 261f360f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -23,5 +23,5 @@ import android.bluetooth.BluetoothDevice;
 */
oneway interface IBluetoothConnectionCallback {
    void onDeviceConnected(in BluetoothDevice device);
    void onDeviceDisconnected(in BluetoothDevice device);
    void onDeviceDisconnected(in BluetoothDevice device, in int hciReason);
}
+1 −1
Original line number Diff line number Diff line
@@ -210,7 +210,7 @@ void invoke_ssp_request_cb(RawAddress bd_addr, bt_bdname_t bd_name,
void invoke_bond_state_changed_cb(bt_status_t status, RawAddress bd_addr,
                                  bt_bond_state_t state);
void invoke_acl_state_changed_cb(bt_status_t status, RawAddress bd_addr,
                                 bt_acl_state_t state);
                                 bt_acl_state_t state, bt_hci_error_code_t hci_reason);
void invoke_thread_evt_cb(bt_cb_thread_evt event);
void invoke_le_test_mode_cb(bt_status_t status, uint16_t count);
void invoke_energy_info_cb(bt_activity_energy_info energy_info,
+5 −4
Original line number Diff line number Diff line
@@ -725,15 +725,16 @@ void invoke_bond_state_changed_cb(bt_status_t status, RawAddress bd_addr,
}

void invoke_acl_state_changed_cb(bt_status_t status, RawAddress bd_addr,
                                 bt_acl_state_t state) {
                                 bt_acl_state_t state, bt_hci_error_code_t hci_reason) {
  do_in_jni_thread(
      FROM_HERE,
      base::BindOnce(
          [](bt_status_t status, RawAddress bd_addr, bt_acl_state_t state) {
          [](bt_status_t status, RawAddress bd_addr, bt_acl_state_t state,
             bt_hci_error_code_t hci_reason) {
            HAL_CBACK(bt_hal_cbacks, acl_state_changed_cb, status, &bd_addr,
                      state);
                      state, hci_reason);
          },
          status, bd_addr, state));
          status, bd_addr, state, hci_reason));
}

void invoke_thread_evt_cb(bt_cb_thread_evt event) {
+3 −2
Original line number Diff line number Diff line
@@ -1532,7 +1532,7 @@ static void btif_dm_upstreams_evt(uint16_t event, char* p_param) {
      btif_update_remote_version_property(&bd_addr);

      invoke_acl_state_changed_cb(BT_STATUS_SUCCESS, bd_addr,
                                  BT_ACL_STATE_CONNECTED);
                                  BT_ACL_STATE_CONNECTED, HCI_SUCCESS);
      break;

    case BTA_DM_LINK_DOWN_EVT:
@@ -1543,7 +1543,8 @@ static void btif_dm_upstreams_evt(uint16_t event, char* p_param) {
      BTIF_TRACE_DEBUG(
          "BTA_DM_LINK_DOWN_EVT. Sending BT_ACL_STATE_DISCONNECTED");
      invoke_acl_state_changed_cb(BT_STATUS_SUCCESS, bd_addr,
                                  BT_ACL_STATE_DISCONNECTED);
                                  BT_ACL_STATE_DISCONNECTED,
                                  static_cast<bt_hci_error_code_t>(btm_get_acl_disc_reason_code()));
      break;

    case BTA_DM_BLE_KEY_EVT:
+6 −1
Original line number Diff line number Diff line
@@ -135,6 +135,10 @@ inline std::string bt_status_text(const bt_status_t& status) {
  }
}

/** Bluetooth HCI Error Codes */
/** Corresponding to [Vol 2] Part D, "Error Codes" of Core_v5.1 specs */
typedef uint8_t bt_hci_error_code_t;

/** Bluetooth PinKey Code */
typedef struct { uint8_t pin[16]; } __attribute__((packed)) bt_pin_code_t;

@@ -423,7 +427,8 @@ typedef void (*bond_state_changed_callback)(bt_status_t status,
/** Bluetooth ACL connection state changed callback */
typedef void (*acl_state_changed_callback)(bt_status_t status,
                                           RawAddress* remote_bd_addr,
                                           bt_acl_state_t state);
                                           bt_acl_state_t state,
                                           bt_hci_error_code_t hci_reason);

/** Bluetooth link quality report callback */
typedef void (*link_quality_report_callback)(
Loading