Simplify set ACL priority VSC
Simplify set ACL priority VSC that BT stack only need to indicate target priority mode.
Bug: 240663154
Test: manully test and check VSC complete event success
Tag: #feature
Ignore-AOSP-First: TM QPR1 Feature
Change-Id: If304e8ab11bf14d79627188aba5ce8d456209af2
diff --git a/system/stack/include/hcidefs.h b/system/stack/include/hcidefs.h
index 2fdc46f..55b3e14 100644
--- a/system/stack/include/hcidefs.h
+++ b/system/stack/include/hcidefs.h
@@ -889,12 +889,9 @@
/* Parameter information for HCI_BRCM_SET_ACL_PRIORITY */
#define HCI_BRCM_ACL_PRIORITY_PARAM_SIZE 3
#define HCI_BRCM_SET_ACL_PRIORITY (0x0057 | HCI_GRP_VENDOR_SPECIFIC)
-#define HCI_BRCM_ACL_HIGH_PRIORITY_TO_NORMAL_PRIORITY 0x00
-#define HCI_BRCM_ACL_NORMAL_PRIORITY_TO_HIGH_PRIORITY 0xFF
-#define HCI_BRCM_ACL_NORMAL_PRIORITY_TO_HIGH_PRIORITY_LOW_LATENCY 0xF3
-#define HCI_BRCM_ACL_HIGH_PRIORITY_LOW_LATENCY_TO_NORMAL_PRIORITY 0xF2
-#define HCI_BRCM_ACL_HIGH_PRIORITY_TO_HIGH_PRIORITY_LOW_LATENCY 0xF1
-#define HCI_BRCM_ACL_HIGH_PRIORITY_LOW_LATENCY_TO_HIGH_PRIORITY 0xF0
+#define HCI_BRCM_ACL_NORMAL_PRIORITY 0x00
+#define HCI_BRCM_ACL_HIGH_PRIORITY 0xFF
+#define HCI_BRCM_ACL_HIGH_PRIORITY_LOW_LATENCY 0xF3
#define LMP_COMPID_GOOGLE 0xE0
diff --git a/system/stack/l2cap/l2c_utils.cc b/system/stack/l2cap/l2c_utils.cc
index 714e6be..6ffd13c 100755
--- a/system/stack/l2cap/l2c_utils.cc
+++ b/system/stack/l2cap/l2c_utils.cc
@@ -2229,28 +2229,20 @@
tL2CAP_PRIORITY priority) {
uint8_t vs_param;
if (priority == L2CAP_PRIORITY_HIGH) {
- // priority normal to high, if using latency mode check preset latency
- LOG_INFO(
- "Set ACL from priority: %d latency: %d to priority: %d latency: %d",
- p_lcb->acl_priority, p_lcb->acl_latency, priority,
- p_lcb->use_latency_mode ? p_lcb->preset_acl_latency
- : L2CAP_LATENCY_NORMAL);
+ // priority to high, if using latency mode check preset latency
if (p_lcb->use_latency_mode &&
p_lcb->preset_acl_latency == L2CAP_LATENCY_LOW) {
- vs_param = HCI_BRCM_ACL_NORMAL_PRIORITY_TO_HIGH_PRIORITY_LOW_LATENCY;
+ LOG_INFO("Set ACL priority: High Priority and Low Latency Mode");
+ vs_param = HCI_BRCM_ACL_HIGH_PRIORITY_LOW_LATENCY;
p_lcb->set_latency(L2CAP_LATENCY_LOW);
} else {
- vs_param = HCI_BRCM_ACL_NORMAL_PRIORITY_TO_HIGH_PRIORITY;
+ LOG_INFO("Set ACL priority: High Priority Mode");
+ vs_param = HCI_BRCM_ACL_HIGH_PRIORITY;
}
} else {
- // priority high to normal, check current latency
- LOG_INFO(
- "Set ACL from priority: %d latency: %d to priority: %d latency: %d",
- p_lcb->acl_priority, p_lcb->acl_latency, priority,
- L2CAP_LATENCY_NORMAL);
- vs_param = p_lcb->is_low_latency()
- ? HCI_BRCM_ACL_HIGH_PRIORITY_LOW_LATENCY_TO_NORMAL_PRIORITY
- : HCI_BRCM_ACL_HIGH_PRIORITY_TO_NORMAL_PRIORITY;
+ // priority to normal
+ LOG_INFO("Set ACL priority: Normal Mode");
+ vs_param = HCI_BRCM_ACL_NORMAL_PRIORITY;
p_lcb->set_latency(L2CAP_LATENCY_NORMAL);
}
@@ -2354,14 +2346,14 @@
******************************************************************************/
static void l2cu_set_acl_latency_brcm(tL2C_LCB* p_lcb, tL2CAP_LATENCY latency) {
- LOG_INFO("Set ACL latency from %d to %d", p_lcb->acl_latency, latency);
+ LOG_INFO("Set ACL latency: %s",
+ latency == L2CAP_LATENCY_LOW ? "Low Latancy" : "Normal Latency");
uint8_t command[HCI_BRCM_ACL_PRIORITY_PARAM_SIZE];
uint8_t* pp = command;
- uint8_t vs_param =
- latency == L2CAP_LATENCY_LOW
- ? HCI_BRCM_ACL_HIGH_PRIORITY_TO_HIGH_PRIORITY_LOW_LATENCY
- : HCI_BRCM_ACL_HIGH_PRIORITY_LOW_LATENCY_TO_HIGH_PRIORITY;
+ uint8_t vs_param = latency == L2CAP_LATENCY_LOW
+ ? HCI_BRCM_ACL_HIGH_PRIORITY_LOW_LATENCY
+ : HCI_BRCM_ACL_HIGH_PRIORITY;
UINT16_TO_STREAM(pp, p_lcb->Handle());
UINT8_TO_STREAM(pp, vs_param);