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

Commit 36f5a88c authored by Himanshu Rawat's avatar Himanshu Rawat
Browse files

Expose a BTM interface to get cached class of device

Test: mmm packages/modules/Bluetooth
Flag: EXEMPT no logical change
Bug: 286334644
Change-Id: Ib31d7dd0d29669540c5c60682494b7ae2ca5b14d
parent 61743123
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -248,6 +248,25 @@ const char* BTM_SecReadDevName(const RawAddress& bd_addr) {
  return p_name;
}

/*******************************************************************************
 *
 * Function         BTM_SecReadDevClass
 *
 * Description      Looks for the class of device in the security database for
 *                  the specified BD address.
 *
 * Returns          Class of device or kDevClassEmpty
 *
 ******************************************************************************/
DEV_CLASS BTM_SecReadDevClass(const RawAddress& bd_addr) {
  tBTM_SEC_DEV_REC* p_srec = btm_find_dev(bd_addr);
  if (p_srec != nullptr) {
    return p_srec->dev_class;
  }

  return kDevClassEmpty;
}

/*******************************************************************************
 *
 * Function         btm_sec_alloc_dev
+12 −0
Original line number Diff line number Diff line
@@ -56,6 +56,18 @@ void BTM_SecClearSecurityFlags(const RawAddress& bd_addr);
 ******************************************************************************/
const char* BTM_SecReadDevName(const RawAddress& bd_addr);

/*******************************************************************************
 *
 * Function         BTM_SecReadDevName
 *
 * Description      Looks for the device name in the security database for the
 *                  specified BD address.
 *
 * Returns          Pointer to the name or NULL
 *
 ******************************************************************************/
DEV_CLASS BTM_SecReadDevClass(const RawAddress& bd_addr);

/*******************************************************************************
 *
 * Function         btm_sec_alloc_dev
+1 −0
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ static SecurityClientInterface security = {
        .BTM_GetSecurityMode = BTM_GetSecurityMode,

        .BTM_SecReadDevName = BTM_SecReadDevName,
        .BTM_SecReadDevClass = BTM_SecReadDevClass,
};

const SecurityClientInterface& get_security_client_interface() { return security; }
+1 −0
Original line number Diff line number Diff line
@@ -141,6 +141,7 @@ typedef struct {
  // remote name request related APIs
  // TODO: remove them from this structure
  const char* (*BTM_SecReadDevName)(const RawAddress& bd_addr);
  DEV_CLASS (*BTM_SecReadDevClass)(const RawAddress& bd_addr);
} SecurityClientInterface;

const SecurityClientInterface& get_security_client_interface();
+4 −0
Original line number Diff line number Diff line
@@ -60,6 +60,10 @@ const char* BTM_SecReadDevName(const RawAddress& /* bd_addr */) {
  inc_func_call_count(__func__);
  return nullptr;
}
DEV_CLASS BTM_SecReadDevClass(const RawAddress& /* bd_addr */) {
  inc_func_call_count(__func__);
  return kDevClassEmpty;
}
tBTM_SEC_DEV_REC* btm_find_dev(const RawAddress& bd_addr) {
  inc_func_call_count(__func__);
  return test::mock::stack_btm_dev::btm_find_dev.body(bd_addr);
Loading