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

Commit 0628abec authored by Rahul Arya's avatar Rahul Arya Committed by Gerrit Code Review
Browse files

Merge "[Connection Manager] Properly start/stop Rust thread"

parents a404089d e5a61a7b
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@
#include "hardware/bt_gatt.h"
#include "rust/cxx.h"
#include "rust/src/gatt/ffi/gatt_shim.h"
#include "src/core/ffi.rs.h"
#include "src/gatt/ffi.rs.h"
#include "utils/Log.h"
#define info(fmt, ...) ALOGI("%s(L%d): " fmt, __func__, __LINE__, ##__VA_ARGS__)
@@ -1393,10 +1392,6 @@ static void initializeNative(JNIEnv* env, jobject object) {
      JniDistanceMeasurementCallbacks::GetInstance());

  mCallbacksObj = env->NewGlobalRef(object);

  auto callbacks = std::make_unique<bluetooth::gatt::GattServerCallbacks>(
      sGattServerCallbacks);
  bluetooth::rust_shim::init(std::move(callbacks));
}

static void cleanupNative(JNIEnv* env, jobject object) {
+7 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@
#include "device/include/interop.h"
#include "internal_include/stack_config.h"
#include "main/shim/controller.h"
#include "rust/src/core/ffi/module.h"
#include "stack/include/smp_api.h"

#ifndef BT_STACK_CLEANUP_WAIT_MS
@@ -214,6 +215,7 @@ extern const module_t gd_idle_module;
extern const module_t gd_shim_module;
extern const module_t interop_module;
extern const module_t osi_module;
extern const module_t rust_module;
extern const module_t stack_config_module;
extern const module_t device_iot_config_module;

@@ -230,6 +232,7 @@ const struct module_lookup module_table[] = {
    {GD_SHIM_MODULE, &gd_shim_module},
    {INTEROP_MODULE, &interop_module},
    {OSI_MODULE, &osi_module},
    {RUST_MODULE, &rust_module},
    {STACK_CONFIG_MODULE, &stack_config_module},
    {DEVICE_IOT_CONFIG_MODULE, &device_iot_config_module},
    {NULL, NULL},
@@ -349,6 +352,8 @@ static void event_start_up_stack(bluetooth::core::CoreInterface* interface,
    return;
  }

  module_start_up(get_local_module(RUST_MODULE));

  stack_is_running = true;
  LOG_INFO("%s finished", __func__);
  do_in_jni_thread(FROM_HERE, base::Bind(event_signal_stack_up, nullptr));
@@ -366,6 +371,8 @@ static void event_shut_down_stack(ProfileStopCallback stopProfiles) {
  hack_future = local_hack_future;
  stack_is_running = false;

  module_shut_down(get_local_module(RUST_MODULE));

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

  do_in_main_thread(FROM_HERE, base::Bind(&btm_ble_scanner_cleanup));
+1 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ module_t gd_controller_module;
module_t gd_idle_module;
module_t gd_shim_module;
module_t osi_module;
module_t rust_module;

namespace {

+1 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ module_t gd_controller_module;
module_t gd_idle_module;
module_t gd_shim_module;
module_t osi_module;
module_t rust_module;

const tBTA_AG_RES_DATA tBTA_AG_RES_DATA::kEmpty = {};

+1 −0
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@ target(lib_type, "bluetooth") {
    "//bt/system/main/shim:LibBluetoothShimSources",
    "//bt/system/osi",
    "//bt/system/packet",
    "//bt/system/rust:core_rs",
    "//bt/system/stack",
    "//bt/system/udrv",
  ]
Loading