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

Commit b60dd0bd authored by Martin Brabham's avatar Martin Brabham Committed by android-build-merger
Browse files

JustWorks: Auto-accept only incoming temporary pairing.

am: 7194f1ff

Change-Id: I392280bb44e2ab665baeab5ef5f1e6b9323fe463
parents c68e67fe 7194f1ff
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -924,6 +924,7 @@ static void btif_dm_ssp_cfm_req_evt(tBTA_DM_SP_CFM_REQ* p_ssp_cfm_req) {
  bt_bdaddr_t bd_addr;
  bt_bdname_t bd_name;
  uint32_t cod;
  bool is_incoming = !(pairing_cb.state == BT_BOND_STATE_BONDING);
  int dev_type;

  BTIF_TRACE_DEBUG("%s", __func__);
@@ -956,6 +957,19 @@ static void btif_dm_ssp_cfm_req_evt(tBTA_DM_SP_CFM_REQ* p_ssp_cfm_req) {

  pairing_cb.is_ssp = true;

  /* If JustWorks auto-accept */
  if (p_ssp_cfm_req->just_works) {
    /* Pairing consent for JustWorks NOT needed if:
     * 1. Incoming temporary pairing is detected
     */
    if (is_incoming && pairing_cb.bond_type == BOND_TYPE_TEMPORARY) {
      BTIF_TRACE_EVENT(
          "%s: Auto-accept JustWorks pairing for temporary incoming", __func__);
      btif_dm_ssp_reply(&bd_addr, BT_SSP_VARIANT_CONSENT, true, 0);
      return;
    }
  }

  cod = devclass2uint(p_ssp_cfm_req->dev_class);

  if (cod == 0) {