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

Commit 8cb197bc authored by Michael Sun's avatar Michael Sun Committed by Automerger Merge Worker
Browse files

Merge "interop: add an interop rule to delay authentication" into main am: 909b13f4

parents 9d7e1d66 909b13f4
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -343,6 +343,10 @@ typedef enum {
  // It is required for some devices to provide sound.
  INTEROP_INSERT_CALL_WHEN_SCO_START,

  // Some device need the host to delay authentication process to avoid
  // collision.
  INTEROP_DELAY_AUTH,

  END_OF_INTEROP_LIST
} interop_feature_t;

+1 −0
Original line number Diff line number Diff line
@@ -394,6 +394,7 @@ static const char* interop_feature_string_(const interop_feature_t feature) {
    CASE_RETURN_STR(INTEROP_IGNORE_DISC_BEFORE_SIGNALLING_TIMEOUT);
    CASE_RETURN_STR(INTEROP_SUSPEND_ATT_TRAFFIC_DURING_PAIRING);
    CASE_RETURN_STR(INTEROP_INSERT_CALL_WHEN_SCO_START);
    CASE_RETURN_STR(INTEROP_DELAY_AUTH);
  }
  return UNKNOWN_INTEROP_FEATURE;
}
+9 −2
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@
#include "common/time_util.h"
#include "device/include/controller.h"
#include "device/include/device_iot_config.h"
#include "device/include/interop.h"
#include "internal_include/bt_target.h"
#include "l2c_api.h"
#include "osi/include/allocator.h"
@@ -80,6 +81,7 @@ constexpr char kBtmLogTag[] = "SEC";
extern tBTM_CB btm_cb;

#define BTM_SEC_MAX_COLLISION_DELAY (5000)
#define BTM_SEC_START_AUTH_DELAY (200)

#define BTM_SEC_IS_SM4(sm) ((bool)(BTM_SM4_TRUE == ((sm)&BTM_SM4_TRUE)))
#define BTM_SEC_IS_SM4_LEGACY(sm) ((bool)(BTM_SM4_KNOWN == ((sm)&BTM_SM4_TRUE)))
@@ -4487,10 +4489,15 @@ static bool btm_sec_start_get_name(tBTM_SEC_DEV_REC* p_dev_rec) {
 ******************************************************************************/
static void btm_sec_wait_and_start_authentication(tBTM_SEC_DEV_REC* p_dev_rec) {
  auto addr = new RawAddress(p_dev_rec->bd_addr);

  static const int32_t delay_auth =
  int32_t delay_auth =
      osi_property_get_int32("bluetooth.btm.sec.delay_auth_ms.value", 0);

  /* Overwrite the system-wide authentication delay if device-specific
   * interoperability delay is needed. */
  if (interop_match_addr(INTEROP_DELAY_AUTH, addr)) {
    delay_auth = BTM_SEC_START_AUTH_DELAY;
  }

  bt_status_t status = do_in_main_thread_delayed(
      FROM_HERE, base::Bind(&btm_sec_auth_timer_timeout, addr),
      std::chrono::milliseconds(delay_auth));