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

Commit 02114d98 authored by IHLHO KIM's avatar IHLHO KIM Committed by android-build-merger
Browse files

Fix the GATT server and HOGP disconnect

am: 63ec7bf6

Change-Id: I13a676f6d9beac6f5cf07960c8b9cfe4fc2a7a68
parents 1c7e85a9 63ec7bf6
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -339,12 +339,14 @@ static bt_status_t btif_gatts_open(int server_if, const bt_bdaddr_t* bd_addr,
}

static void btif_gatts_close_impl(int server_if, BD_ADDR address, int conn_id) {
  // Cancel pending foreground/background connections
  // Close active connection
  if (conn_id != 0)
    BTA_GATTS_Close(conn_id);
  else
    BTA_GATTS_CancelOpen(server_if, address, true);
  BTA_GATTS_CancelOpen(server_if, address, false);

  // Close active connection
  if (conn_id != 0) BTA_GATTS_Close(conn_id);
  // Cancel pending background connections
  BTA_GATTS_CancelOpen(server_if, address, false);
}

static bt_status_t btif_gatts_close(int server_if, const bt_bdaddr_t* bd_addr,
+9 −1
Original line number Diff line number Diff line
@@ -253,11 +253,19 @@ bool gatt_disconnect(tGATT_TCB* p_tcb) {
 *
 * Description      Update the application use link status
 *
 * Returns          true if any modifications are made, false otherwise.
 * Returns          true if any modifications are made or
 *                  when it already exists, false otherwise.
 *
 ******************************************************************************/
bool gatt_update_app_hold_link_status(tGATT_IF gatt_if, tGATT_TCB* p_tcb,
                                      bool is_add) {
  for (int i = 0; i < GATT_MAX_APPS; i++) {
    if (p_tcb->app_hold_link[i] == gatt_if && is_add) {
      GATT_TRACE_DEBUG("%s: gatt_if %d already exists at idx %d", __func__, gatt_if, i);
      return true;
    }
  }

  for (int i = 0; i < GATT_MAX_APPS; i++) {
    if (p_tcb->app_hold_link[i] == 0 && is_add) {
      p_tcb->app_hold_link[i] = gatt_if;