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

Commit eaf511ac authored by Hsin-chen Chuang's avatar Hsin-chen Chuang Committed by Gerrit Code Review
Browse files

Merge "floss: Complete libflags shim" into main

parents bca73a21 99ec7396
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -16,11 +16,15 @@

#include "server_configurable_flags/get_flags.h"

#include "gd/os/system_properties.h"

namespace server_configurable_flags {

std::string GetServerConfigurableFlag(
    const std::string& experiment_category_name,
    const std::string& experiment_flag_name, const std::string& default_value) {
  return default_value;
  std::string prop_name = "persist.device_config." + experiment_category_name +
                          "." + experiment_flag_name;
  return bluetooth::os::GetSystemProperty(prop_name).value_or(default_value);
}
}  // namespace server_configurable_flags
+1 −0
Original line number Diff line number Diff line
@@ -428,6 +428,7 @@ cc_test {
            srcs: [
                ":BluetoothHalTestSources_hci_host",
                ":BluetoothOsTestSources_host",
                ":BluetoothSyspropsUnitTestSources",
            ],
        },
        android: {
+8 −1
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ std::mutex parameter_mutex;
std::string config_file_path;
std::string snoop_log_file_path;
std::string snooz_log_file_path;
std::string sysprops_file_path;
}  // namespace

// Write to $PWD/bt_stack.conf if $PWD can be found, otherwise, write to $HOME/bt_stack.conf
@@ -104,7 +105,13 @@ void ParameterProvider::OverrideSnoozLogFilePath(const std::string& path) {
}

std::string ParameterProvider::SyspropsFilePath() {
  return "";
  std::lock_guard<std::mutex> lock(parameter_mutex);
  return sysprops_file_path;
}

void ParameterProvider::OverrideSyspropsFilePath(const std::string& path) {
  std::lock_guard<std::mutex> lock(parameter_mutex);
  sysprops_file_path = path;
}

bluetooth_keystore::BluetoothKeystoreInterface* ParameterProvider::GetBtKeystoreInterface() {
+26 −0
Original line number Diff line number Diff line
@@ -418,6 +418,32 @@ std::vector<ConfigCache::SectionAndPropertyValue> ConfigCache::GetSectionNamesWi
  return result;
}

std::vector<std::string> ConfigCache::GetPropertyNames(const std::string& section) const {
  std::lock_guard<std::recursive_mutex> lock(mutex_);

  std::vector<std::string> property_names;
  auto ProcessSections = [&](const auto& sections) {
    auto section_iter = sections.find(section);
    if (section_iter != sections.end()) {
      for (const auto& [property_name, value] : section_iter->second) {
        property_names.emplace_back(property_name);
      }
      return true;
    }
    return false;
  };

  // A section must exist in at most one map.
  if (ProcessSections(information_sections_)) {
    return property_names;
  }
  if (ProcessSections(persistent_devices_)) {
    return property_names;
  }
  ProcessSections(temporary_devices_);
  return property_names;
}

namespace {

bool FixDeviceTypeInconsistencyInSection(
+2 −0
Original line number Diff line number Diff line
@@ -96,6 +96,8 @@ class ConfigCache {
    }
  };
  virtual std::vector<SectionAndPropertyValue> GetSectionNamesWithProperty(const std::string& property) const;
  // Returns all property names in the specific section.
  virtual std::vector<std::string> GetPropertyNames(const std::string& section) const;

  // modifiers
  // Commit all mutation entries in sequence while holding the config mutex
Loading