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

Commit 84ab843c authored by Zach Johnson's avatar Zach Johnson
Browse files

Inline btif_disable_bluetooth

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I5e24c5864d424cc6437aab1b6f00affd725aac9d
parent 18bb7f35
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -61,19 +61,6 @@ bt_status_t btif_init_bluetooth(void);
 ******************************************************************************/
bt_status_t btif_enable_bluetooth(void);

/*******************************************************************************
 *
 * Function         btif_disable_bluetooth
 *
 * Description      Inititates shutdown of Bluetooth system.
 *                  Any active links will be dropped and device entering
 *                  non connectable/discoverable mode
 *
 * Returns          void
 *
 ******************************************************************************/
bt_status_t btif_disable_bluetooth(void);

/*******************************************************************************
 *
 * Function         btif_cleanup_bluetooth
+0 −29
Original line number Diff line number Diff line
@@ -386,35 +386,6 @@ void btif_enable_bluetooth_evt() {
  LOG_INFO("%s finished", __func__);
}

/*******************************************************************************
 *
 * Function         btif_disable_bluetooth
 *
 * Description      Inititates shutdown of Bluetooth system.
 *                  Any active links will be dropped and device entering
 *                  non connectable/discoverable mode
 *
 * Returns          void
 *
 ******************************************************************************/
bt_status_t btif_disable_bluetooth() {
  LOG_INFO("%s entered", __func__);

  do_in_main_thread(FROM_HERE, base::Bind(&btm_ble_multi_adv_cleanup));
  // TODO(jpawlowski): this should do whole BTA_VendorCleanup(), but it would
  // kill the stack now.

  btif_dm_on_disable();
  /* cleanup rfcomm & l2cap api */
  btif_sock_cleanup();
  btif_pan_cleanup();
  BTA_DisableBluetooth();

  LOG_INFO("%s finished", __func__);

  return BT_STATUS_SUCCESS;
}

/*******************************************************************************
 *
 * Function         btif_disable_bluetooth_evt
+9 −1
Original line number Diff line number Diff line
@@ -65,6 +65,8 @@
#endif
#include "bta/sys/bta_sys_int.h"
#include "bta_dm_int.h"
#include "btif/include/btif_pan.h"
#include "btif/include/btif_sock.h"
#include "main/shim/controller.h"

void BTA_dm_on_hw_on();
@@ -266,7 +268,13 @@ static void event_shut_down_stack(UNUSED_ATTR void* context) {
  hack_future = local_hack_future;
  stack_is_running = false;

  btif_disable_bluetooth();
  do_in_main_thread(FROM_HERE, base::Bind(&btm_ble_multi_adv_cleanup));

  btif_dm_on_disable();
  btif_sock_cleanup();
  btif_pan_cleanup();
  BTA_DisableBluetooth();

  module_shut_down(get_module(BTIF_CONFIG_MODULE));

  future_await(local_hack_future);