diff options
-rw-r--r-- | sysprop/ble.sysprop | 8 | ||||
-rw-r--r-- | system/stack/btm/btm_ble_sec.cc | 13 |
2 files changed, 19 insertions, 2 deletions
diff --git a/sysprop/ble.sysprop b/sysprop/ble.sysprop index ad2208f0b1..f6667551de 100644 --- a/sysprop/ble.sysprop +++ b/sysprop/ble.sysprop @@ -24,3 +24,11 @@ prop { access: Readonly prop_name: "bluetooth.ble.random_address_rotation_interval_max" } + +prop { + api_name: "allow_enc_with_bredr" + type: Boolean + scope: Internal + access: Readonly + prop_name: "bluetooth.ble.allow_enc_with_bredr" +} diff --git a/system/stack/btm/btm_ble_sec.cc b/system/stack/btm/btm_ble_sec.cc index d61ac51a00..347d35692e 100644 --- a/system/stack/btm/btm_ble_sec.cc +++ b/system/stack/btm/btm_ble_sec.cc @@ -19,6 +19,7 @@ #include "stack/btm/btm_ble_sec.h" +#include <android_bluetooth_sysprop.h> #include <base/strings/stringprintf.h> #include <bluetooth/log.h> @@ -1234,8 +1235,16 @@ tBTM_STATUS btm_ble_start_encrypt(const RawAddress& bda, bool use_stk, return BTM_WRONG_MODE; } - if (p_rec->sec_rec.is_security_state_encrypting()) { - log::warn("Link Encryption is active, Busy!"); + if (p_rec->sec_rec.is_security_state_le_encrypting()) { + log::warn("LE link encryption is active, Busy!"); + return BTM_BUSY; + } + + // Some controllers may not like encrypting both transports at the same time + bool allow_le_enc_with_bredr = GET_SYSPROP(Ble, allow_enc_with_bredr, false); + if (!allow_le_enc_with_bredr && + p_rec->sec_rec.is_security_state_bredr_encrypting()) { + log::warn("BR/EDR link encryption is active, Busy!"); return BTM_BUSY; } |