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

Commit 3678d948 authored by Sridhar Vashist's avatar Sridhar Vashist Committed by Zach Johnson
Browse files

DO NOT MERGE ANYWHERE Disable 3Mbps packets for AVDT ACL links.

3DH packets have a lower tolerance to background noise. A2DP requiring higher
bandwidth & realtime playback is especially suscepitble in this scenario.

Bug: 37515006
Test: oem manual
Change-Id: Id4d7452a86fe864eceb88a9fb16a40dc921a1e13
parent e3e2dd33
Loading
Loading
Loading
Loading
+1 −10
Original line number Diff line number Diff line
@@ -54,16 +54,7 @@ typedef enum {
  // Keyboards should use a variable pin at all times. However, some keyboards
  // require a fixed pin of all 0000. This workaround enables auto pairing for
  // those keyboards.
  INTEROP_KEYBOARD_REQUIRES_FIXED_PIN,

  // Some headsets have audio jitter issues because of increased re-transmissions as the
  // 3 Mbps packets have a lower link margin, and are more prone to interference. We can
  // disable 3DH packets (use only 2DH packets) for the ACL link to improve sensitivity
  // when streaming A2DP audio to the headset. Air sniffer logs show reduced
  // re-transmissions after switching to 2DH packets.
  //
  // Disable 3Mbps packets and use only 2Mbps packets for ACL links when streaming audio.
  INTEROP_2MBPS_LINK_ONLY
  INTEROP_KEYBOARD_REQUIRES_FIXED_PIN
} interop_feature_t;

// Check if a given |addr| matches a known interoperability workaround as identified
+0 −3
Original line number Diff line number Diff line
@@ -55,9 +55,6 @@ static const interop_addr_entry_t interop_addr_database[] = {
  {{{0x44, 0x5e, 0xf3,      0,0,0}}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
  {{{0xd4, 0x9c, 0x28,      0,0,0}}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},

  // JayBird Family
  {{{0x00, 0x18, 0x91,      0,0,0}}, 3, INTEROP_2MBPS_LINK_ONLY},

  // LG Tone HBS-730 - unacceptably loud volume
  {{{0x00, 0x18, 0x6b,      0,0,0}}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
  {{{0xb8, 0xad, 0x3e,      0,0,0}}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
+0 −1
Original line number Diff line number Diff line
@@ -114,7 +114,6 @@ static const char* interop_feature_string_(const interop_feature_t feature) {
    CASE_RETURN_STR(INTEROP_DISABLE_ABSOLUTE_VOLUME)
    CASE_RETURN_STR(INTEROP_DISABLE_AUTO_PAIRING)
    CASE_RETURN_STR(INTEROP_KEYBOARD_REQUIRES_FIXED_PIN)
    CASE_RETURN_STR(INTEROP_2MBPS_LINK_ONLY)
  }

  return "UNKNOWN";
+13 −17
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@
#include "l2cdefs.h"
#include "btm_api.h"
#include "btm_int.h"
#include "device/include/interop.h"


/* callback function declarations */
void avdt_l2c_connect_ind_cback(BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8 id);
@@ -202,14 +202,12 @@ void avdt_l2c_connect_ind_cback(BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8
            p_tbl->state = AVDT_AD_ST_SEC_ACP;
            p_tbl->cfg_flags = AVDT_L2C_CFG_CONN_ACP;

            if (interop_match_addr(INTEROP_2MBPS_LINK_ONLY, (const bt_bdaddr_t *)&bd_addr)) {
            // Disable 3DH packets for AVDT ACL to improve sensitivity on HS
            tACL_CONN *p_acl_cb = btm_bda_to_acl(bd_addr, BT_TRANSPORT_BR_EDR);
            btm_set_packet_types(p_acl_cb, (btm_cb.btm_acl_pkt_types_supported |
                                            HCI_PKT_TYPES_MASK_NO_3_DH1 |
                                            HCI_PKT_TYPES_MASK_NO_3_DH3 |
                                            HCI_PKT_TYPES_MASK_NO_3_DH5));
            }

            /* Check the security */
            rc = btm_sec_mx_access_request (bd_addr, AVDT_PSM,
@@ -330,14 +328,12 @@ void avdt_l2c_connect_cfm_cback(UINT16 lcid, UINT16 result)
                        p_tbl->lcid = lcid;
                        p_tbl->cfg_flags = AVDT_L2C_CFG_CONN_INT;

                        if (interop_match_addr(INTEROP_2MBPS_LINK_ONLY, (const bt_bdaddr_t *) &p_ccb->peer_addr)) {
                        // Disable 3DH packets for AVDT ACL to improve sensitivity on HS
                        tACL_CONN *p_acl_cb = btm_bda_to_acl(p_ccb->peer_addr, BT_TRANSPORT_BR_EDR);
                        btm_set_packet_types(p_acl_cb, (btm_cb.btm_acl_pkt_types_supported |
                                                        HCI_PKT_TYPES_MASK_NO_3_DH1 |
                                                        HCI_PKT_TYPES_MASK_NO_3_DH3 |
                                                        HCI_PKT_TYPES_MASK_NO_3_DH5));
                        }

                        /* Check the security */
                        btm_sec_mx_access_request (p_ccb->peer_addr, AVDT_PSM,