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

Commit c16e4e72 authored by Hansong Zhang's avatar Hansong Zhang Committed by Automerger Merge Worker
Browse files

BTM_PM_REG_SET should imply BTM_PM_REG_NOTIF am: 525eda02 am: 02d52c6f

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1562453

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I6a3bbf1a5f069468a1ea26a4b9947cf7bbf91108
parents 1a22295e 02d52c6f
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -87,8 +87,7 @@ void bta_dm_init_pm(void) {
  if (p_bta_dm_pm_cfg[0].app_id != 0) {
  if (p_bta_dm_pm_cfg[0].app_id != 0) {
    bta_sys_pm_register(bta_dm_pm_cback);
    bta_sys_pm_register(bta_dm_pm_cback);


    BTM_PmRegister((BTM_PM_REG_SET | BTM_PM_REG_NOTIF), &bta_dm_cb.pm_id,
    BTM_PmRegister((BTM_PM_REG_SET), &bta_dm_cb.pm_id, bta_dm_pm_btm_cback);
                   bta_dm_pm_btm_cback);
  }
  }


  /* Need to initialize all PM timer service IDs */
  /* Need to initialize all PM timer service IDs */
+6 −8
Original line number Original line Diff line number Diff line
@@ -147,10 +147,8 @@ tBTM_STATUS BTM_PmRegister(uint8_t mask, uint8_t* p_pm_id,
    /* find an unused entry */
    /* find an unused entry */
    if (pm_reg_db[xx].mask == BTM_PM_REC_NOT_USED) {
    if (pm_reg_db[xx].mask == BTM_PM_REC_NOT_USED) {
      /* if register for notification, should provide callback routine */
      /* if register for notification, should provide callback routine */
      if (mask & BTM_PM_REG_NOTIF) {
      if (p_cb == NULL) return BTM_ILLEGAL_VALUE;
      if (p_cb == NULL) return BTM_ILLEGAL_VALUE;
      pm_reg_db[xx].cback = p_cb;
      pm_reg_db[xx].cback = p_cb;
      }
      pm_reg_db[xx].mask = mask;
      pm_reg_db[xx].mask = mask;
      *p_pm_id = xx;
      *p_pm_id = xx;
      return BTM_SUCCESS;
      return BTM_SUCCESS;
@@ -377,7 +375,7 @@ void btm_pm_reset(void) {


  /* clear the pending request for application */
  /* clear the pending request for application */
  if ((pm_pend_id != BTM_PM_SET_ONLY_ID) &&
  if ((pm_pend_id != BTM_PM_SET_ONLY_ID) &&
      (pm_reg_db[pm_pend_id].mask & BTM_PM_REG_NOTIF)) {
      (pm_reg_db[pm_pend_id].mask & BTM_PM_REG_SET)) {
    cb = pm_reg_db[pm_pend_id].cback;
    cb = pm_reg_db[pm_pend_id].cback;
  }
  }


@@ -665,7 +663,7 @@ void btm_pm_proc_cmd_status(tHCI_STATUS status) {


  /* notify the caller is appropriate */
  /* notify the caller is appropriate */
  if ((pm_pend_id != BTM_PM_SET_ONLY_ID) &&
  if ((pm_pend_id != BTM_PM_SET_ONLY_ID) &&
      (pm_reg_db[pm_pend_id].mask & BTM_PM_REG_NOTIF)) {
      (pm_reg_db[pm_pend_id].mask & BTM_PM_REG_SET)) {
    const RawAddress bd_addr = pm_mode_db[pm_pend_link].bda_;
    const RawAddress bd_addr = pm_mode_db[pm_pend_link].bda_;
    LOG_DEBUG("Notifying callback that link power mode is complete peer:%s",
    LOG_DEBUG("Notifying callback that link power mode is complete peer:%s",
              PRIVATE_ADDRESS(bd_addr));
              PRIVATE_ADDRESS(bd_addr));
@@ -752,7 +750,7 @@ void btm_pm_proc_mode_change(tHCI_STATUS hci_status, uint16_t hci_handle,


  /* notify registered parties */
  /* notify registered parties */
  for (int yy = 0; yy < BTM_MAX_PM_RECORDS; yy++) {
  for (int yy = 0; yy < BTM_MAX_PM_RECORDS; yy++) {
    if (pm_reg_db[yy].mask & BTM_PM_REG_NOTIF) {
    if (pm_reg_db[yy].mask & BTM_PM_REG_SET) {
      (*pm_reg_db[yy].cback)(p_cb->bda_, mode, interval, hci_status);
      (*pm_reg_db[yy].cback)(p_cb->bda_, mode, interval, hci_status);
    }
    }
  }
  }
@@ -792,7 +790,7 @@ void process_ssr_event(tHCI_STATUS status, uint16_t handle,


  int cnt = 0;
  int cnt = 0;
  for (int yy = 0; yy < BTM_MAX_PM_RECORDS; yy++) {
  for (int yy = 0; yy < BTM_MAX_PM_RECORDS; yy++) {
    if (pm_reg_db[yy].mask & BTM_PM_REG_NOTIF) {
    if (pm_reg_db[yy].mask & BTM_PM_REG_SET) {
      (*pm_reg_db[yy].cback)(bd_addr, BTM_PM_STS_SSR, (use_ssr) ? 1 : 0,
      (*pm_reg_db[yy].cback)(bd_addr, BTM_PM_STS_SSR, (use_ssr) ? 1 : 0,
                             status);
                             status);
      cnt++;
      cnt++;
+0 −2
Original line number Original line Diff line number Diff line
@@ -965,8 +965,6 @@ inline std::string power_mode_text(tBTM_PM_MODE mode) {
typedef enum : uint8_t {
typedef enum : uint8_t {
  /* The module wants to set the desired power mode */
  /* The module wants to set the desired power mode */
  BTM_PM_REG_SET = (1u << 0),
  BTM_PM_REG_SET = (1u << 0),
  /* The module wants to receive mode change event */
  BTM_PM_REG_NOTIF = (1u << 1),
  /* The module does not want to involve with PM anymore */
  /* The module does not want to involve with PM anymore */
  BTM_PM_DEREG = (1u << 2),
  BTM_PM_DEREG = (1u << 2),
} tBTM_PM_REGISTER;
} tBTM_PM_REGISTER;