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

Commit c1705d71 authored by Chris Manton's avatar Chris Manton
Browse files

Only use gd storage if gd stack has been started up

Add flag to detect if gd stack has started up.

Upon init btif reads from config file:
1. Local adapter name
2. Discovery timeout

And writes:
1. LE keys (x4)
2. Scan default settings
3. Discovery timeout

Test: System boots without failure
Bug: 147315979

Change-Id: I52c24433bc49466bafcc948963041fcd098d9981
parent 4b59344d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -122,7 +122,7 @@ static const storage_config_t interface = {
};

static const storage_config_t* storage_config_get_interface() {
  if (bluetooth::shim::is_gd_shim_enabled()) {
  if (bluetooth::shim::is_gd_stack_started_up()) {
    return bluetooth::shim::storage_config_get_interface();
  } else {
    return &interface;
+5 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ static bluetooth::common::MessageLoopThread bt_shim_thread("bt_shim_thread");

static bool gd_shim_enabled_ = false;
static bool gd_shim_property_checked_ = false;
static bool gd_stack_started_up_ = false;

future_t* ShimModuleStartUp() {
  bt_shim_thread.StartUp();
@@ -37,10 +38,12 @@ future_t* ShimModuleStartUp() {
      << "Unable to start bt shim message loop thread.";
  module_start_up(get_module(GD_SHIM_BTM_MODULE));
  bluetooth::shim::StartGabeldorscheStack();
  gd_stack_started_up_ = true;
  return kReturnImmediate;
}

future_t* ShimModuleShutDown() {
  gd_stack_started_up_ = false;
  bluetooth::shim::StopGabeldorscheStack();
  module_shut_down(get_module(GD_SHIM_BTM_MODULE));
  bt_shim_thread.ShutDown();
@@ -66,3 +69,5 @@ bool bluetooth::shim::is_gd_shim_enabled() {
  }
  return gd_shim_enabled_;
}

bool bluetooth::shim::is_gd_stack_started_up() { return gd_stack_started_up_; }
+7 −0
Original line number Diff line number Diff line
@@ -48,6 +48,13 @@ namespace shim {
 */
bool is_gd_shim_enabled();

/**
 * Checks if the bluetooth gd stack has been started up.
 *
 * @return true if bluetooth gd stack is started, false otherwise.
 */
bool is_gd_stack_started_up();

/**
 * Posts a task on the shim message queue.
 *