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

Commit 00dfc046 authored by Zach Johnson's avatar Zach Johnson
Browse files

Encapsulate all default policy setting inside ACL

logically it belongs here

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Ibd713dd578d305ee0becde09f66d73d9e57eb014
parent 48823a6d
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@
#endif
#include "btif/include/btif_av.h"
#include "btif/include/btif_hf.h"
#include "stack/include/acl_api.h"

/*****************************************************************************
 *  Constants
@@ -845,12 +846,7 @@ void bta_av_do_disc_a2dp(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
  }

  if (bta_av_cb.features & BTA_AV_FEAT_MASTER) {
    BTA_dm_block_role_switch();

    if (bta_av_cb.audio_open_cnt == 1) {
      /* there's already an A2DP connection. do not allow switch */
      BTA_dm_block_role_switch();
    }
    BTM_default_block_role_switch();
  }
  /* store peer addr other parameters */
  bta_av_save_addr(p_scb, p_data->api_open.bd_addr);
@@ -2466,7 +2462,7 @@ void bta_av_str_closed(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
    BTA_dm_unblock_role_switch_for(p_scb->PeerAddress());
  }
  if (bta_av_cb.audio_open_cnt <= 1) {
    BTA_dm_unblock_role_switch();
    BTM_default_unblock_role_switch();
  }

  if (p_scb->open_status != BTA_AV_SUCCESS) {
+2 −1
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@
#include "osi/include/log.h"
#include "osi/include/osi.h"
#include "osi/include/properties.h"
#include "stack/include/acl_api.h"
#include "utl.h"

#if (BTA_AR_INCLUDED == TRUE)
@@ -1270,7 +1271,7 @@ void bta_av_conn_chg(tBTA_AV_DATA* p_data) {
    if (p_cb->audio_open_cnt == 1) {
      /* one audio channel goes down and there's one audio channel remains open.
       * restore the switch role in default link policy */
      BTA_dm_unblock_role_switch();
      BTM_default_unblock_role_switch();
      bta_av_restore_switch();
    }
    if (p_cb->audio_open_cnt) {
+0 −10
Original line number Diff line number Diff line
@@ -840,16 +840,6 @@ void BTA_dm_block_role_switch_for(const RawAddress& peer_addr) {
  BTM_SetLinkPolicy(p_dev->peer_bdaddr, &(p_dev->link_policy));
}

void BTA_dm_unblock_role_switch() {
  BTM_SetDefaultLinkPolicy(btm_cb.acl_cb_.btm_def_link_policy |
                           HCI_ENABLE_MASTER_SLAVE_SWITCH);
}

void BTA_dm_block_role_switch() {
  BTM_SetDefaultLinkPolicy(btm_cb.acl_cb_.btm_def_link_policy &
                           ~HCI_ENABLE_MASTER_SLAVE_SWITCH);
}

/** Send the user confirm request reply in response to a request from BTM */
void bta_dm_confirm(const RawAddress& bd_addr, bool accept) {
  BTM_ConfirmReqReply(accept ? BTM_SUCCESS : BTM_NOT_AUTHORIZED, bd_addr);
+0 −2
Original line number Diff line number Diff line
@@ -245,7 +245,5 @@ void BTA_dm_unblock_sniff_mode_for(const RawAddress& peer_addr);
void BTA_dm_block_sniff_mode_for(const RawAddress& peer_addr);
void BTA_dm_unblock_role_switch_for(const RawAddress& peer_addr);
void BTA_dm_block_role_switch_for(const RawAddress& peer_addr);
void BTA_dm_unblock_role_switch();
void BTA_dm_block_role_switch();

#endif /* BTA_SYS_H */
+2 −11
Original line number Diff line number Diff line
@@ -1131,17 +1131,8 @@ uint8_t* BTM_ReadRemoteFeatures(const RawAddress& addr);
 ******************************************************************************/
tBTM_STATUS BTM_SetLinkPolicy(const RawAddress& remote_bda, uint16_t* settings);

/*******************************************************************************
 *
 * Function         BTM_SetDefaultLinkPolicy
 *
 * Description      Set the default value for HCI "Write Policy Set" command
 *                  to use when an ACL link is created.
 *
 * Returns          void
 *
 ******************************************************************************/
void BTM_SetDefaultLinkPolicy(uint16_t settings);
void BTM_default_unblock_role_switch();
void BTM_default_block_role_switch();

/*******************************************************************************
 *
Loading