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

Commit e2929da4 authored by Zach Johnson's avatar Zach Johnson Committed by Gerrit Code Review
Browse files

Merge changes Ic6cddf83,Ief881395,Ife7deb79,I47360c24

* changes:
  Remove notion of app_id from role switch blocking
  Remove bta_sys_set_default_policy
  Remove bta_sys_clear_default_policy
  Adjust naming to match behavior
parents 9d43fa94 93697c1a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -849,7 +849,7 @@ void bta_av_do_disc_a2dp(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {

    if (bta_av_cb.audio_open_cnt == 1) {
      /* there's already an A2DP connection. do not allow switch */
      bta_sys_clear_default_policy(BTA_ID_AV, HCI_ENABLE_MASTER_SLAVE_SWITCH);
      BTA_dm_block_role_switch();
    }
  }
  /* store peer addr other parameters */
+1 −2
Original line number Diff line number Diff line
@@ -1270,8 +1270,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_sys_set_default_policy(BTA_ID_AV, HCI_ENABLE_MASTER_SLAVE_SWITCH);
      /* allow role switch, if this is the last connection */
      BTA_dm_unblock_role_switch();
      bta_av_restore_switch();
    }
    if (p_cb->audio_open_cnt) {
+4 −11
Original line number Diff line number Diff line
@@ -851,19 +851,12 @@ void BTA_dm_clear_policy(uint8_t policy, const RawAddress& peer_addr) {
  }
}

void BTA_dm_set_default_policy(uint8_t app_id) {
  uint32_t mask = (uint32_t)(1 << app_id);
  bta_dm_cb.role_policy_mask &= ~mask;
  if (0 == bta_dm_cb.role_policy_mask) {
    /* if nobody wants to insist on the role */
void BTA_dm_unblock_role_switch() {
  bta_dm_cb.cur_policy |= HCI_ENABLE_MASTER_SLAVE_SWITCH;
  BTM_SetDefaultLinkPolicy(bta_dm_cb.cur_policy);
}
}

void BTA_dm_clear_default_policy(uint8_t app_id) {
  uint32_t mask = (uint32_t)(1 << app_id);
  bta_dm_cb.role_policy_mask |= mask;
void BTA_dm_block_role_switch() {
  bta_dm_cb.cur_policy &= ~HCI_ENABLE_MASTER_SLAVE_SWITCH;
  BTM_SetDefaultLinkPolicy(bta_dm_cb.cur_policy);
}
+0 −3
Original line number Diff line number Diff line
@@ -296,9 +296,6 @@ typedef struct {
  uint8_t num_master_only;
  uint8_t pm_id;
  tBTA_PM_TIMER pm_timer[BTA_DM_NUM_PM_TIMER];
  uint32_t
      role_policy_mask;   /* the bits set indicates the modules that wants to
                             remove role switch from the default link policy */
  uint16_t cur_policy;    /* current default link policy */
  uint16_t rs_event;      /* the event waiting for role switch */
  uint8_t cur_av_count;   /* current AV connecions */
+3 −2
Original line number Diff line number Diff line
@@ -245,7 +245,8 @@ extern void bta_sys_set_policy(uint8_t id, uint8_t policy,
                               const RawAddress& peer_addr);
extern void bta_sys_clear_policy(uint8_t id, uint8_t policy,
                                 const RawAddress& peer_addr);
extern void bta_sys_set_default_policy(uint8_t id, uint8_t policy);
extern void bta_sys_clear_default_policy(uint8_t id, uint8_t policy);

void BTA_dm_unblock_role_switch();
void BTA_dm_block_role_switch();

#endif /* BTA_SYS_H */
Loading