diff --git a/system/bta/dm/bta_dm_api.cc b/system/bta/dm/bta_dm_api.cc index 6761a2e2b4b2713722beaf1aa945aeac986d70b9..cd64f1292e5bf9bf5720420871b278f6d980f99d 100644 --- a/system/bta/dm/bta_dm_api.cc +++ b/system/bta/dm/bta_dm_api.cc @@ -44,28 +44,10 @@ using bluetooth::Uuid; static const tBTA_SYS_REG bta_dm_search_reg = {bta_dm_search_sm_execute, bta_dm_search_sm_disable}; -/******************************************************************************* - * - * Function BTA_EnableBluetooth - * - * Description Enables bluetooth service. This function must be - * called before any other functions in the BTA API are called. - * - * - * Returns tBTA_STATUS - * - ******************************************************************************/ -tBTA_STATUS BTA_EnableBluetooth(tBTA_DM_SEC_CBACK* p_cback) { - /* Bluetooth disabling is in progress */ - if (bta_dm_cb.disabling) return BTA_FAILURE; - +void BTA_dm_init() { bta_sys_register(BTA_ID_DM_SEARCH, &bta_dm_search_reg); - /* if UUID list is not provided as static data */ bta_sys_eir_register(bta_dm_eir_update_uuid); - - do_in_main_thread(FROM_HERE, base::Bind(bta_dm_enable, p_cback)); - return BTA_SUCCESS; } /******************************************************************************* diff --git a/system/bta/include/bta_api.h b/system/bta/include/bta_api.h index 0774fd30cbb67cdd45713c9c040139c5758ce383..5f531066566e376ab426b312d7a5e60262c3d820 100644 --- a/system/bta/include/bta_api.h +++ b/system/bta/include/bta_api.h @@ -953,23 +953,7 @@ typedef uint8_t tBTA_DM_LINK_TYPE; * External Function Declarations ****************************************************************************/ -/******************************************************************************* - * - * Function BTA_EnableBluetooth - * - * Description This function initializes BTA and prepares BTA and the - * Bluetooth protocol stack for use. This function is - * typically called at startup or when Bluetooth services - * are required by the phone. This function must be called - * before calling any other API function. - * - * - * Returns BTA_SUCCESS if successful. - * BTA_FAIL if internal failure. - * - ******************************************************************************/ -extern tBTA_STATUS BTA_EnableBluetooth(tBTA_DM_SEC_CBACK* p_cback); - +void BTA_dm_init(); /******************************************************************************* * * Function BTA_DisableBluetooth diff --git a/system/btif/src/stack_manager.cc b/system/btif/src/stack_manager.cc index db313676dd12ddfb670c2fab7af03fbc3e55932c..d9e7205ac705d852a5d85a54b16aae4f103262d4 100644 --- a/system/btif/src/stack_manager.cc +++ b/system/btif/src/stack_manager.cc @@ -63,6 +63,7 @@ #if (defined BTA_AR_INCLUDED) && (BTA_AR_INCLUDED == TRUE) #include "bta_ar_api.h" #endif +#include "bta_dm_int.h" using bluetooth::common::MessageLoopThread; @@ -221,7 +222,8 @@ static void event_start_up_stack(UNUSED_ATTR void* context) { main_thread_start_up(); btif_init_ok(); - BTA_EnableBluetooth(bte_dm_evt); + BTA_dm_init(); + bta_dm_enable(bte_dm_evt); if (future_await(local_hack_future) != FUTURE_SUCCESS) { LOG_ERROR("%s failed to start up the stack", __func__);