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

Commit 3783c7bf authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Floss: Increase the cleanup timeout on ChromeOS" into main

parents 936cc123 e084f239
Loading
Loading
Loading
Loading
+4 −5
Original line number Original line Diff line number Diff line
@@ -61,15 +61,12 @@
#include "bta/dm/bta_dm_int.h"
#include "bta/dm/bta_dm_int.h"
#include "device/include/interop.h"
#include "device/include/interop.h"
#include "internal_include/stack_config.h"
#include "internal_include/stack_config.h"
#include "os/system_properties.h"
#include "rust/src/core/ffi/module.h"
#include "rust/src/core/ffi/module.h"
#include "stack/btm/btm_ble_int.h"
#include "stack/btm/btm_ble_int.h"
#include "stack/include/ais_api.h"
#include "stack/include/ais_api.h"
#include "stack/include/smp_api.h"
#include "stack/include/smp_api.h"


#ifndef BT_STACK_CLEANUP_WAIT_MS
#define BT_STACK_CLEANUP_WAIT_MS 1000
#endif

// Validate or respond to various conditional compilation flags
// Validate or respond to various conditional compilation flags


// Once BTA_PAN_INCLUDED is no longer exposed via bt_target.h
// Once BTA_PAN_INCLUDED is no longer exposed via bt_target.h
@@ -173,7 +170,9 @@ static void clean_up_stack(ProfileStopCallback stopProfiles) {
  management_thread.DoInThread(
  management_thread.DoInThread(
          FROM_HERE, base::BindOnce(event_clean_up_stack, std::move(promise), stopProfiles));
          FROM_HERE, base::BindOnce(event_clean_up_stack, std::move(promise), stopProfiles));


  auto status = future.wait_for(std::chrono::milliseconds(BT_STACK_CLEANUP_WAIT_MS));
  auto status = future.wait_for(std::chrono::milliseconds(
          bluetooth::os::GetSystemPropertyUint32("bluetooth.cleanup_timeout",
                                                 /* default_value = */ 1000)));
  if (status == std::future_status::ready) {
  if (status == std::future_status::ready) {
    management_thread.ShutDown();
    management_thread.ShutDown();
  } else {
  } else {
+4 −1
Original line number Original line Diff line number Diff line
@@ -29,7 +29,10 @@ std::mutex properties_mutex;
// Properties set along with some default values for Floss.
// Properties set along with some default values for Floss.
std::unordered_map<std::string, std::string> properties = {
std::unordered_map<std::string, std::string> properties = {
        {"bluetooth.profile.avrcp.target.enabled", "true"},
        {"bluetooth.profile.avrcp.target.enabled", "true"},
        {"bluetooth.gd.start_timeout", "12000"}};
        {"bluetooth.gd.start_timeout", "12000"},
        {"bluetooth.gd.stop_timeout", "12000"},
        /* HCI Reset timeout: 10s + Default cleanup timeout: 1s = 11s */
        {"bluetooth.cleanup_timeout", "11000"}};
}  // namespace
}  // namespace


std::optional<std::string> GetSystemProperty(const std::string& property) {
std::optional<std::string> GetSystemProperty(const std::string& property) {
+4 −1
Original line number Original line Diff line number Diff line
@@ -29,7 +29,10 @@ std::mutex properties_mutex;
// Properties set along with some default values for Floss.
// Properties set along with some default values for Floss.
std::unordered_map<std::string, std::string> properties = {
std::unordered_map<std::string, std::string> properties = {
        {"bluetooth.profile.avrcp.target.enabled", "true"},
        {"bluetooth.profile.avrcp.target.enabled", "true"},
        {"bluetooth.gd.start_timeout", "12000"}};
        {"bluetooth.gd.start_timeout", "12000"},
        {"bluetooth.gd.stop_timeout", "12000"},
        /* HCI Reset timeout: 10s + Default cleanup timeout: 1s = 11s */
        {"bluetooth.cleanup_timeout", "11000"}};
}  // namespace
}  // namespace


std::optional<std::string> GetSystemProperty(const std::string& property) {
std::optional<std::string> GetSystemProperty(const std::string& property) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -48,7 +48,7 @@ const ADMIN_SETTINGS_FILE_PATH: &str = "/var/lib/bluetooth/admin_policy.json";
// and BTA_DM_DISABLE_TIMER_RETRIAL_MS
// and BTA_DM_DISABLE_TIMER_RETRIAL_MS
const STACK_TURN_OFF_TIMEOUT_MS: Duration = Duration::from_millis(4000);
const STACK_TURN_OFF_TIMEOUT_MS: Duration = Duration::from_millis(4000);
// Time bt_stack_manager waits for cleanup
// Time bt_stack_manager waits for cleanup
const STACK_CLEANUP_TIMEOUT_MS: Duration = Duration::from_millis(1000);
const STACK_CLEANUP_TIMEOUT_MS: Duration = Duration::from_millis(11000);
// Time bt_stack_manager waits for cleanup profiles
// Time bt_stack_manager waits for cleanup profiles
const STACK_CLEANUP_PROFILES_TIMEOUT_MS: Duration = Duration::from_millis(100);
const STACK_CLEANUP_PROFILES_TIMEOUT_MS: Duration = Duration::from_millis(100);
// Extra time to wait before terminating the process
// Extra time to wait before terminating the process