Solve compilation problem when BLE/GATT/SMP features are false

bug 8664724
Change-Id: I582846ccf4b8995f298d8db533488fceb7993ae3
diff --git a/bta/dm/bta_dm_int.h b/bta/dm/bta_dm_int.h
index 3ca57a7..ca34356 100644
--- a/bta/dm/bta_dm_int.h
+++ b/bta/dm/bta_dm_int.h
@@ -510,13 +510,6 @@
     tBTA_DM_SEARCH_CBACK * p_cback;
 }tBTA_DM_API_BLE_OBSERVE;
 
-typedef struct
-{
-    BT_HDR                  hdr;
-    BOOLEAN                 enable_or_disable;
-}tBTA_DM_API_SET_AFH_CHANNEL_ASSESSMENT;
-
-
 /* set adv parameter for BLE advertising */
 typedef struct
 {
@@ -535,6 +528,12 @@
 
 #endif
 
+typedef struct
+{
+    BT_HDR                  hdr;
+    BOOLEAN                 enable_or_disable;
+}tBTA_DM_API_SET_AFH_CHANNEL_ASSESSMENT;
+
 #if ( BTM_EIR_SERVER_INCLUDED == TRUE )&&( BTA_EIR_CANNED_UUID_LIST != TRUE )&&(BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0)
 /* data type for BTA_DM_API_UPDATE_EIR_UUID_EVT */
 typedef struct
diff --git a/bta/include/bta_api.h b/bta/include/bta_api.h
index 26302bc..087446e 100644
--- a/bta/include/bta_api.h
+++ b/bta/include/bta_api.h
@@ -1862,6 +1862,8 @@
 **
 *******************************************************************************/
 BTA_API extern void BTA_DmSetAfhChannelAssessment (BOOLEAN enable_or_disable);
+
+#if BLE_INCLUDE == TRUE
 // btla-specific --
 /*******************************************************************************
 **
@@ -1904,6 +1906,7 @@
 *******************************************************************************/
 BTA_API extern void BTA_DmBleSetAdvConfig (tBTA_BLE_AD_MASK data_mask,
                                            tBTA_BLE_ADV_DATA *p_adv_cfg);
+#endif
 
 #ifdef __cplusplus
 }
diff --git a/btif/co/bta_dm_co.c b/btif/co/bta_dm_co.c
index a310a00..fd91817 100644
--- a/btif/co/bta_dm_co.c
+++ b/btif/co/bta_dm_co.c
@@ -27,9 +27,9 @@
 #endif
 #if (defined BLE_INCLUDED && BLE_INCLUDED == TRUE)
 #include "bte_appl.h"
-#endif
 
 tBTE_APPL_CFG bte_appl_cfg = { 0x5, 0x4, 0x7, 0x7, 0x10 };
+#endif
 
 /*******************************************************************************
 **
diff --git a/btif/src/bluetooth.c b/btif/src/bluetooth.c
index f62bf28..a412296 100755
--- a/btif/src/bluetooth.c
+++ b/btif/src/bluetooth.c
@@ -326,8 +326,10 @@
     if (is_profile(profile_id, BT_PROFILE_HEALTH_ID))
         return btif_hl_get_interface();
 
+#if BTA_GATT_INCLUDED == TRUE
     if (is_profile(profile_id, BT_PROFILE_GATT_ID))
         return btif_gatt_get_interface();
+#endif
 
     if (is_profile(profile_id, BT_PROFILE_AV_RC_ID))
         return btif_rc_get_interface();
@@ -356,6 +358,8 @@
 
     return btif_dut_mode_send(opcode, buf, len);
 }
+
+#if BLE_INCLUDED == TRUE
 int le_test_mode(uint16_t opcode, uint8_t* buf, uint8_t len)
 {
     ALOGI("le_test_mode");
@@ -366,7 +370,7 @@
 
     return btif_le_test_mode(opcode, buf, len);
 }
-
+#endif
 
 static const bt_interface_t bluetoothInterface = {
     sizeof(bluetoothInterface),
@@ -392,7 +396,11 @@
     get_profile_interface,
     dut_mode_configure,
     dut_mode_send,
+#if BLE_INCLUDED == TRUE
     le_test_mode
+#else
+    NULL
+#endif
 };
 
 const bt_interface_t* bluetooth__get_bluetooth_interface ()
diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.c
index 5a7cccd..f947e84 100644
--- a/btif/src/btif_dm.c
+++ b/btif/src/btif_dm.c
@@ -479,6 +479,7 @@
     }
     else
     {
+#if BLE_INCLUDED == TRUE
         int device_type;
         int addr_type;
         bdstr_t bdstr;
@@ -489,6 +490,7 @@
         {
             BTA_DmAddBleDevice(bd_addr->address, addr_type, BT_DEVICE_TYPE_BLE);
         }
+#endif
         BTA_DmBond ((UINT8 *)bd_addr->address);
     }
     /*  Track  originator of bond creation  */
