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

Commit f08df31f authored by Cheney Ni's avatar Cheney Ni
Browse files

AVDTP: static IOP database for AVDTP SUSPEND

The stack marked a device as AVDTP SUSPEND unsupported if any runtime
failure was detected while suspending. It would keep streaming without
sending a SUSPEND command next time, but caused more issues like SCO
failure. Here is instructing a static IOP database to replace that old
detection, and suppose those issue devices will be fewer day by day.

Bug: 177101308
Tag: #refactor
Test: Add a device to database and check if not sending AVDTP SUSPEND
Change-Id: Id37902be88a285e9809f5bdc766757cb8323f2c2
parent 7430f622
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -1147,6 +1147,7 @@ void bta_av_setconfig_rsp(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
 ******************************************************************************/
void bta_av_str_opened(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
  tBTA_AV_CONN_CHG msg;
  char remote_name[BTM_MAX_REM_BD_NAME_LEN] = "";
  uint8_t* p;

  APPL_TRACE_DEBUG("%s: peer %s bta_handle: 0x%x", __func__,
@@ -1160,6 +1161,15 @@ void bta_av_str_opened(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
  /* set the congestion flag, so AV would not send media packets by accident */
  p_scb->cong = true;
  p_scb->offload_start_pending = false;
  // Don't use AVDTP SUSPEND for restrict listed devices
  btif_storage_get_stored_remote_name(p_scb->PeerAddress(), remote_name);
  if (interop_match_name(INTEROP_DISABLE_AVDTP_SUSPEND, remote_name) ||
      interop_match_addr(INTEROP_DISABLE_AVDTP_SUSPEND,
                         &p_scb->PeerAddress())) {
    LOG_INFO("%s: disable AVDTP SUSPEND: interop matched name %s address %s",
             __func__, remote_name, p_scb->PeerAddress().ToString().c_str());
    p_scb->suspend_sup = false;
  }

  p_scb->stream_mtu =
      p_data->str_msg.msg.open_ind.peer_mtu - AVDT_MEDIA_HDR_SIZE;
@@ -2467,10 +2477,6 @@ void bta_av_suspend_cfm(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {

  suspend_rsp.status = BTA_AV_SUCCESS;
  if (err_code && (err_code != AVDT_ERR_BAD_STATE)) {
    /* Disable suspend feature only with explicit rejection(not with timeout) */
    if (err_code != AVDT_ERR_TIMEOUT) {
      p_scb->suspend_sup = false;
    }
    suspend_rsp.status = BTA_AV_FAIL;

    APPL_TRACE_ERROR("%s: suspend failed, closing connection", __func__);
@@ -2684,11 +2690,6 @@ void bta_av_suspend_cont(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
      bta_av_ssm_execute(p_scb, BTA_AV_STR_DISC_FAIL_EVT, NULL);
    } else {
      APPL_TRACE_ERROR("%s: suspend rejected, try close", __func__);
      /* Disable suspend feature only with explicit rejection(not with timeout)
       */
      if (err_code != AVDT_ERR_TIMEOUT) {
        p_scb->suspend_sup = false;
      }
      /* drop the buffers queued in L2CAP */
      L2CA_FlushChannel(p_scb->l2c_cid, L2CAP_FLUSH_CHANS_ALL);

+5 −1
Original line number Diff line number Diff line
@@ -107,7 +107,11 @@ typedef enum {
  // Disable sniff mode for headsets/car-kits
  // Some car kits supports sniff mode but when DUT initiates sniff req
  // Remote will go to bad state and its leads to LMP time out.
  INTEROP_DISABLE_SNIFF
  INTEROP_DISABLE_SNIFF,

  // Do not send AVDTP SUSPEND while the playback is paused.
  // Some older A2DP Sink devices might not support to pause the streaming.
  INTEROP_DISABLE_AVDTP_SUSPEND
} interop_feature_t;

// Check if a given |addr| matches a known interoperability workaround as
+1 −0
Original line number Diff line number Diff line
@@ -133,6 +133,7 @@ static const char* interop_feature_string_(const interop_feature_t feature) {
    CASE_RETURN_STR(INTEROP_DISABLE_NAME_REQUEST)
    CASE_RETURN_STR(INTEROP_AVRCP_1_4_ONLY)
    CASE_RETURN_STR(INTEROP_DISABLE_SNIFF)
    CASE_RETURN_STR(INTEROP_DISABLE_AVDTP_SUSPEND)
  }

  return "UNKNOWN";