From c8c00cbd7feee1a6130b5fd8790c5e0456d567d1 Mon Sep 17 00:00:00 2001 From: Chris Manton Date: Sun, 10 Jan 2021 22:06:29 -0800 Subject: [PATCH] Use tBTM_SEC_DEV_REC::IsLocallyInitiated Towards encapsulated code Bug: 163134718 Tag: #refactor Test: gd/cert/run Change-Id: I36da3481eb54ce016df021fa6d24f3f82555ace8 --- stack/btm/btm_sec.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/stack/btm/btm_sec.cc b/stack/btm/btm_sec.cc index 70528f785..0fa4ed086 100644 --- a/stack/btm/btm_sec.cc +++ b/stack/btm/btm_sec.cc @@ -3699,7 +3699,7 @@ void btm_sec_disconnected(uint16_t handle, tHCI_STATUS reason) { // This is for chips that don't support being in connected and advertising // state at same time. - if (!p_dev_rec->is_originator) { + if (!p_dev_rec->IsLocallyInitiated()) { btm_ble_advertiser_notify_terminated_legacy(HCI_SUCCESS, handle); } } else { @@ -4091,7 +4091,7 @@ void btm_sec_pin_code_request(uint8_t* p_event) { /* the only thing we can do here is to shut it up. Normally we will be originator */ /* for keyboard bonding */ - || (!p_dev_rec->is_originator && + || (!p_dev_rec->IsLocallyInitiated() && ((p_dev_rec->dev_class[1] & BTM_COD_MAJOR_CLASS_MASK) == BTM_COD_MAJOR_PERIPHERAL) && (p_dev_rec->dev_class[2] & BTM_COD_MINOR_KEYBOARD))) { @@ -4207,12 +4207,12 @@ tBTM_STATUS btm_sec_execute_procedure(tBTM_SEC_DEV_REC* p_dev_rec) { /* If connection is not authenticated and authentication is required */ /* start authentication and return PENDING to the caller */ if ((((!(p_dev_rec->sec_flags & BTM_SEC_AUTHENTICATED)) && - ((p_dev_rec->is_originator && + ((p_dev_rec->IsLocallyInitiated() && (p_dev_rec->security_required & BTM_SEC_OUT_AUTHENTICATE)) || - (!p_dev_rec->is_originator && + (!p_dev_rec->IsLocallyInitiated() && (p_dev_rec->security_required & BTM_SEC_IN_AUTHENTICATE)))) || (!(p_dev_rec->sec_flags & BTM_SEC_16_DIGIT_PIN_AUTHED) && - (!p_dev_rec->is_originator && + (!p_dev_rec->IsLocallyInitiated() && (p_dev_rec->security_required & BTM_SEC_IN_MIN_16_DIGIT_PIN)))) && (p_dev_rec->hci_handle != HCI_INVALID_HANDLE)) { /* @@ -4237,7 +4237,7 @@ tBTM_STATUS btm_sec_execute_procedure(tBTM_SEC_DEV_REC* p_dev_rec) { */ if ((p_dev_rec->sec_flags & BTM_SEC_LINK_KEY_KNOWN) && (!(p_dev_rec->sec_flags & BTM_SEC_16_DIGIT_PIN_AUTHED) && - (!p_dev_rec->is_originator && + (!p_dev_rec->IsLocallyInitiated() && (p_dev_rec->security_required & BTM_SEC_IN_MIN_16_DIGIT_PIN)))) { p_dev_rec->sec_flags &= ~(BTM_SEC_LINK_KEY_KNOWN | BTM_SEC_LINK_KEY_AUTHED | @@ -4251,9 +4251,9 @@ tBTM_STATUS btm_sec_execute_procedure(tBTM_SEC_DEV_REC* p_dev_rec) { /* If connection is not encrypted and encryption is required */ /* start encryption and return PENDING to the caller */ if (!(p_dev_rec->sec_flags & BTM_SEC_ENCRYPTED) && - ((p_dev_rec->is_originator && + ((p_dev_rec->IsLocallyInitiated() && (p_dev_rec->security_required & BTM_SEC_OUT_ENCRYPT)) || - (!p_dev_rec->is_originator && + (!p_dev_rec->IsLocallyInitiated() && (p_dev_rec->security_required & BTM_SEC_IN_ENCRYPT))) && (p_dev_rec->hci_handle != HCI_INVALID_HANDLE)) { BTM_TRACE_EVENT("Security Manager: Start encryption"); -- 2.11.0