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

Commit b379e520 authored by Łukasz Rymanowski (xWF)'s avatar Łukasz Rymanowski (xWF) Committed by Gerrit Code Review
Browse files

Merge "Remove gatt_reconnect_on_bt_on_fix flag" into main

parents e55657de c7db2631
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -65,13 +65,6 @@ flag {
    bug: "326249470"
}

flag {
    name: "gatt_reconnect_on_bt_on_fix"
    namespace: "bluetooth"
    description: "Fix reconnect issue on Bluetooth startup"
    bug: "325595120"
}

flag {
    name: "ble_scan_adv_metrics_redesign"
    namespace: "bluetooth"
+1 −2
Original line number Diff line number Diff line
@@ -1485,8 +1485,7 @@ bool GATT_Connect(tGATT_IF gatt_if, const RawAddress& bd_addr, tBLE_ADDR_TYPE ad
               transport);
    bool tcb_exist = !!gatt_find_tcb_by_addr(bd_addr, transport);

    if (!com::android::bluetooth::flags::gatt_reconnect_on_bt_on_fix() || tcb_exist ||
        transport == BT_TRANSPORT_BR_EDR) {
    if (tcb_exist || transport == BT_TRANSPORT_BR_EDR) {
      /* Consider to remove gatt_act_connect at all */
      ret = gatt_act_connect(p_reg, bd_addr, addr_type, transport, initiating_phys);
    } else {
+10 −14
Original line number Diff line number Diff line
@@ -1019,14 +1019,12 @@ static void gatt_send_conn_cback(tGATT_TCB* p_tcb) {
        gatt_update_app_use_link_flag(p_reg->gatt_if, p_tcb, true, true);
      }

      if (com::android::bluetooth::flags::gatt_reconnect_on_bt_on_fix()) {
      if (p_reg->direct_connect_request.count(p_tcb->peer_bda) > 0) {
        gatt_update_app_use_link_flag(p_reg->gatt_if, p_tcb, true, true);
          log::info("Removing device {} from the direct connect list of gatt_if {}",
                    p_tcb->peer_bda, p_reg->gatt_if);
        log::info("Removing device {} from the direct connect list of gatt_if {}", p_tcb->peer_bda,
                  p_reg->gatt_if);
        p_reg->direct_connect_request.erase(p_tcb->peer_bda);
      }
      }

      if (p_reg->app_cb.p_conn_cb) {
        conn_id = gatt_create_conn_id(p_tcb->tcb_idx, p_reg->gatt_if);
@@ -1044,14 +1042,12 @@ static void gatt_send_conn_cback(tGATT_TCB* p_tcb) {
        gatt_update_app_use_link_flag(p_reg->gatt_if, p_tcb, true, true);
      }

      if (com::android::bluetooth::flags::gatt_reconnect_on_bt_on_fix()) {
      if (p_reg->direct_connect_request.count(p_tcb->peer_bda) > 0) {
        gatt_update_app_use_link_flag(p_reg->gatt_if, p_tcb, true, true);
          log::info("Removing device {} from the direct connect list of gatt_if {}",
                    p_tcb->peer_bda, p_reg->gatt_if);
        log::info("Removing device {} from the direct connect list of gatt_if {}", p_tcb->peer_bda,
                  p_reg->gatt_if);
        p_reg->direct_connect_request.erase(p_tcb->peer_bda);
      }
      }

      if (p_reg->app_cb.p_conn_cb) {
        conn_id = gatt_create_conn_id(p_tcb->tcb_idx, p_reg->gatt_if);
+22 −37
Original line number Diff line number Diff line
@@ -1625,7 +1625,6 @@ static bool gatt_is_anybody_interested_in_connection(const RawAddress& bda) {
bool gatt_cancel_open(tGATT_IF gatt_if, const RawAddress& bda) {
  tGATT_TCB* p_tcb = gatt_find_tcb_by_addr(bda, BT_TRANSPORT_LE);
  if (!p_tcb) {
    if (com::android::bluetooth::flags::gatt_reconnect_on_bt_on_fix()) {
    /* TCB is not allocated when trying to connect under this flag.
     * but device address is storred in the tGATT_REG. Make sure to remove
     * the address from the list when cancel is called.
@@ -1644,10 +1643,6 @@ bool gatt_cancel_open(tGATT_IF gatt_if, const RawAddress& bda) {
    return true;
  }

    log::warn("Unable to cancel open for unknown connection gatt_if:{} peer:{}", gatt_if, bda);
    return true;
  }

  if (gatt_get_ch_state(p_tcb) == GATT_CH_OPEN) {
    log::error("link connected Too late to cancel");
    return false;
@@ -1864,14 +1859,12 @@ static void gatt_le_disconnect_complete_notify_user(const RawAddress& bda,
                                   transport);
      }

      if (com::android::bluetooth::flags::gatt_reconnect_on_bt_on_fix()) {
      if (p_reg->direct_connect_request.count(bda) > 0) {
        log::info("Removing device {} from the direct connect list of gatt_if {}", bda,
                  p_reg->gatt_if);
        p_reg->direct_connect_request.erase(bda);
      }
    }
    }
  } else {
    for (uint8_t i = 0; i < GATT_MAX_APPS; i++) {
      tGATT_REG* p_reg = &gatt_cb.cl_rcb[i];
@@ -1882,7 +1875,6 @@ static void gatt_le_disconnect_complete_notify_user(const RawAddress& bda,
                                   transport);
      }

      if (com::android::bluetooth::flags::gatt_reconnect_on_bt_on_fix()) {
      if (p_reg->direct_connect_request.count(bda) > 0) {
        log::info("Removing device {} from the direct connect list of gatt_if {}", bda,
                  p_reg->gatt_if);
@@ -1891,7 +1883,6 @@ static void gatt_le_disconnect_complete_notify_user(const RawAddress& bda,
    }
  }
}
}

/** This function cleans up the control blocks when L2CAP channel disconnect */
void gatt_cleanup_upon_disc(const RawAddress& bda, tGATT_DISCONN_REASON reason,
@@ -1900,12 +1891,6 @@ void gatt_cleanup_upon_disc(const RawAddress& bda, tGATT_DISCONN_REASON reason,

  tGATT_TCB* p_tcb = gatt_find_tcb_by_addr(bda, transport);
  if (!p_tcb) {
    if (!com::android::bluetooth::flags::gatt_reconnect_on_bt_on_fix()) {
      log::error("Disconnect for unknown connection bd_addr:{} reason:{} transport:{}", bda,
                 gatt_disconnection_reason_text(reason), bt_transport_text(transport));
      return;
    }

    log::info("Connection timeout bd_addr:{} reason:{} transport:{}", bda,
              gatt_disconnection_reason_text(reason), bt_transport_text(transport));