OSDN Git Service

Remove def bta/dm/BTM_SSR_INCLUDED
authorChris Manton <cmanton@google.com>
Tue, 25 Aug 2020 19:24:08 +0000 (12:24 -0700)
committerChris Manton <cmanton@google.com>
Tue, 25 Aug 2020 21:18:14 +0000 (14:18 -0700)
Towards readability

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I860b744c5a1f6e413bdeb30b176a51a39ed876ab

bta/dm/bta_dm_cfg.cc
bta/dm/bta_dm_int.h
bta/dm/bta_dm_pm.cc

index 345b044..8001cad 100644 (file)
@@ -149,9 +149,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_CFG
 tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
     /* AG : 0 */
     {(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */
-#if (BTM_SSR_INCLUDED == TRUE)
      (BTA_DM_PM_SSR2), /* the SSR entry */
-#endif
      {
          {{BTA_DM_PM_SNIFF_A2DP_IDX, 7000},
           {BTA_DM_PM_NO_ACTION, 0}}, /* conn open sniff  */
@@ -171,9 +169,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
 
     /* CT, CG : 1 */
     {(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */
-#if (BTM_SSR_INCLUDED == TRUE)
      (BTA_DM_PM_SSR2), /* the SSR entry */
-#endif
      {
          {{BTA_DM_PM_PARK, 5000},
           {BTA_DM_PM_NO_ACTION, 0}}, /* conn open  park */
@@ -192,9 +188,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
 
     /* DG, PBC : 2 */
     {(BTA_DM_PM_ACTIVE), /* no power saving mode allowed */
-#if (BTM_SSR_INCLUDED == TRUE)
      (BTA_DM_PM_SSR2), /* the SSR entry */
-#endif
      {
          {{BTA_DM_PM_SNIFF, 5000},
           {BTA_DM_PM_NO_ACTION, 0}}, /* conn open active */
@@ -211,9 +205,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
 
     /* HD : 3 */
     {(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */
-#if (BTM_SSR_INCLUDED == TRUE)
      (BTA_DM_PM_SSR3), /* the SSR entry */
-#endif
      {
          {{BTA_DM_PM_SNIFF_HD_ACTIVE_IDX, 5000},
           {BTA_DM_PM_NO_ACTION, 0}}, /* conn open sniff */
@@ -232,9 +224,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
 
     /* AV : 4 */
     {(BTA_DM_PM_SNIFF), /* allow sniff */
-#if (BTM_SSR_INCLUDED == TRUE)
      (BTA_DM_PM_SSR2), /* the SSR entry */
-#endif
      {
          {{BTA_DM_PM_SNIFF_A2DP_IDX, 7000},
           {BTA_DM_PM_NO_ACTION, 0}}, /* conn open  sniff */
@@ -252,9 +242,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
 
     /* HH for joysticks and gamepad : 5 */
     {(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */
-#if (BTM_SSR_INCLUDED == TRUE)
      (BTA_DM_PM_SSR1), /* the SSR entry */
-#endif
      {
          {{BTA_DM_PM_SNIFF6, BTA_DM_PM_HH_OPEN_DELAY},
           {BTA_DM_PM_NO_ACTION, 0}}, /* conn open  sniff */
@@ -274,9 +262,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
 
     /* HH : 6 */
     {(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */
-#if (BTM_SSR_INCLUDED == TRUE)
      (BTA_DM_PM_SSR1), /* the SSR entry */
-#endif
      {
          {{BTA_DM_PM_SNIFF_HH_OPEN_IDX, BTA_DM_PM_HH_OPEN_DELAY},
           {BTA_DM_PM_NO_ACTION, 0}}, /* conn open  sniff */
@@ -296,9 +282,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
 
     /* FTC, OPC, JV : 7 */
     {(BTA_DM_PM_SNIFF), /* allow sniff */
-#if (BTM_SSR_INCLUDED == TRUE)
      (BTA_DM_PM_SSR2), /* the SSR entry */
-#endif
      {
          {{BTA_DM_PM_ACTIVE, 0},
           {BTA_DM_PM_NO_ACTION, 0}}, /* conn open  active */
@@ -316,9 +300,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
 
     /* FTS, PBS, OPS, MSE, BTA_JV_PM_ID_1 : 8 */
     {(BTA_DM_PM_SNIFF), /* allow sniff */
-#if (BTM_SSR_INCLUDED == TRUE)
      (BTA_DM_PM_SSR2), /* the SSR entry */
-#endif
      {
          {{BTA_DM_PM_ACTIVE, 0},
           {BTA_DM_PM_NO_ACTION, 0}}, /* conn open  active */
@@ -336,9 +318,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
 
     /* HL : 9 */
     {(BTA_DM_PM_SNIFF), /* allow sniff */
-#if (BTM_SSR_INCLUDED == TRUE)
      (BTA_DM_PM_SSR2), /* the SSR entry */
-#endif
      {
          {{BTA_DM_PM_SNIFF_A2DP_IDX, 5000},
           {BTA_DM_PM_NO_ACTION, 0}}, /* conn open sniff  */
@@ -357,9 +337,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
 
     /* PANU : 10 */
     {(BTA_DM_PM_SNIFF), /* allow sniff */
-#if (BTM_SSR_INCLUDED == TRUE)
      (BTA_DM_PM_SSR2), /* the SSR entry */
-#endif
      {
          {{BTA_DM_PM_ACTIVE, 0},
           {BTA_DM_PM_NO_ACTION, 0}}, /* conn open  active */
@@ -377,9 +355,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
 
     /* NAP : 11 */
     {(BTA_DM_PM_SNIFF), /* allow sniff */
-#if (BTM_SSR_INCLUDED == TRUE)
      (BTA_DM_PM_SSR2), /* the SSR entry */
-#endif
      {
          {{BTA_DM_PM_ACTIVE, 0},
           {BTA_DM_PM_NO_ACTION, 0}}, /* conn open  active */
@@ -398,9 +374,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
 
     /* HS : 12 */
     {(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */
-#if (BTM_SSR_INCLUDED == TRUE)
      (BTA_DM_PM_SSR2), /* the SSR entry */
-#endif
      {
          {{BTA_DM_PM_SNIFF, 7000},
           {BTA_DM_PM_NO_ACTION, 0}}, /* conn open sniff  */
@@ -419,9 +393,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
 
     /* AVK : 13 */
     {(BTA_DM_PM_SNIFF), /* allow sniff */
-#if (BTM_SSR_INCLUDED == TRUE)
      (BTA_DM_PM_SSR2), /* the SSR entry */
-#endif
      {
          {{BTA_DM_PM_SNIFF, 3000},
           {BTA_DM_PM_NO_ACTION, 0}}, /* conn open  sniff */
@@ -439,9 +411,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
     /* GATTC : 14 */
     ,
     {(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */
-#if (BTM_SSR_INCLUDED == TRUE)
      (BTA_DM_PM_SSR2), /* the SSR entry */
-#endif
      {
          {{BTA_DM_PM_SNIFF_A2DP_IDX, 10000},
           {BTA_DM_PM_NO_ACTION, 0}}, /* conn open  active */
@@ -459,9 +429,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
     /* GATTS : 15 */
     ,
     {(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */
-#if (BTM_SSR_INCLUDED == TRUE)
      (BTA_DM_PM_SSR2), /* the SSR entry */
-#endif
      {
          {{BTA_DM_PM_NO_PREF, 0},
           {BTA_DM_PM_NO_ACTION, 0}}, /* conn open  active */
@@ -569,7 +537,6 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTM_PM_PWR_MD bta_dm_pm_md[] = {
 /* the smaller of the SSR max latency wins.
  * the entries in this table must be from highest latency (biggest interval) to
  * lowest latency */
-#if (BTM_SSR_INCLUDED == TRUE)
 tBTA_DM_SSR_SPEC bta_dm_ssr_spec[] = {
     /*max_lat, min_rmt_to, min_loc_to*/
     {0, 0, 0}, /* BTA_DM_PM_SSR0 - do not use SSR */
@@ -583,7 +550,6 @@ tBTA_DM_SSR_SPEC bta_dm_ssr_spec[] = {
 };
 
 tBTA_DM_SSR_SPEC* p_bta_dm_ssr_spec = &bta_dm_ssr_spec[0];
-#endif
 
 const tBTA_DM_PM_CFG* p_bta_dm_pm_cfg = &bta_dm_pm_cfg[0];
 const tBTA_DM_PM_SPEC* p_bta_dm_pm_spec = &bta_dm_pm_spec[0];
index 80b26cc..626d9a8 100644 (file)
@@ -188,9 +188,7 @@ typedef struct {
   bool in_use;
   tBTA_DM_DEV_INFO info;
   tBTA_DM_ENCRYPT_CBACK* p_encrypt_cback;
-#if (BTM_SSR_INCLUDED == TRUE)
   tBTM_PM_STATUS prev_low; /* previous low power mode used */
-#endif
   tBTA_DM_PM_ACTION pm_mode_attempted;
   tBTA_DM_PM_ACTION pm_mode_failed;
   bool remove_dev_pending;
@@ -376,9 +374,7 @@ typedef struct {
 
 typedef struct {
   uint8_t allow_mask; /* mask of sniff/hold/park modes to allow */
-#if (BTM_SSR_INCLUDED == TRUE)
   uint8_t ssr; /* set SSR on conn open/unpark */
-#endif
   tBTA_DM_PM_ACTN actn_tbl[BTA_DM_PM_NUM_EVTS][2];
 
 } tBTA_DM_PM_SPEC;
@@ -400,9 +396,7 @@ extern const uint16_t bta_service_id_to_uuid_lkup_tbl[];
 extern const tBTA_DM_PM_CFG* p_bta_dm_pm_cfg;
 extern const tBTA_DM_PM_SPEC* p_bta_dm_pm_spec;
 extern const tBTM_PM_PWR_MD* p_bta_dm_pm_md;
-#if (BTM_SSR_INCLUDED == TRUE)
 extern tBTA_DM_SSR_SPEC* p_bta_dm_ssr_spec;
-#endif
 
 /* update dynamic BRCM Aware EIR data */
 extern const tBTA_DM_EIR_CONF bta_dm_eir_cfg;
index 5f94c82..582e9f9 100644 (file)
@@ -51,14 +51,11 @@ static void bta_dm_pm_btm_cback(const RawAddress& bd_addr,
 static bool bta_dm_pm_park(const RawAddress& peer_addr);
 static void bta_dm_pm_sniff(tBTA_DM_PEER_DEVICE* p_peer_dev, uint8_t index);
 static bool bta_dm_pm_is_sco_active();
-#if (BTM_SSR_INCLUDED == TRUE)
 static int bta_dm_get_sco_index();
-#endif
 static void bta_dm_pm_hid_check(bool bScoActive);
 static void bta_dm_pm_stop_timer_by_index(tBTA_PM_TIMER* p_timer,
                                           uint8_t timer_idx);
 
-#if (BTM_SSR_INCLUDED == TRUE)
 #if (BTA_HH_INCLUDED == TRUE)
 #include "../hh/bta_hh_int.h"
 /* BTA_DM_PM_SSR1 will be dedicated for HH SSR setting entry, no other profile
@@ -66,7 +63,6 @@ static void bta_dm_pm_stop_timer_by_index(tBTA_PM_TIMER* p_timer,
 #define BTA_DM_PM_SSR_HH BTA_DM_PM_SSR1
 #endif
 static void bta_dm_pm_ssr(const RawAddress& peer_addr, int ssr);
-#endif
 
 tBTA_DM_CONNECTED_SRVCS bta_dm_conn_srvcs;
 static std::recursive_mutex pm_timer_schedule_mutex;
@@ -357,7 +353,6 @@ static void bta_dm_pm_cback(tBTA_SYS_CONN_STATUS status, uint8_t id,
   bta_dm_pm_stop_timer_by_srvc_id(peer_addr, id);
 /*p_dev = bta_dm_find_peer_device(peer_addr);*/
 
-#if (BTM_SSR_INCLUDED == TRUE)
   /* set SSR parameters on SYS CONN OPEN */
   int index = BTA_DM_PM_SSR0;
   if ((BTA_SYS_CONN_OPEN == status) && p_dev &&
@@ -371,15 +366,12 @@ static void bta_dm_pm_cback(tBTA_SYS_CONN_STATUS status, uint8_t id,
       index = p_bta_dm_pm_spec[p_bta_dm_pm_cfg[i].spec_idx].ssr;
     }
   }
-#endif
 
   /* if no action for the event */
   if (p_bta_dm_pm_spec[p_bta_dm_pm_cfg[i].spec_idx]
           .actn_tbl[status][0]
           .power_mode == BTA_DM_PM_NO_ACTION) {
-#if (BTM_SSR_INCLUDED == TRUE)
     if (BTA_DM_PM_SSR0 == index) /* and do not need to set SSR, return. */
-#endif
       return;
   }
 
@@ -447,7 +439,6 @@ static void bta_dm_pm_cback(tBTA_SYS_CONN_STATUS status, uint8_t id,
     p_dev->pm_mode_failed = 0;
   }
 
-#if (BTM_SSR_INCLUDED == TRUE)
   if (p_bta_dm_ssr_spec[index].max_lat
 #if (BTA_HH_INCLUDED == TRUE)
       || index == BTA_DM_PM_SSR_HH
@@ -470,7 +461,6 @@ static void bta_dm_pm_cback(tBTA_SYS_CONN_STATUS status, uint8_t id,
       }
     }
   }
-#endif
 
   bta_dm_pm_set_mode(peer_addr, BTA_DM_PM_NO_ACTION, pm_req);
 
@@ -702,7 +692,6 @@ static void bta_dm_pm_sniff(tBTA_DM_PEER_DEVICE* p_peer_dev, uint8_t index) {
   tBTM_STATUS status;
 
   BTM_ReadPowerMode(p_peer_dev->peer_bdaddr, &mode);
-#if (BTM_SSR_INCLUDED == TRUE)
   uint8_t* p_rem_feat = BTM_ReadRemoteFeatures(p_peer_dev->peer_bdaddr);
   APPL_TRACE_DEBUG("bta_dm_pm_sniff cur:%d, idx:%d, info:x%x", mode, index,
                    p_peer_dev->info);
@@ -720,12 +709,6 @@ static void bta_dm_pm_sniff(tBTA_DM_PEER_DEVICE* p_peer_dev, uint8_t index) {
       return;
     }
   }
-#else
-  APPL_TRACE_DEBUG("bta_dm_pm_sniff cur:%d, idx:%d", mode, index);
-  if (mode == BTM_PM_MD_SNIFF) {
-    return;
-  }
-#endif
   /* if the current mode is not sniff, issue the sniff command.
    * If sniff, but SSR is not used in this link, still issue the command */
   memcpy(&pwr_md, &p_bta_dm_pm_md[index], sizeof(tBTM_PM_PWR_MD));
@@ -757,7 +740,6 @@ static void bta_dm_pm_sniff(tBTA_DM_PEER_DEVICE* p_peer_dev, uint8_t index) {
  * Returns          void
  *
  ******************************************************************************/
-#if (BTM_SSR_INCLUDED == TRUE)
 static void bta_dm_pm_ssr(const RawAddress& peer_addr, int ssr) {
   int current_ssr_index;
   int ssr_index = ssr;
@@ -820,7 +802,6 @@ static void bta_dm_pm_ssr(const RawAddress& peer_addr, int ssr) {
                      p_spec->min_loc_to);
   }
 }
-#endif
 /*******************************************************************************
  *
  * Function         bta_dm_pm_active
@@ -917,13 +898,11 @@ void bta_dm_pm_btm_status(const RawAddress& bd_addr, tBTM_PM_STATUS status,
           bta_dm_pm_set_mode(bd_addr, BTA_DM_PM_NO_ACTION, BTA_DM_PM_RESTART);
         }
       } else {
-#if (BTM_SSR_INCLUDED == TRUE)
         if (p_dev->prev_low) {
           /* need to send the SSR paramaters to controller again */
           bta_dm_pm_ssr(p_dev->peer_bdaddr, BTA_DM_PM_SSR0);
         }
         p_dev->prev_low = BTM_PM_STS_ACTIVE;
-#endif
         /* link to active mode, need to restart the timer for next low power
          * mode if needed */
         bta_dm_pm_stop_timer(bd_addr);
@@ -931,7 +910,6 @@ void bta_dm_pm_btm_status(const RawAddress& bd_addr, tBTM_PM_STATUS status,
       }
       break;
 
-#if (BTM_SSR_INCLUDED == TRUE)
     case BTM_PM_STS_PARK:
     case BTM_PM_STS_HOLD:
       /* save the previous low power mode - for SSR.
@@ -946,7 +924,6 @@ void bta_dm_pm_btm_status(const RawAddress& bd_addr, tBTM_PM_STATUS status,
       else
         p_dev->info &= ~BTA_DM_DI_USE_SSR;
       break;
-#endif
     case BTM_PM_STS_SNIFF:
       if (hci_status == 0) {
         /* Stop PM timer now if already active for
@@ -1028,7 +1005,6 @@ static bool bta_dm_pm_is_sco_active() {
   return bScoActive;
 }
 
-#if (BTM_SSR_INCLUDED == TRUE)
 /*******************************************************************************
  *
  * Function        bta_dm_get_sco_index
@@ -1048,7 +1024,6 @@ static int bta_dm_get_sco_index() {
   }
   return -1;
 }
-#endif
 
 /*******************************************************************************
  *