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

Commit 5e1b139f authored by Zach Johnson's avatar Zach Johnson Committed by Gerrit Code Review
Browse files

Merge changes from topic "revert-1518559-revert-1512686-LIHRZNOOWL-ZWQBPCZFIZ"

* changes:
  Revert "Revert "rusty-gd: add stack start stubs, define shim lib..."
  Revert^2 "rusty-gd: move init_flag parsing to rust"
  Revert^2 "rusty-gd: compile into libbluetooth"
parents 0fee6691 9457ecfe
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
apex {
    name: "com.android.bluetooth.updatable",
    enabled: false,

    manifest: "apex_manifest.json",

+0 −1
Original line number Diff line number Diff line
@@ -115,7 +115,6 @@ cc_library_static {
    cflags: [
        "-DBUILDCFG",
    ],

}

// btif unit tests for target
+3 −0
Original line number Diff line number Diff line
@@ -90,6 +90,9 @@ fluoride_defaults {
    },
    static_libs: [
        "libbluetooth_gd",
        "libbluetooth_rust_interop",
        "libbt_shim_ffi",
        "libcxxbridge05",
    ],
    target: {
        darwin: {
+19 −2
Original line number Diff line number Diff line
@@ -76,7 +76,6 @@ cc_defaults {
    name: "gd_clang_tidy",
    tidy: true,
    tidy_checks: [
        "cppcoreguidelines-pro-type-member-init",
        "clang-analyzer-core.CallAndMessage",
        "clang-analyzer-optin.cplusplus.UninitializedObject",
        "-google*",
@@ -162,7 +161,11 @@ cc_defaults {
    ],
    static_libs: [
        "libbluetooth-protos",
    ]
        "libbluetooth_rust_interop",
        "libbt_shim_ffi",
        "libcxxbridge05",
    ],
    export_static_lib_headers: [ "libbluetooth_rust_interop" ],
}

cc_library {
@@ -221,6 +224,9 @@ cc_binary {
        "libbluetooth-protos",
        "libbluetooth_gd",
        "libflatbuffers-cpp",
        "libbluetooth_rust_interop",
        "libbt_shim_ffi",
        "libcxxbridge05",
    ],
    shared_libs: [
        "libbacktrace",
@@ -309,6 +315,9 @@ cc_test {
        "libc++fs",
        "libflatbuffers-cpp",
        "libgmock",
        "libbluetooth_rust_interop",
        "libbt_shim_ffi",
        "libcxxbridge05",
    ],
    shared_libs: [
        "libchrome",
@@ -339,6 +348,11 @@ cc_test {
        address: true,
        cfi: true,
    },
    static_libs: [
        "libbluetooth_rust_interop",
        "libbt_shim_ffi",
        "libcxxbridge05",
    ],
}

cc_defaults {
@@ -354,6 +368,9 @@ cc_defaults {
        "libchrome",
        "libgmock",
        "libgtest",
        "libbluetooth_rust_interop",
        "libbt_shim_ffi",
        "libcxxbridge05",
    ],
    host_supported: true,
    generated_headers: [
+7 −57
Original line number Diff line number Diff line
@@ -26,15 +26,6 @@
namespace bluetooth {
namespace common {

bool InitFlags::btaa_hci_log_enabled = false;
bool InitFlags::gd_core_enabled = false;
bool InitFlags::gd_advertising_enabled = false;
bool InitFlags::gd_security_enabled = false;
bool InitFlags::gd_acl_enabled = false;
bool InitFlags::gd_l2cap_enabled = false;
bool InitFlags::gd_hci_enabled = false;
bool InitFlags::gd_controller_enabled = false;
bool InitFlags::gatt_robust_caching_enabled = false;
bool InitFlags::logging_debug_enabled_for_all = false;
std::unordered_map<std::string, bool> InitFlags::logging_debug_explicit_tag_settings = {};

@@ -56,21 +47,11 @@ void InitFlags::Load(const char** flags) {
    std::string flag_element = *flags;
    auto flag_pair = StringSplit(flag_element, "=", 2);
    if (flag_pair.size() != 2) {
      LOG_ERROR("Bad flag %s, must be in <FLAG>=<VALUE> format", flag_element.c_str());
      flags++;
      continue;
    }

    ParseBoolFlag(flag_pair, "INIT_gd_core", &gd_core_enabled);
    ParseBoolFlag(flag_pair, "INIT_gd_advertising", &gd_advertising_enabled);
    ParseBoolFlag(flag_pair, "INIT_gd_security", &gd_security_enabled);
    ParseBoolFlag(flag_pair, "INIT_gd_acl", &gd_acl_enabled);
    ParseBoolFlag(flag_pair, "INIT_gd_l2cap", &gd_l2cap_enabled);
    ParseBoolFlag(flag_pair, "INIT_gd_hci", &gd_hci_enabled);
    ParseBoolFlag(flag_pair, "INIT_gd_controller", &gd_controller_enabled);
    ParseBoolFlag(flag_pair, "INIT_gatt_robust_caching", &gatt_robust_caching_enabled);
    ParseBoolFlag(flag_pair, "INIT_logging_debug_enabled_for_all", &logging_debug_enabled_for_all);
    ParseBoolFlag(flag_pair, "INIT_btaa_hci", &btaa_hci_log_enabled);
    if ("INIT_logging_debug_enabled_for_tags" == flag_pair[0]) {
      auto tags = StringSplit(flag_pair[1], ",");
      for (const auto& tag : tags) {
@@ -89,23 +70,6 @@ void InitFlags::Load(const char** flags) {
    flags++;
  }

  if (gd_core_enabled && !gd_security_enabled) {
    gd_security_enabled = true;
  }
  if (gd_security_enabled && !gd_acl_enabled) {
    gd_acl_enabled = true;
  }
  if (gd_acl_enabled && !gd_controller_enabled) {
    gd_controller_enabled = true;
  }
  if (gd_l2cap_enabled) {
    gd_acl_enabled = false;
    gd_hci_enabled = true;
  }
  if (gd_controller_enabled && !gd_hci_enabled) {
    gd_hci_enabled = true;
  }

  std::vector<std::string> logging_debug_enabled_tags;
  std::vector<std::string> logging_debug_disabled_tags;
  for (const auto& tag_setting : logging_debug_explicit_tag_settings) {
@@ -116,35 +80,21 @@ void InitFlags::Load(const char** flags) {
    }
  }

  LOG_INFO(
      "Flags loaded: gd_advertising_enabled=%s, gd_security_enabled=%s, gd_acl_enabled=%s, gd_hci_enabled=%s, "
      "gd_controller_enabled=%s, gd_core_enabled=%s, logging_debug_enabled_for_all=%s, "
      "logging_debug_enabled_tags=%s, logging_debug_disabled_tags=%s, btaa_hci_log_enabled=%s",
      ToString(gd_advertising_enabled).c_str(),
      ToString(gd_security_enabled).c_str(),
      ToString(gd_acl_enabled).c_str(),
      ToString(gd_hci_enabled).c_str(),
      ToString(gd_controller_enabled).c_str(),
      ToString(gd_core_enabled).c_str(),
      ToString(logging_debug_enabled_for_all).c_str(),
      StringJoin(logging_debug_enabled_tags, ",").c_str(),
      StringJoin(logging_debug_disabled_tags, ",").c_str(),
      ToString(btaa_hci_log_enabled).c_str());
  rust::Vec<rust::String> rusted_flags = rust::Vec<rust::String>();
  while (flags != nullptr && *flags != nullptr) {
    rusted_flags.push_back(rust::String(*flags));
    flags++;
  }
  init_flags::load(std::move(rusted_flags));
}

void InitFlags::SetAll(bool value) {
  gd_core_enabled = value;
  gd_advertising_enabled = value;
  gd_acl_enabled = value;
  gd_security_enabled = value;
  gd_controller_enabled = value;
  gd_hci_enabled = value;
  gatt_robust_caching_enabled = value;
  logging_debug_enabled_for_all = value;
  logging_debug_explicit_tag_settings.clear();
}

void InitFlags::SetAllForTesting() {
  init_flags::set_all_for_testing();
  SetAll(true);
}

Loading