Support numeric comparison in SMP

Enable support for numeric comparison in SMP when LE Secure connection
is supported. The change will distinguish between passkey confirmation
in case of Security grant and Passkey confirm.

Original author: Priti Aghera <paghera@broadcom.com>

Bug: 19816438
Change-Id: Id1fd072d1e567a80b020b4ba217486c3308ad39d
diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.c
index 2e687e1..54bcca8 100644
--- a/btif/src/btif_dm.c
+++ b/btif/src/btif_dm.c
@@ -140,6 +140,7 @@
     UINT8   sdp_attempts;
 #if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
     BOOLEAN          is_le_only;
+    BOOLEAN          is_le_nc;/*LE Numeric comparison*/
     btif_dm_ble_cb_t ble;
 #endif
 } btif_dm_pairing_cb_t;
@@ -2522,14 +2523,18 @@
 #if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
     if (pairing_cb.is_le_only)
     {
-        if (accept)
-            BTA_DmBleSecurityGrant((UINT8 *)bd_addr->address,BTA_DM_SEC_GRANTED);
-        else
-            BTA_DmBleSecurityGrant((UINT8 *)bd_addr->address,BTA_DM_SEC_PAIR_NOT_SPT);
-    }
-    else
+        if(pairing_cb.is_le_nc)
+        {
+            BTA_DmBleConfirmReply((UINT8 *)bd_addr->address,accept);
+        } else {
+            if (accept)
+                BTA_DmBleSecurityGrant((UINT8 *)bd_addr->address,BTA_DM_SEC_GRANTED);
+            else
+                BTA_DmBleSecurityGrant((UINT8 *)bd_addr->address,BTA_DM_SEC_PAIR_NOT_SPT);
+        }
+    } else {
         BTA_DmConfirm( (UINT8 *)bd_addr->address, accept);
-
+    }
 #else
     BTA_DmConfirm( (UINT8 *)bd_addr->address, accept);
 #endif
@@ -3083,6 +3088,7 @@
 
     pairing_cb.bond_type = BOND_TYPE_PERSISTENT;
     pairing_cb.is_le_only = TRUE;
+    pairing_cb.is_le_nc = FALSE;
     pairing_cb.is_ssp = TRUE;
 
     cod = COD_UNCLASSIFIED;
@@ -3145,6 +3151,8 @@
 
     bond_state_changed(BT_STATUS_SUCCESS, &bd_addr, BT_BOND_STATE_BONDING);
     pairing_cb.is_ssp = FALSE;
+    pairing_cb.is_le_only = TRUE;
+    pairing_cb.is_le_nc = TRUE;
 
     HAL_CBACK(bt_hal_cbacks, ssp_request_cb, &bd_addr, &bd_name,
               COD_UNCLASSIFIED, BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
@@ -3203,7 +3211,6 @@
      }
      return BT_STATUS_SUCCESS;
 }
-
 #endif
 
 void btif_dm_on_disable()