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

Commit dd7865c3 authored by Chris Manton's avatar Chris Manton
Browse files

3/10 Unfriend bta::dm::tBTA_DM_PEER_DEVICE

Add set_av_active
Bug: 296647114
Test: m .

Change-Id: Ie1af7f9d58b3ab197aa3371f277403f18ffe4035
parent 85aa8060
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -2707,7 +2707,7 @@ static void handle_role_change(const RawAddress& bd_addr, tHCI_ROLE new_role,
      ADDRESS_TO_LOGGABLE_CSTR(bd_addr), p_dev->Info(), RoleText(new_role).c_str(),
      bta_dm_cb.device_list.count, hci_error_code_text(hci_status).c_str());

  if (p_dev->Info() & BTA_DM_DI_AV_ACTIVE) {
  if (p_dev->is_av_active()) {
    bool need_policy_change = false;

    /* there's AV activity on this link */
@@ -2955,8 +2955,7 @@ static void bta_dm_check_av() {
      p_dev = &bta_dm_cb.device_list.peer_device[i];
      APPL_TRACE_WARNING("[%d]: state:%d, info:x%x", i, p_dev->conn_state,
                         p_dev->Info());
      if ((p_dev->conn_state == BTA_DM_CONNECTED) &&
          (p_dev->Info() & BTA_DM_DI_AV_ACTIVE)) {
      if ((p_dev->conn_state == BTA_DM_CONNECTED) && p_dev->is_av_active()) {
        /* make central and take away the role switch policy */
        BTM_SwitchRoleToCentral(p_dev->peer_bdaddr);
        /* else either already central or can not switch for some reasons */
@@ -3036,11 +3035,11 @@ void bta_dm_rm_cback(tBTA_SYS_CONN_STATUS status, uint8_t id, uint8_t app_id,

  if (BTA_ID_AV == id) {
    if (status == BTA_SYS_CONN_BUSY) {
      if (p_dev) p_dev->info |= BTA_DM_DI_AV_ACTIVE;
      if (p_dev) p_dev->set_av_active();
      /* AV calls bta_sys_conn_open with the A2DP stream count as app_id */
      if (BTA_ID_AV == id) bta_dm_cb.cur_av_count = bta_dm_get_av_count();
    } else if (status == BTA_SYS_CONN_IDLE) {
      if (p_dev) p_dev->info &= ~BTA_DM_DI_AV_ACTIVE;
      if (p_dev) p_dev->reset_av_active();

      /* get cur_av_count from connected services */
      if (BTA_ID_AV == id) bta_dm_cb.cur_av_count = bta_dm_get_av_count();
+4 −0
Original line number Diff line number Diff line
@@ -267,6 +267,10 @@ struct tBTA_DM_PEER_DEVICE {
  tBTA_DM_DEV_INFO Info() const { return info; }
  void reset_device_info() { info = BTA_DM_DI_NONE; }

  void set_av_active() { info |= BTA_DM_DI_AV_ACTIVE; }
  void reset_av_active() { info &= ~BTA_DM_DI_AV_ACTIVE; }
  bool is_av_active() const { return info & BTA_DM_DI_AV_ACTIVE; }

  tBTA_DM_ENCRYPT_CBACK* p_encrypt_cback;
  tBTM_PM_STATUS prev_low; /* previous low power mode used */
  tBTA_DM_PM_ACTION pm_mode_attempted;