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

Commit 11fa8ef8 authored by Hsin-chen Chuang's avatar Hsin-chen Chuang Committed by Gerrit Code Review
Browse files

Merge "RFCOMM: Always be the DISC initiator in the DISC_WAIT_UA state" into main

parents 848c7013 e15a3054
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -473,6 +473,7 @@ cc_fuzz {
    ],
    static_libs: [
        "bluetooth_flags_c_lib",
        "libaconfig_storage_read_api_cc",
        "libbluetooth-types",
        "libbluetooth_crypto_toolbox",
        "libbluetooth_hci_pdl",
@@ -904,6 +905,7 @@ cc_test {
        "libcutils",
    ],
    static_libs: [
        "libaconfig_storage_read_api_cc",
        "libbase",
        "libbluetooth-types",
        "libbluetooth_crypto_toolbox",
@@ -924,6 +926,7 @@ cc_test {
        "libosi",
        "libprotobuf-cpp-lite",
        "libstatslog_bt",
        "server_configurable_flags",
    ],
    target: {
        android: {
+12 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
 ******************************************************************************/

#include <bluetooth/log.h>
#include <com_android_bluetooth_flags.h>

#include <cstdint>
#include <cstring>
@@ -568,6 +569,17 @@ void rfc_port_sm_disc_wait_ua(tPORT* p_port, tRFC_PORT_EVENT event, void* p_data

    case RFC_PORT_EVENT_DM:
      log::warn("RFC_EVENT_DM|RFC_EVENT_UA[{}], index={}", event, p_port->handle);
      if (com::android::bluetooth::flags::rfcomm_always_disc_initiator_in_disc_wait_ua()) {
        // If we got a DM in RFC_STATE_DISC_WAIT_UA, it's likely that both ends
        // attempt to DISC at the same time and both get a DM.
        // Without setting this flag the both ends would start the same timers,
        // wait, and still DISC the multiplexer at the same time eventually.
        // The wait is meaningless and would block all other services that rely
        // on RFCOMM such as HFP.
        // Thus, setting this flag here to save us a timeout and doesn't
        // introduce further RFCOMM event changes.
        p_port->rfc.p_mcb->is_disc_initiator = true;
      }
      rfc_port_closed(p_port);
      return;