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

Commit df8e5101 authored by Zach Johnson's avatar Zach Johnson
Browse files

Send BTA_SYS_API_DISABLE_EVT from stack manager

Use futures to signal when the event should be sent

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I3f0daa41275f867821ae2c4d7015bc1fbe177124
parent 8e20dc5f
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@
#include "stack/gatt/connection_manager.h"
#include "stack/include/acl_api.h"
#include "stack/include/gatt_api.h"
#include "stack_manager.h"
#include "utl.h"

#if (GAP_INCLUDED == TRUE)
@@ -2679,10 +2680,8 @@ static void bta_dm_disable_conn_down_timer_cback(UNUSED_ATTR void* data) {
  /* disable the power managment module */
  bta_dm_disable_pm();

  /* register our callback to SYS HW manager */
  send_bta_sys_hw_event(BTA_SYS_API_DISABLE_EVT);

  bta_dm_cb.disabling = false;
  future_ready(stack_manager_get_hack_future(), FUTURE_SUCCESS);
}

/*******************************************************************************
+6 −0
Original line number Diff line number Diff line
@@ -274,6 +274,12 @@ static void event_shut_down_stack(UNUSED_ATTR void* context) {

  do_in_main_thread(FROM_HERE, base::Bind(bta_dm_disable));

  future_await(local_hack_future);
  local_hack_future = future_new();
  hack_future = local_hack_future;

  send_bta_sys_hw_event(BTA_SYS_API_DISABLE_EVT);

  module_shut_down(get_module(BTIF_CONFIG_MODULE));

  future_await(local_hack_future);