aboutsummaryrefslogtreecommitdiff
path: root/bta
diff options
context:
space:
mode:
authorRahul Sabnis <rahulsabnis@google.com>2021-05-20 15:10:11 -0700
committerRahul Sabnis <rahulsabnis@google.com>2021-06-21 21:27:59 +0000
commit3f67ef52577bfe8cbd14f2f551c5bcff4d3fc4c0 (patch)
tree0bb4ea8e9d028377db44a2c2b31fe4065d549dce /bta
parentf961265751d557af2c4ec64b743c01d762d0e5e6 (diff)
downloadbt-3f67ef52577bfe8cbd14f2f551c5bcff4d3fc4c0.tar.gz
Fix HFP SLC failure due to devices not sending the AT+BIND command
Tag: #feature Bug: 187174892 Test: Manual Ignore-AOSP-First: Resolving merge conflict Change-Id: I7bb95d30005ddd99a0b272df66f43097f45ab707
Diffstat (limited to 'bta')
-rw-r--r--bta/ag/bta_ag_cmd.cc24
-rw-r--r--bta/ag/bta_ag_int.h4
2 files changed, 28 insertions, 0 deletions
diff --git a/bta/ag/bta_ag_cmd.cc b/bta/ag/bta_ag_cmd.cc
index 6cd3a1f4b..0a99eed24 100644
--- a/bta/ag/bta_ag_cmd.cc
+++ b/bta/ag/bta_ag_cmd.cc
@@ -25,6 +25,7 @@
#include "bta/ag/bta_ag_int.h"
#include "bta/include/bta_ag_api.h"
#include "bta/include/utl.h"
+#include "device/include/interop.h"
#include "osi/include/compat.h"
#include "osi/include/log.h"
#include "osi/include/osi.h" // UNUSED_ATTR
@@ -822,6 +823,21 @@ static bool bta_ag_parse_biev_response(tBTA_AG_SCB* p_scb, tBTA_AG_VAL* val) {
/*******************************************************************************
*
+ * Function bta_ag_bind_timer_cback
+ *
+ * Description Handles bind timer callback
+ *
+ *
+ * Returns void
+ *
+ ******************************************************************************/
+static void bta_ag_bind_timer_cback(void* data) {
+ tBTA_AG_SCB* p_scb = (tBTA_AG_SCB*)data;
+ bta_ag_svc_conn_open(p_scb, tBTA_AG_DATA::kEmpty);
+}
+
+/*******************************************************************************
+ *
* Function bta_ag_at_hfp_cback
*
* Description AT command processing callback for HFP.
@@ -966,6 +982,13 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB* p_scb, uint16_t cmd, uint8_t arg_type,
!((p_scb->features & BTA_AG_FEAT_HF_IND) &&
(p_scb->peer_features & BTA_AG_PEER_FEAT_HF_IND))) {
bta_ag_svc_conn_open(p_scb, tBTA_AG_DATA::kEmpty);
+ } else {
+ if (p_scb->peer_version >= HFP_VERSION_1_7 &&
+ interop_match_addr(INTEROP_SLC_SKIP_BIND_COMMAND,
+ &p_scb->peer_addr)) {
+ alarm_set_on_mloop(p_scb->bind_timer, BTA_AG_BIND_TIMEOUT_MS,
+ bta_ag_bind_timer_cback, p_scb);
+ }
}
} else {
val.idx = bta_ag_parse_chld(p_scb, val.str);
@@ -1008,6 +1031,7 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB* p_scb, uint16_t cmd, uint8_t arg_type,
case BTA_AG_AT_BIND_EVT:
APPL_TRACE_DEBUG("%s BTA_AG_AT_BIND_EVT arg_type: %d", __func__,
arg_type);
+ alarm_cancel(p_scb->bind_timer);
if (arg_type == BTA_AG_AT_SET) {
if (bta_ag_parse_bind_set(p_scb, val)) {
bta_ag_send_ok(p_scb);
diff --git a/bta/ag/bta_ag_int.h b/bta/ag/bta_ag_int.h
index 6640808ef..8d0db7f64 100644
--- a/bta/ag/bta_ag_int.h
+++ b/bta/ag/bta_ag_int.h
@@ -59,6 +59,9 @@
(BTA_AG_FEAT_3WAY | BTA_AG_FEAT_ECNR | BTA_AG_FEAT_VREC | \
BTA_AG_FEAT_INBAND | BTA_AG_FEAT_VTAG)
+/* Timeout for alarm in 2018 toyota camry carkit workaround */
+#define BTA_AG_BIND_TIMEOUT_MS 500
+
enum {
/* these events are handled by the state machine */
BTA_AG_API_REGISTER_EVT = BTA_SYS_EVT_START(BTA_ID_AG),
@@ -230,6 +233,7 @@ struct tBTA_AG_SCB {
uint8_t battchg_ind; /* CIEV battery charge indicator value */
uint8_t callheld_ind; /* CIEV call held indicator value */
uint32_t bia_masked_out; /* indicators HF does not want us to send */
+ alarm_t* bind_timer; /* Timer for toyota camry 2018 carkit workaround */
alarm_t* collision_timer;
alarm_t* ring_timer;
alarm_t* codec_negotiation_timer;