L2CA_SetFlushTimeout does nothing.

Since LinkFlushTimeout is always 0 and we always set it to 0.

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Ia6a87f45f59b4bb429aba98f921785b3e9e0d309
diff --git a/system/bta/av/bta_av_aact.cc b/system/bta/av/bta_av_aact.cc
index 9fe09ef..59c4e48 100644
--- a/system/bta/av/bta_av_aact.cc
+++ b/system/bta/av/bta_av_aact.cc
@@ -1882,7 +1882,6 @@
     p_scb->co_started = false;
 
     p_scb->p_cos->stop(p_scb->hndl, p_scb->PeerAddress());
-    L2CA_SetFlushTimeout(p_scb->PeerAddress(), L2CAP_NO_AUTOMATIC_FLUSH);
   }
 
   /* if q_info.a2dp_list is not empty, drop it now */
@@ -2272,9 +2271,7 @@
      * to be changed
      */
     p_scb->co_started = bta_av_cb.audio_open_cnt;
-  } else {
   }
-  L2CA_SetFlushTimeout(p_scb->PeerAddress(), 0);
 
   /* clear the congestion flag */
   p_scb->cong = false;
@@ -2513,7 +2510,6 @@
       p_scb->co_started = false;
       p_scb->p_cos->stop(p_scb->hndl, p_scb->PeerAddress());
     }
-    L2CA_SetFlushTimeout(p_scb->PeerAddress(), L2CAP_NO_AUTOMATIC_FLUSH);
   }
 
   {
@@ -2874,7 +2870,6 @@
           // May need to update the flush timeout of this already started stream
           if (p_scbi->co_started != bta_av_cb.audio_open_cnt) {
             p_scbi->co_started = bta_av_cb.audio_open_cnt;
-            L2CA_SetFlushTimeout(p_scbi->PeerAddress(), 0);
           }
         }
       }
diff --git a/system/bta/av/bta_av_act.cc b/system/bta/av/bta_av_act.cc
index 11b66eb..846fc3c 100644
--- a/system/bta/av/bta_av_act.cc
+++ b/system/bta/av/bta_av_act.cc
@@ -1280,7 +1280,6 @@
            */
           if (p_scbi->co_started != bta_av_cb.audio_open_cnt) {
             p_scbi->co_started = bta_av_cb.audio_open_cnt;
-            L2CA_SetFlushTimeout(p_scbi->PeerAddress(), 0);
           }
         }
       }
diff --git a/system/bta/av/bta_av_main.cc b/system/bta/av/bta_av_main.cc
index e043b02..0103f10 100644
--- a/system/bta/av/bta_av_main.cc
+++ b/system/bta/av/bta_av_main.cc
@@ -756,7 +756,6 @@
         // May need to update the flush timeout of this already started stream
         if (p_scbi->co_started != bta_av_cb.audio_open_cnt) {
           p_scbi->co_started = bta_av_cb.audio_open_cnt;
-          L2CA_SetFlushTimeout(p_scbi->PeerAddress(), 0);
         }
       }
     }
