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

Commit 2822ca01 authored by Chris Manton's avatar Chris Manton
Browse files

5/10 Unfriend bta::dm::tBTA_DM_PEER_DEVICE

reset_sniff_flags
Bug: 296647114
Test: m .

Change-Id: If1dc7435d1351a09412482c442b02e1b3a715668
parent 5b0f9eb0
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -274,6 +274,10 @@ struct tBTA_DM_PEER_DEVICE {
  // NOTE: Why is this not used as a bitmask
  void set_both_device_ssr_capable() { info = BTA_DM_DI_USE_SSR; }

  void reset_sniff_flags() {
    info &= ~(BTA_DM_DI_INT_SNIFF | BTA_DM_DI_ACP_SNIFF | BTA_DM_DI_SET_SNIFF);
  }

  tBTA_DM_ENCRYPT_CBACK* p_encrypt_cback;
  tBTM_PM_STATUS prev_low; /* previous low power mode used */
  tBTA_DM_PM_ACTION pm_mode_attempted;
+5 −9
Original line number Diff line number Diff line
@@ -811,18 +811,16 @@ void bta_dm_pm_sniff(tBTA_DM_PEER_DEVICE* p_peer_dev, uint8_t index) {
  }
  status = BTM_SetPowerMode(bta_dm_cb.pm_id, p_peer_dev->peer_bdaddr, &pwr_md);
  if (status == BTM_CMD_STORED || status == BTM_CMD_STARTED) {
    p_peer_dev->info &= ~(BTA_DM_DI_INT_SNIFF | BTA_DM_DI_ACP_SNIFF);
    p_peer_dev->reset_sniff_flags();
    p_peer_dev->info |= BTA_DM_DI_SET_SNIFF;
  } else if (status == BTM_SUCCESS) {
    APPL_TRACE_DEBUG("bta_dm_pm_sniff BTM_SetPowerMode() returns BTM_SUCCESS");
    p_peer_dev->info &=
        ~(BTA_DM_DI_INT_SNIFF | BTA_DM_DI_ACP_SNIFF | BTA_DM_DI_SET_SNIFF);
    p_peer_dev->reset_sniff_flags();
  } else {
    LOG_ERROR("Unable to set power mode peer:%s status:%s",
              ADDRESS_TO_LOGGABLE_CSTR(p_peer_dev->peer_bdaddr),
              btm_status_text(status).c_str());
    p_peer_dev->info &=
        ~(BTA_DM_DI_INT_SNIFF | BTA_DM_DI_ACP_SNIFF | BTA_DM_DI_SET_SNIFF);
    p_peer_dev->reset_sniff_flags();
  }
}
/*******************************************************************************
@@ -1016,8 +1014,7 @@ void bta_dm_pm_btm_status(const RawAddress& bd_addr, tBTM_PM_STATUS status,
      we should not try it again*/
      if (hci_status != 0) {
        APPL_TRACE_ERROR("%s hci_status=%d", __func__, hci_status);
        p_dev->info &=
            ~(BTA_DM_DI_INT_SNIFF | BTA_DM_DI_ACP_SNIFF | BTA_DM_DI_SET_SNIFF);
        p_dev->reset_sniff_flags();

        if (p_dev->pm_mode_attempted & (BTA_DM_PM_PARK | BTA_DM_PM_SNIFF)) {
          p_dev->pm_mode_failed |=
@@ -1071,8 +1068,7 @@ void bta_dm_pm_btm_status(const RawAddress& bd_addr, tBTM_PM_STATUS status,
        bta_dm_pm_stop_timer(bd_addr);
      } else {
        tBTA_DM_DEV_INFO info = p_dev->Info();
        p_dev->info &=
            ~(BTA_DM_DI_SET_SNIFF | BTA_DM_DI_INT_SNIFF | BTA_DM_DI_ACP_SNIFF);
        p_dev->reset_sniff_flags();
        if (info & BTA_DM_DI_SET_SNIFF)
          p_dev->info |= BTA_DM_DI_INT_SNIFF;
        else