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

Commit 2d52d8be authored by Zach Johnson's avatar Zach Johnson Committed by Gerrit Code Review
Browse files

Merge changes I4c3ad4ff,I798bca68,Iaeb7b227,I30f310f6

* changes:
  btu_task_shut_down -> main_thread_shut_down
  Flatten BTU_ShutDown
  Flatten bte_main_disable
  Remove btif_disable_bluetooth_evt
parents 33b17c43 4c109d91
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -204,7 +204,6 @@ int btif_is_enabled(void);
 * BTIF_Events
 */
void btif_enable_bluetooth_evt();
void btif_disable_bluetooth_evt(void);
void btif_adapter_properties_evt(bt_status_t status, uint32_t num_props,
                                 bt_property_t* p_props);
void btif_remote_properties_evt(bt_status_t status, RawAddress* remote_addr,
@@ -212,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,
+0 −23
Original line number Diff line number Diff line
@@ -386,29 +386,6 @@ void btif_enable_bluetooth_evt() {
  LOG_INFO("%s finished", __func__);
}

/*******************************************************************************
 *
 * Function         btif_disable_bluetooth_evt
 *
 * Description      Event notifying BT disable is now complete.
 *                  Terminates main stack tasks and notifies HAL
 *                  user with updated BT state.
 *
 * Returns          void
 *
 ******************************************************************************/

void btif_disable_bluetooth_evt() {
  LOG_INFO("%s entered", __func__);

  bte_main_disable();

  /* callback to HAL */
  future_ready(stack_manager_get_hack_future(), FUTURE_SUCCESS);

  LOG_INFO("%s finished", __func__);
}

/*******************************************************************************
 *
 * Function         btif_cleanup_bluetooth
+2 −1
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@
#include "advertise_data_parser.h"
#include "bt_common.h"
#include "bta_gatt_api.h"
#include "btif/include/stack_manager.h"
#include "btif_api.h"
#include "btif_av.h"
#include "btif_bqr.h"
@@ -1739,7 +1740,7 @@ static void btif_dm_upstreams_evt(uint16_t event, char* p_param) {
        }
      }
      bluetooth::bqr::EnableBtQualityReport(false);
      btif_disable_bluetooth_evt();
      future_ready(stack_manager_get_hack_future(), FUTURE_SUCCESS);
      break;

    case BTA_DM_PIN_REQ_EVT:
+18 −2
Original line number Diff line number Diff line
@@ -69,6 +69,8 @@
#include "btif/include/btif_sock.h"
#include "main/shim/controller.h"

void main_thread_shut_down();
void main_thread_start_up();
void BTA_dm_on_hw_on();
void BTA_dm_on_hw_off();

@@ -90,8 +92,6 @@ static void event_clean_up_stack(void* context);
static void event_signal_stack_up(void* context);
static void event_signal_stack_down(void* context);

void main_thread_start_up();

// Unvetted includes/imports, etc which should be removed or vetted in the
// future
static future_t* hack_future;
@@ -285,6 +285,22 @@ static void event_shut_down_stack(UNUSED_ATTR void* context) {
  module_shut_down(get_module(BTIF_CONFIG_MODULE));

  future_await(local_hack_future);

  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));
  }

  main_thread_shut_down();

  module_clean_up(get_module(BTE_LOGMSG_MODULE));

  btu_free_core();

  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
Loading