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

Commit 04b9a76c authored by Zach Johnson's avatar Zach Johnson
Browse files

Flatten bte_main_disable

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Iaeb7b227c8778d63b143efa469214b38b54b171c
parent 35cfd339
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -211,7 +211,6 @@ void btif_remote_properties_evt(bt_status_t status, RawAddress* remote_addr,

void bte_load_did_conf(const char* p_path);
void bte_main_boot_entry(void);
void bte_main_disable(void);
void bte_main_cleanup(void);

bt_status_t btif_transfer_context(tBTIF_CBACK* p_cback, uint16_t event,
+13 −1
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@
#include "btif/include/btif_sock.h"
#include "main/shim/controller.h"

void BTU_ShutDown(void);
void BTA_dm_on_hw_on();
void BTA_dm_on_hw_off();

@@ -285,7 +286,18 @@ static void event_shut_down_stack(UNUSED_ATTR void* context) {
  module_shut_down(get_module(BTIF_CONFIG_MODULE));

  future_await(local_hack_future);
  bte_main_disable();

  if (bluetooth::shim::is_any_gd_enabled()) {
    LOG_INFO("%s Gd shim module disabled", __func__);
    module_shut_down(get_module(GD_SHIM_MODULE));
    module_start_up(get_module(GD_IDLE_MODULE));
  } else {
    module_shut_down(get_module(HCI_MODULE));
    module_shut_down(get_module(BTSNOOP_MODULE));
  }

  BTU_ShutDown();

  module_shut_down(get_module(CONTROLLER_MODULE));  // Doesn't do any work, just
                                                    // puts it in a restartable
                                                    // state
+0 −25
Original line number Diff line number Diff line
@@ -130,31 +130,6 @@ void bte_main_cleanup() {
  module_clean_up(get_module(INTEROP_MODULE));
}

/******************************************************************************
 *
 * Function         bte_main_disable
 *
 * Description      BTE MAIN API - Destroys all the BTE tasks. Should be called
 *                  part of the Bluetooth stack disable sequence
 *
 * Returns          None
 *
 *****************************************************************************/
void bte_main_disable(void) {
  APPL_TRACE_DEBUG("%s", __func__);

  if (bluetooth::shim::is_any_gd_enabled()) {
    LOG_INFO("%s Gd shim module disabled", __func__);
    module_shut_down(get_module(GD_SHIM_MODULE));
    module_start_up(get_module(GD_IDLE_MODULE));
  } else {
    module_shut_down(get_module(HCI_MODULE));
    module_shut_down(get_module(BTSNOOP_MODULE));
  }

  BTU_ShutDown();
}

/******************************************************************************
 *
 * Function         bte_main_hci_send
+0 −2
Original line number Diff line number Diff line
@@ -65,6 +65,4 @@ bt_status_t do_in_main_thread_delayed(const base::Location& from_here,
                                      base::OnceClosure task,
                                      const base::TimeDelta& delay);

void BTU_ShutDown(void);

#endif