From 7b32c85942c038866d44634b0c08593133e150b7 Mon Sep 17 00:00:00 2001
From: Martin Brabham <optedoblivion@google.com>
Date: Fri, 24 May 2019 15:13:38 -0700
Subject: [PATCH] DO NOT MERGE: btif: require pairing dialog for JustWorks SSP

Bug: 110433804
Test: Manual; atest net_test_bluetooth
Change-Id: If65a8d53ff368ba3ddddb47cfc0072469090b46a
(cherry picked from commit ddae6274742e241c03526c7659dca7b3446b9f8d)
(cherry picked from commit 26ba26be830f04e6fd9c77b075bcae48677d4cce)
---
 btif/src/btif_dm.c | 23 -----------------------
 1 file changed, 23 deletions(-)

diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.c
index f2bd9001..544cb1a4 100644
--- a/btif/src/btif_dm.c
+++ b/btif/src/btif_dm.c
@@ -915,7 +915,6 @@ 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 cod;
-    BOOLEAN is_incoming = !(pairing_cb.state == BT_BOND_STATE_BONDING);
 
     BTIF_TRACE_DEBUG1("%s", __FUNCTION__);
 
@@ -946,28 +945,6 @@ 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 needed if:
-         * 1. Incoming pairing is detected AND
-         * 2. local IO capabilities are DisplayYesNo AND
-         * 3. remote IO capabiltiies are DisplayOnly or NoInputNoOutput;
-         */
-        if ((is_incoming) && ((p_ssp_cfm_req->loc_io_caps == 0x01) &&
-                (p_ssp_cfm_req->rmt_io_caps == 0x00 || p_ssp_cfm_req->rmt_io_caps == 0x03)))
-        {
-            BTIF_TRACE_EVENT3("%s: User consent needed for incoming pairing request. loc_io_caps: %d, rmt_io_caps: %d",
-                __FUNCTION__, p_ssp_cfm_req->loc_io_caps, p_ssp_cfm_req->rmt_io_caps);
-        }
-        else
-        {
-            BTIF_TRACE_EVENT1("%s: Auto-accept JustWorks pairing", __FUNCTION__);
-            btif_dm_ssp_reply(&bd_addr, BT_SSP_VARIANT_CONSENT, TRUE, 0);
-            return;
-        }
-    }
-
     cod = devclass2uint(p_ssp_cfm_req->dev_class);
 
     if ( cod == 0) {
