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

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

[Invisalign2] Add init and free to SecurityClientInterface

Bug: 301661850
Test: m com.android.btservices
Change-Id: I3d8723807b10bc60e24d4808b311670451746616
parent 4cae8fb9
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -32,13 +32,12 @@
#include "osi/include/log.h"
#include "stack/include/btm_client_interface.h"
#include "stack/include/inq_hci_link_interface.h"
#include "stack_config.h"
#include "stack/include/security_client_callbacks.h"
#include "types/raw_address.h"

/* Global BTM control block structure
*/
tBTM_CB btm_cb;
tBTM_SEC_CB btm_sec_cb;

/*******************************************************************************
 *
@@ -54,9 +53,8 @@ tBTM_SEC_CB btm_sec_cb;
 ******************************************************************************/
void btm_init(void) {
  btm_cb.Init();
  btm_sec_cb.Init(stack_config_get_interface()->get_pts_secure_only_mode()
                      ? BTM_SEC_MODE_SC
                      : BTM_SEC_MODE_SP);
  get_security_client_interface().BTM_Sec_Init();

#ifdef TARGET_FLOSS
  // Need to set inquery by rssi flag for Floss since Floss doesn't do
  // btm_inq_db_init
@@ -66,8 +64,8 @@ void btm_init(void) {

/** This function is called to free dynamic memory and system resource allocated by btm_init */
void btm_free(void) {
  get_security_client_interface().BTM_Sec_Free();
  btm_cb.Free();
  btm_sec_cb.Free();
}

constexpr size_t kMaxLogHistoryTagLength = 6;
+11 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include "osi/include/fixed_queue.h"
#include "osi/include/list.h"
#include "stack/btm/security_device_record.h"
#include "stack_config.h"
#include "types/raw_address.h"

void tBTM_SEC_CB::Init(uint8_t initial_security_mode) {
@@ -66,3 +67,13 @@ void tBTM_SEC_CB::Free() {
  alarm_free(execution_wait_timer);
  execution_wait_timer = nullptr;
}

tBTM_SEC_CB btm_sec_cb;

void BTM_Sec_Init() {
  btm_sec_cb.Init(stack_config_get_interface()->get_pts_secure_only_mode()
                      ? BTM_SEC_MODE_SC
                      : BTM_SEC_MODE_SP);
}

void BTM_Sec_Free() { btm_sec_cb.Free(); }
+3 −0
Original line number Diff line number Diff line
@@ -96,3 +96,6 @@ class tBTM_SEC_CB {
};

extern tBTM_SEC_CB btm_sec_cb;

void BTM_Sec_Init();
void BTM_Sec_Free();
+3 −0
Original line number Diff line number Diff line
@@ -17,11 +17,14 @@

#include "stack/btm/btm_dev.h"
#include "stack/btm/btm_sec.h"
#include "stack/btm/btm_sec_cb.h"
#include "stack/include/btm_ble_sec_api.h"
#include "stack/include/btm_sec_api.h"
#include "stack/include/security_client_callbacks.h"

static SecurityClientInterface security = {
    .BTM_Sec_Init = BTM_Sec_Init,
    .BTM_Sec_Free = BTM_Sec_Free,
    .BTM_SecAddDevice = BTM_SecAddDevice,
    .BTM_SecAddRmtNameNotifyCallback = BTM_SecAddRmtNameNotifyCallback,
    .BTM_SecDeleteDevice = BTM_SecDeleteDevice,
+2 −0
Original line number Diff line number Diff line
@@ -92,6 +92,8 @@ struct tBTM_APPL_INFO {
};

typedef struct {
  void (*BTM_Sec_Init)();
  void (*BTM_Sec_Free)();
  bool (*BTM_SecAddDevice)(const RawAddress& bd_addr, DEV_CLASS dev_class,
                           const BD_NAME& bd_name, uint8_t* features,
                           LinkKey* link_key, uint8_t key_type,