summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yun-Hao Chung <howardchung@google.com> 2024-08-23 08:25:53 +0000
committer Yun-hao Chung <howardchung@google.com> 2024-08-23 08:46:41 +0000
commit3448185e65873286bc877c81f012cfdd64690f93 (patch)
treedc86b9e99627172ec816c5149e3f886528e45ccf
parent1ef1ee91ff435b3c3cfa5879cf44a73e7e77f866 (diff)
Add sysprop to configure auto flush timeout
Some vendor suggests that auto flushable timeout should be used to mitigate the no NOCP issue. This CL sets the defined auto flush timeout after all remote features are read. Bug: 334752513 Test: mmm packages/modules/Bluetooth Test: manually test Change-Id: Ic0c7b716bd1d294dd2914b44690cd2d19008caeb
-rw-r--r--system/gd/sysprops/sysprops_module.cc1
-rw-r--r--system/stack/acl/btm_acl.cc8
2 files changed, 9 insertions, 0 deletions
diff --git a/system/gd/sysprops/sysprops_module.cc b/system/gd/sysprops/sysprops_module.cc
index 7a69da6906..dfb5bfbc5a 100644
--- a/system/gd/sysprops/sysprops_module.cc
+++ b/system/gd/sysprops/sysprops_module.cc
@@ -92,6 +92,7 @@ void SyspropsModule::parse_config(std::string file_path) {
"bluetooth.core.classic.sniff_min_intervals",
"bluetooth.core.classic.sniff_attempts",
"bluetooth.core.classic.sniff_timeouts",
+ "bluetooth.core.classic.auto_flush_timeout",
// LE
"bluetooth.core.le.min_connection_interval",
"bluetooth.core.le.max_connection_interval",
diff --git a/system/stack/acl/btm_acl.cc b/system/stack/acl/btm_acl.cc
index 4523425538..7bd535c60e 100644
--- a/system/stack/acl/btm_acl.cc
+++ b/system/stack/acl/btm_acl.cc
@@ -85,6 +85,10 @@
#define PROPERTY_LINK_SUPERVISION_TIMEOUT "bluetooth.core.acl.link_supervision_timeout"
#endif
+#ifndef PROPERTY_AUTO_FLUSH_TIMEOUT
+#define PROPERTY_AUTO_FLUSH_TIMEOUT "bluetooth.core.classic.auto_flush_timeout"
+#endif
+
using namespace bluetooth;
using bluetooth::legacy::hci::GetInterface;
@@ -185,6 +189,10 @@ void NotifyAclRoleSwitchComplete(const RawAddress& bda, tHCI_ROLE new_role,
void NotifyAclFeaturesReadComplete(tACL_CONN& p_acl, uint8_t max_page_number) {
btm_process_remote_ext_features(&p_acl, max_page_number);
btm_set_link_policy(&p_acl, btm_cb.acl_cb_.DefaultLinkPolicy());
+ int32_t flush_timeout = osi_property_get_int32(PROPERTY_AUTO_FLUSH_TIMEOUT, 0);
+ if (flush_timeout != 0) {
+ acl_write_automatic_flush_timeout(p_acl.remote_addr, static_cast<uint16_t>(flush_timeout));
+ }
BTA_dm_notify_remote_features_complete(p_acl.remote_addr);
}