Loading system/gd/rust/common/src/init_flags.rs +1 −0 Original line number Diff line number Diff line Loading @@ -396,6 +396,7 @@ init_flags!( sdp_return_classic_services_when_le_discovery_fails = true, use_rsi_from_cached_inqiry_results = false, att_mtu_default: i32 = 517, encryption_in_busy_state = true, } // dynamic flags can be updated at runtime and should be accessed directly // to check. Loading system/gd/rust/shim/src/init_flags.rs +1 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ mod ffi { fn sdp_return_classic_services_when_le_discovery_fails_is_enabled() -> bool; fn use_rsi_from_cached_inqiry_results_is_enabled() -> bool; fn get_att_mtu_default() -> i32; fn encryption_in_busy_state_is_enabled() -> bool; } } Loading system/stack/btm/btm_sec.cc +46 −7 Original line number Diff line number Diff line Loading @@ -1148,7 +1148,45 @@ tBTM_STATUS BTM_SetEncryption(const RawAddress& bd_addr, break; } /* enqueue security request if security is active */ /* Enqueue security request if security is active */ if (bluetooth::common::init_flags::encryption_in_busy_state_is_enabled()) { bool enqueue = false; switch (p_dev_rec->sec_state) { case BTM_SEC_STATE_AUTHENTICATING: case BTM_SEC_STATE_DISCONNECTING_BOTH: /* Applicable for both transports */ enqueue = true; break; case BTM_SEC_STATE_ENCRYPTING: case BTM_SEC_STATE_DISCONNECTING: if (transport == BT_TRANSPORT_BR_EDR) { enqueue = true; } break; case BTM_SEC_STATE_LE_ENCRYPTING: case BTM_SEC_STATE_DISCONNECTING_BLE: if (transport == BT_TRANSPORT_LE) { enqueue = true; } break; default: if (p_dev_rec->p_callback != nullptr) { enqueue = true; } break; } if (enqueue) { LOG_WARN("Security Manager: Enqueue request in state:%s", security_state_text(p_dev_rec->sec_state).c_str()); btm_sec_queue_encrypt_request(bd_addr, transport, p_callback, p_ref_data, sec_act); return BTM_CMD_STARTED; } } else { if (p_dev_rec->p_callback || (p_dev_rec->sec_state != BTM_SEC_STATE_IDLE)) { LOG_WARN("Security Manager: BTM_SetEncryption busy, enqueue request"); btm_sec_queue_encrypt_request(bd_addr, transport, p_callback, p_ref_data, Loading @@ -1156,6 +1194,7 @@ tBTM_STATUS BTM_SetEncryption(const RawAddress& bd_addr, LOG_INFO("Queued start encryption"); return BTM_CMD_STARTED; } } p_dev_rec->p_callback = p_callback; p_dev_rec->p_ref_data = p_ref_data; Loading Loading
system/gd/rust/common/src/init_flags.rs +1 −0 Original line number Diff line number Diff line Loading @@ -396,6 +396,7 @@ init_flags!( sdp_return_classic_services_when_le_discovery_fails = true, use_rsi_from_cached_inqiry_results = false, att_mtu_default: i32 = 517, encryption_in_busy_state = true, } // dynamic flags can be updated at runtime and should be accessed directly // to check. Loading
system/gd/rust/shim/src/init_flags.rs +1 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ mod ffi { fn sdp_return_classic_services_when_le_discovery_fails_is_enabled() -> bool; fn use_rsi_from_cached_inqiry_results_is_enabled() -> bool; fn get_att_mtu_default() -> i32; fn encryption_in_busy_state_is_enabled() -> bool; } } Loading
system/stack/btm/btm_sec.cc +46 −7 Original line number Diff line number Diff line Loading @@ -1148,7 +1148,45 @@ tBTM_STATUS BTM_SetEncryption(const RawAddress& bd_addr, break; } /* enqueue security request if security is active */ /* Enqueue security request if security is active */ if (bluetooth::common::init_flags::encryption_in_busy_state_is_enabled()) { bool enqueue = false; switch (p_dev_rec->sec_state) { case BTM_SEC_STATE_AUTHENTICATING: case BTM_SEC_STATE_DISCONNECTING_BOTH: /* Applicable for both transports */ enqueue = true; break; case BTM_SEC_STATE_ENCRYPTING: case BTM_SEC_STATE_DISCONNECTING: if (transport == BT_TRANSPORT_BR_EDR) { enqueue = true; } break; case BTM_SEC_STATE_LE_ENCRYPTING: case BTM_SEC_STATE_DISCONNECTING_BLE: if (transport == BT_TRANSPORT_LE) { enqueue = true; } break; default: if (p_dev_rec->p_callback != nullptr) { enqueue = true; } break; } if (enqueue) { LOG_WARN("Security Manager: Enqueue request in state:%s", security_state_text(p_dev_rec->sec_state).c_str()); btm_sec_queue_encrypt_request(bd_addr, transport, p_callback, p_ref_data, sec_act); return BTM_CMD_STARTED; } } else { if (p_dev_rec->p_callback || (p_dev_rec->sec_state != BTM_SEC_STATE_IDLE)) { LOG_WARN("Security Manager: BTM_SetEncryption busy, enqueue request"); btm_sec_queue_encrypt_request(bd_addr, transport, p_callback, p_ref_data, Loading @@ -1156,6 +1194,7 @@ tBTM_STATUS BTM_SetEncryption(const RawAddress& bd_addr, LOG_INFO("Queued start encryption"); return BTM_CMD_STARTED; } } p_dev_rec->p_callback = p_callback; p_dev_rec->p_ref_data = p_ref_data; Loading