diff --git a/system/stack/include/l2c_api.h b/system/stack/include/l2c_api.h
index 98c0524..9bd2b36 100644
--- a/system/stack/include/l2c_api.h
+++ b/system/stack/include/l2c_api.h
@@ -545,33 +545,6 @@
 
 /*******************************************************************************
  *
- * Function         L2CA_SetFlushTimeout
- *
- * Description      This function set the automatic flush time out in Baseband
- *                  for ACL-U packets.
- *                  BdAddr : the remote BD address of ACL link. If it is
- *                           BT_DB_ANY then the flush time out will be applied
- *                           to all ACL link.
- *                  FlushTimeout: flush time out in ms
- *                           0x0000 : No automatic flush
- *                           L2CAP_NO_RETRANSMISSION : No retransmission
- *                           0x0002 - 0xFFFE : flush time out, if
- *                                             (flush_tout * 8) + 3 / 5) <=
- *                                             HCI_MAX_AUTOMATIC_FLUSH_TIMEOUT
- *                                             (in 625us slot).
- *                                    Otherwise, return false.
- *                           L2CAP_NO_AUTOMATIC_FLUSH : No automatic flush
- *
- * Returns          true if command succeeded, false if failed
- *
- * NOTE             This flush timeout applies to all logical channels active on
- *                  the ACL link.
- ******************************************************************************/
-extern bool L2CA_SetFlushTimeout(const RawAddress& bd_addr,
-                                 uint16_t flush_tout);
-
-/*******************************************************************************
- *
  * Function         L2CA_SetChnlFlushability
  *
  * Description      Higher layers call this function to set a channels
diff --git a/system/stack/l2cap/l2c_api.cc b/system/stack/l2cap/l2c_api.cc
index 5fbc9eb..cff1b89 100644
--- a/system/stack/l2cap/l2c_api.cc
+++ b/system/stack/l2cap/l2c_api.cc
@@ -868,84 +868,6 @@
 
 /*******************************************************************************
  *
- * Function         L2CA_SetFlushTimeout
- *
- * Description      This function set the automatic flush time out in Baseband
- *                  for ACL-U packets.
- *                  BdAddr : the remote BD address of ACL link. If it is
- *                          BT_DB_ANY then the flush time out will be applied to
- *                          all ACL links.
- *                  FlushTimeout: flush time out in ms
- *                           0x0000 : No automatic flush
- *                           0x0001 : No retransmission
- *                           0x0002 - 0x0500 : flush time out in ms
- *                           0xffff : DEPRECATED No automatic flush (0x0000)
- *                           >0x0500 : Illegal value
- *
- * Returns          true if command succeeded, false if failed
- *
- * NOTE             This flush timeout applies to all logical channels active on
- *                  the ACL link.
- ******************************************************************************/
-constexpr uint32_t ConvertMillisecondsToBasebandSlots(uint32_t milliseconds) {
-  return ((milliseconds * 8) + 3) / 5;
-}
-
-bool L2CA_SetFlushTimeout(const RawAddress& bd_addr,
-                          const uint16_t flush_timeout_in_ms) {
-  if (bluetooth::shim::is_gd_shim_enabled()) {
-    return bluetooth::shim::L2CA_SetFlushTimeout(bd_addr, flush_timeout_in_ms);
-  }
-
-  if (flush_timeout_in_ms == L2CAP_NO_AUTOMATIC_FLUSH) {
-    LOG_WARN(
-        "%s Parameter deprecated for no automatic flush; please use 0x0000",
-        __func__);
-  } else if (ConvertMillisecondsToBasebandSlots(flush_timeout_in_ms) >
-             HCI_MAX_AUTOMATIC_FLUSH_TIMEOUT) {
-    LOG_WARN(
-        "%s Unable to set flush timeout larger then controller capability:%dms",
-        __func__, flush_timeout_in_ms);
-    return false;
-  }
-
-  uint16_t flush_timeout_in_slots = 0;
-
-  /* no automatic flush (infinite timeout) */
-  if (flush_timeout_in_ms == 0x0000 ||
-      flush_timeout_in_ms == L2CAP_NO_AUTOMATIC_FLUSH) {
-    flush_timeout_in_slots = 0x0;
-  }
-
-  if (RawAddress::kAny != bd_addr) {
-    tL2C_LCB* p_lcb = l2cu_find_lcb_by_bd_addr(bd_addr, BT_TRANSPORT_BR_EDR);
-
-    if ((p_lcb) && (p_lcb->in_use) && (p_lcb->link_state == LST_CONNECTED)) {
-      if (p_lcb->LinkFlushTimeout() != flush_timeout_in_ms) {
-        p_lcb->SetLinkFlushTimeout(flush_timeout_in_ms);
-        acl_write_automatic_flush_timeout(bd_addr, flush_timeout_in_slots);
-      }
-    } else {
-      LOG(WARNING) << __func__ << " No lcb for bd_addr " << bd_addr;
-      return false;
-    }
-  } else {
-    tL2C_LCB* p_lcb = &l2cb.lcb_pool[0];
-    for (int xx = 0; xx < MAX_L2CAP_LINKS; xx++, p_lcb++) {
-      if ((p_lcb->in_use) && (p_lcb->link_state == LST_CONNECTED)) {
-        if (p_lcb->LinkFlushTimeout() != flush_timeout_in_ms) {
-          p_lcb->SetLinkFlushTimeout(flush_timeout_in_ms);
-          acl_write_automatic_flush_timeout(p_lcb->remote_bd_addr,
-                                            flush_timeout_in_slots);
-        }
-      }
-    }
-  }
-  return true;
-}
-
-/*******************************************************************************
- *
  *  Function         L2CA_GetPeerFeatures
  *
  *  Description      Get a peers features and fixed channel map