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

Commit f9b68125 authored by Hui Peng's avatar Hui Peng
Browse files

[Invisalign2] Encapsulate tBTM_SEC_CB::RemoveServiceByPsm

Bug: 301661850
Test: m com.android.btservices
Flag: EXEMPT, mechanical refactor
Change-Id: I49b34e24c60a7db126912e1488e7e65c37ca97d5
parent e06e22de
Loading
Loading
Loading
Loading
+1 −15
Original line number Diff line number Diff line
@@ -467,21 +467,7 @@ uint8_t BTM_SecClrService(uint8_t service_id) {
 *
 ******************************************************************************/
uint8_t BTM_SecClrServiceByPsm(uint16_t psm) {
  tBTM_SEC_SERV_REC* p_srec = &btm_sec_cb.sec_serv_rec[0];
  uint8_t num_freed = 0;
  int i;

  for (i = 0; i < BTM_SEC_MAX_SERVICE_RECORDS; i++, p_srec++) {
    /* Delete services with specified name (if in use and not SDP) */
    if ((p_srec->security_flags & BTM_SEC_IN_USE) && (p_srec->psm == psm)) {
      LOG_VERBOSE("BTM_SEC_CLR[%d]: id %d ", i, p_srec->service_id);
      p_srec->security_flags = 0;
      num_freed++;
    }
  }
  LOG_VERBOSE("BTM_SecClrServiceByPsm psm:0x%x num_freed:%d", psm, num_freed);

  return (num_freed);
  return btm_sec_cb.RemoveServiceByPsm(psm);
}

/*******************************************************************************
+18 −0
Original line number Diff line number Diff line
@@ -323,3 +323,21 @@ uint8_t tBTM_SEC_CB::RemoveServiceById(uint8_t service_id) {
  }
  return (num_freed);
}

uint8_t tBTM_SEC_CB::RemoveServiceByPsm(uint16_t psm) {
  tBTM_SEC_SERV_REC* p_srec = &sec_serv_rec[0];
  uint8_t num_freed = 0;
  int i;

  for (i = 0; i < BTM_SEC_MAX_SERVICE_RECORDS; i++, p_srec++) {
    /* Delete services with specified name (if in use and not SDP) */
    if ((p_srec->security_flags & BTM_SEC_IN_USE) && (p_srec->psm == psm)) {
      LOG_VERBOSE("BTM_SEC_CLR[%d]: id %d ", i, p_srec->service_id);
      p_srec->security_flags = 0;
      num_freed++;
    }
  }
  LOG_VERBOSE("psm:0x%x num_freed:%d", psm, num_freed);

  return (num_freed);
}
+1 −0
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ class tBTM_SEC_CB {
                  uint16_t sec_level, uint16_t psm, uint32_t mx_proto_id,
                  uint32_t mx_chan_id);
  uint8_t RemoveServiceById(uint8_t service_id);
  uint8_t RemoveServiceByPsm(uint16_t psm);
};

extern tBTM_SEC_CB btm_sec_cb;