Loading system/gd/hal/snoop_logger.cc +4 −5 Original line number Diff line number Diff line Loading @@ -447,9 +447,8 @@ size_t SnoopLogger::GetMaxPacketsPerFile() { size_t SnoopLogger::GetMaxPacketsPerBuffer() { // We want to use at most 256 KB memory for btsnooz log for release builds // and 512 KB memory for userdebug/eng builds auto is_debuggable = os::GetSystemProperty(kIsDebuggableProperty); size_t btsnooz_max_memory_usage_bytes = ((is_debuggable.has_value() && common::StringTrim(is_debuggable.value()) == "1") ? 1024 : 256) * 1024; auto is_debuggable = os::GetSystemPropertyBool(kIsDebuggableProperty, false); size_t btsnooz_max_memory_usage_bytes = (is_debuggable ? 1024 : 256) * 1024; // Calculate max number of packets based on max memory usage and max packet size return btsnooz_max_memory_usage_bytes / kDefaultBtSnoozMaxBytesPerPacket; } Loading @@ -459,8 +458,8 @@ std::string SnoopLogger::GetBtSnoopMode() { // In userdebug/eng build, it can also be overwritten by modifying the global setting std::string default_mode = kBtSnoopLogModeDisabled; { auto is_debuggable = os::GetSystemProperty(kIsDebuggableProperty); if (is_debuggable.has_value() && common::StringTrim(is_debuggable.value()) == "1") { auto is_debuggable = os::GetSystemPropertyBool(kIsDebuggableProperty, false); if (is_debuggable) { auto default_mode_property = os::GetSystemProperty(kBtSnoopDefaultLogModeProperty); if (default_mode_property) { default_mode = std::move(default_mode_property.value()); Loading system/gd/os/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ filegroup { filegroup { name: "BluetoothOsSources_android", srcs: [ "system_properties_common.cc", "android/metrics.cc", "android/parameter_provider.cc", "android/system_properties.cc", Loading @@ -35,6 +36,7 @@ filegroup { filegroup { name: "BluetoothOsSources_host", srcs: [ "system_properties_common.cc", "host/metrics.cc", "host/parameter_provider.cc", "host/system_properties.cc", Loading system/gd/os/BUILD.gn +1 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ source_set("BluetoothOsSources_linux") { "linux/parameter_provider.cc", "linux/system_properties.cc", "linux/wakelock_native.cc", "system_properties_common.cc", "syslog.cc", ] Loading system/gd/os/android/system_properties.cc +0 −9 Original line number Diff line number Diff line Loading @@ -36,15 +36,6 @@ std::optional<std::string> GetSystemProperty(const std::string& property) { return std::string(value_array.data(), value_len); } uint32_t GetSystemPropertyUint32(const std::string& property, uint32_t default_value) { std::optional<std::string> result = GetSystemProperty(property); if (result) { return static_cast<uint32_t>(std::stoul(*result)); } else { return default_value; } } bool SetSystemProperty(const std::string& property, const std::string& value) { if (value.size() >= PROPERTY_VALUE_MAX) { LOG_ERROR("Property value's maximum size is %d, but %zu chars were given", PROPERTY_VALUE_MAX - 1, value.size()); Loading system/gd/os/host/system_properties.cc +0 −9 Original line number Diff line number Diff line Loading @@ -37,15 +37,6 @@ std::optional<std::string> GetSystemProperty(const std::string& property) { return iter->second; } uint32_t GetSystemPropertyUint32(const std::string& property, uint32_t default_value) { std::optional<std::string> result = GetSystemProperty(property); if (result) { return static_cast<uint32_t>(std::stoul(*result)); } else { return default_value; } } bool SetSystemProperty(const std::string& property, const std::string& value) { std::lock_guard<std::mutex> lock(properties_mutex); properties.insert_or_assign(property, value); Loading Loading
system/gd/hal/snoop_logger.cc +4 −5 Original line number Diff line number Diff line Loading @@ -447,9 +447,8 @@ size_t SnoopLogger::GetMaxPacketsPerFile() { size_t SnoopLogger::GetMaxPacketsPerBuffer() { // We want to use at most 256 KB memory for btsnooz log for release builds // and 512 KB memory for userdebug/eng builds auto is_debuggable = os::GetSystemProperty(kIsDebuggableProperty); size_t btsnooz_max_memory_usage_bytes = ((is_debuggable.has_value() && common::StringTrim(is_debuggable.value()) == "1") ? 1024 : 256) * 1024; auto is_debuggable = os::GetSystemPropertyBool(kIsDebuggableProperty, false); size_t btsnooz_max_memory_usage_bytes = (is_debuggable ? 1024 : 256) * 1024; // Calculate max number of packets based on max memory usage and max packet size return btsnooz_max_memory_usage_bytes / kDefaultBtSnoozMaxBytesPerPacket; } Loading @@ -459,8 +458,8 @@ std::string SnoopLogger::GetBtSnoopMode() { // In userdebug/eng build, it can also be overwritten by modifying the global setting std::string default_mode = kBtSnoopLogModeDisabled; { auto is_debuggable = os::GetSystemProperty(kIsDebuggableProperty); if (is_debuggable.has_value() && common::StringTrim(is_debuggable.value()) == "1") { auto is_debuggable = os::GetSystemPropertyBool(kIsDebuggableProperty, false); if (is_debuggable) { auto default_mode_property = os::GetSystemProperty(kBtSnoopDefaultLogModeProperty); if (default_mode_property) { default_mode = std::move(default_mode_property.value()); Loading
system/gd/os/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ filegroup { filegroup { name: "BluetoothOsSources_android", srcs: [ "system_properties_common.cc", "android/metrics.cc", "android/parameter_provider.cc", "android/system_properties.cc", Loading @@ -35,6 +36,7 @@ filegroup { filegroup { name: "BluetoothOsSources_host", srcs: [ "system_properties_common.cc", "host/metrics.cc", "host/parameter_provider.cc", "host/system_properties.cc", Loading
system/gd/os/BUILD.gn +1 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ source_set("BluetoothOsSources_linux") { "linux/parameter_provider.cc", "linux/system_properties.cc", "linux/wakelock_native.cc", "system_properties_common.cc", "syslog.cc", ] Loading
system/gd/os/android/system_properties.cc +0 −9 Original line number Diff line number Diff line Loading @@ -36,15 +36,6 @@ std::optional<std::string> GetSystemProperty(const std::string& property) { return std::string(value_array.data(), value_len); } uint32_t GetSystemPropertyUint32(const std::string& property, uint32_t default_value) { std::optional<std::string> result = GetSystemProperty(property); if (result) { return static_cast<uint32_t>(std::stoul(*result)); } else { return default_value; } } bool SetSystemProperty(const std::string& property, const std::string& value) { if (value.size() >= PROPERTY_VALUE_MAX) { LOG_ERROR("Property value's maximum size is %d, but %zu chars were given", PROPERTY_VALUE_MAX - 1, value.size()); Loading
system/gd/os/host/system_properties.cc +0 −9 Original line number Diff line number Diff line Loading @@ -37,15 +37,6 @@ std::optional<std::string> GetSystemProperty(const std::string& property) { return iter->second; } uint32_t GetSystemPropertyUint32(const std::string& property, uint32_t default_value) { std::optional<std::string> result = GetSystemProperty(property); if (result) { return static_cast<uint32_t>(std::stoul(*result)); } else { return default_value; } } bool SetSystemProperty(const std::string& property, const std::string& value) { std::lock_guard<std::mutex> lock(properties_mutex); properties.insert_or_assign(property, value); Loading