diff --git a/btif/src/btif_gatt_util.c b/btif/src/btif_gatt_util.c
index 34635a5..3775776 100644
--- a/btif/src/btif_gatt_util.c
+++ b/btif/src/btif_gatt_util.c
@@ -16,7 +16,6 @@
  *
  ******************************************************************************/
 
-
 #include <hardware/bluetooth.h>
 #include <hardware/bt_gatt.h>
 #include <stdio.h>
@@ -37,6 +36,8 @@
 #include "btif_gatt.h"
 #include "btif_gatt_util.h"
 
+#if BTA_GATT_INCLUDED == TRUE
+
 #define GATTC_READ_VALUE_TYPE_VALUE          0x0000  /* Attribute value itself */
 #define GATTC_READ_VALUE_TYPE_AGG_FORMAT     0x2905  /* Characteristic Aggregate Format*/
 
@@ -355,3 +356,5 @@
                             &btif_gatt_set_encryption_cb, BTM_BLE_SEC_ENCRYPT);
     }
 }
+
+#endif
diff --git a/btif/src/btif_storage.c b/btif/src/btif_storage.c
index 9843530..a113d48 100644
--- a/btif/src/btif_storage.c
+++ b/btif/src/btif_storage.c
@@ -496,11 +496,13 @@
                         uint2devclass((UINT32)cod, dev_class);
                     BTA_DmAddDevice(bd_addr.address, dev_class, link_key, 0, 0, (UINT8)linkkey_type, 0);
 
+#if BLE_INCLUDED == TRUE
                     if (btif_config_get_int("Remote", kname, "DevType", &device_type) &&
                        (device_type == BT_DEVICE_TYPE_DUMO) )
                     {
                         btif_gatts_add_bonded_dev_from_nv(bd_addr.address);
                     }
+#endif
                 }
                 bt_linkkey_file_found = TRUE;
                 memcpy(&p_bonded_devices->devices[p_bonded_devices->num_devices++], &bd_addr, sizeof(bt_bdaddr_t));
diff --git a/stack/btm/btm_ble.c b/stack/btm/btm_ble.c
index 0400df4..3fa9fcd 100644
--- a/stack/btm/btm_ble.c
+++ b/stack/btm/btm_ble.c
@@ -586,6 +586,8 @@
     return;
 }
 
+#if BLE_INCLUDED == TRUE
+
 /*******************************************************************************
 **
 ** Function         BTM_BleReceiverTest
@@ -647,6 +649,8 @@
      }
 }
 
+#endif
+
 /*******************************************************************************
 ** Internal Functions
 *******************************************************************************/
diff --git a/stack/btm/btm_devctl.c b/stack/btm/btm_devctl.c
index 79b2350..7f56d2c 100644
--- a/stack/btm/btm_devctl.c
+++ b/stack/btm/btm_devctl.c
@@ -1227,13 +1227,13 @@
         {
             btm_read_ble_wl_size();
         }
+        else
 #elif BTM_INTERNAL_BB == TRUE
         {
             UINT8 buf[9] = BTM_INTERNAL_LOCAL_FEA;
             btm_read_local_features_complete( buf, 9 );
         }
 #endif
-        else
         {
             btm_reset_ctrlr_complete();
         }
diff --git a/test/bluedroidtest/bluedroidtest.c b/test/bluedroidtest/bluedroidtest.c
index 9cdd42d..2b517df 100644
--- a/test/bluedroidtest/bluedroidtest.c
+++ b/test/bluedroidtest/bluedroidtest.c
@@ -492,8 +492,12 @@
     NULL, /* acl_state_changed_cb */
     NULL, /* thread_evt_cb */
     dut_mode_recv, /*dut_mode_recv_cb */
-    NULL, /*authorize_request_cb */
+//    NULL, /*authorize_request_cb */
+#if BLE_INCLUDED == TRUE
     le_test_mode /* le_test_mode_cb */
+#else
+    NULL
+#endif
 };
 
 void bdt_init(void)